[Previous]
[Contents]
[Next]

fsys_stat()

get information about the file in a path

Synopsis:

#include <sys/stat.h>
int fsys_stat( const char *path, 
               struct _fsys_stat *buf );

Description:

The fsys_stat() function obtains detailed information about the file referenced in path. This information is placed in the structure pointed to by buf.

The _fsys_stat structure includes all the information contained in the stat structure plus filesystem extent information.


Note: This call works only on regular files, directories and other disk-based file types.

Returns:

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

Errors:

EACCES
Search permission is denied for a component of path.
ENAMETOOLONG
The argument path exceeds PATH_MAX in length, or a component of path is longer than NAME_MAX.
ENOENT
The named file does not exist, or path is an empty string.
ENOTDIR
A component of path is not a directory.
ENOSYS
This operation is not supported for the resource manager associated with this fildes. Try calling stat().

Examples:

/*
 * Get the extended stat info for a list of files
 * and report the file sizes and numbers of extents
 */
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>

void main( int argc, char **argv )
  {
    int ecode = 0;
    int n;
    struct _fsys_stat xsbuf;

    for( n = 1; n < argc; ++n ) {
      if( fsys_stat( argv[n], &xsbuf ) == -1 ) {
        perror( argv[n] );
        ecode++;
      } else
        printf(
          "File %s is %ld bytes and has %u extents\n",
          argv[n], xsbuf.st_size, xsbuf.st_num_xtnts);
    }
    exit( ecode );
  }

Classification:

QNX

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

See also:

errno, fstat(), fsys_fstat(), lstat(), stat()


[Previous]
[Contents]
[Next]