[Previous]
[Contents]
[Next]

fsys_get_mount_dev()

get the device for a file

Synopsis:

#include <sys/fsys.h>
int fsys_get_mount_dev( const char *path,
                        char *device );

Description:

fsys_get_mount_dev() finds and returns the device that a file is on. For instance, if you have a file /home/bill/old, and you need to know its physical device, you could use the path to find that device (/dev/hd0t77).

Returns:

0
Success
-1
An error occurred. errno is set to indicate the error.

Errors:

EACCES
Search permission is denied on component of path.
ENAMETOOLONG
The length of the path string exceeds PATH_MAX, or a pathname component is longer than NAME_MAX.
ENOENT
Either the path prefix does not exist, or the path argument points to an empty string.
ENOSYS
This function is not supported for this path.
ENOTDIR
A component of the path prefix is not a directory.

Examples:

#include <limits.h>
#include <sys/fsys.h>

void main(int argc, char **argv)
  {
    char buf[_POSIX_NAME_MAX];

    fsys_get_mount_dev( argv[1], buf );

    printf( "'%s' is on the %s device\n", argv[1], buf );
  }

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

See also:

errno, fsys_get_mount_pt()


[Previous]
[Contents]
[Next]