QNX API to get application running drive name

Hi,

   Is there any API in QNX to know the name of the drive(can be physical or logical) in which the QNX application is running. 

Thanks in advance,
hello

What do you mean by the “name of the drive”?

  1. /dev/hd0 (The device)
  2. /dev/hd0t77 (The partition)
  3. Seagate (The manufacturer)
  4. Norman (Some arbitrary name you made up)
  5. / or /hd (The mount point)

Applications don’t run in drives. The load module might be on a drive, or the program might be reading from a drive. You might have booted from a ROM and a program in the load module might be reading off of a drive.

“the program might be reading from a drive”. Is there any API to get the hardisk name from which the program is read , i mean 1) /dev/hd0 (The device)
2) /dev/hd0t77 (The partition)

Regards,
hello

Briefly, yes. This isn’t a very good answer. It is possible to figure this out programatically. I think the place to start looking is with stat, fstat or lstat.

This isn’t completely “programmatic”, but running “pidin -p1 fds” dumps the filename of every currently running binary.

Knowing the filename of your binary, you can call fstatvfs() to deduce the physical device and volume it is associated with.

Hi,

I tried using fstatvfs(). But the struct statvfs doesnt have fields indicating disk name. Using df -P , i am able to get the logical drive name in which application is read. Is there any API corresponding to it.

Regards,
hello