fstatat(), fstatat64()

Get information about a file or directory

Synopsis:

#include <sys/stat.h>

int fstatat( const int fd,
             const char* path, 
             struct stat* buf,
             int flags );

int fstatat64( const int fd,
               const char* path, 
               struct stat64* buf,
               int flags );

Arguments:

fd
The file descriptor of a directory that you want a relative path to be relative to, or AT_FDCWD to make a relative path be relative to the current working directory.
Note: You must currently pass AT_FDCWD for this argument.
path
The path of the file or directory that you want information about.
buf
A pointer to a struct stat or struct stat64 buffer where the function can store the information.
flag
Flags that affect the behavior of the function; 0 or the following:
  • AT_SYMLINK_NOFOLLOW — if path names a symbolic link, get information about the link itself.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The fstatat() and fstatat64() functions obtain information about the file or directory referenced in path. This information is placed in the structure located at the address indicated by buf. The fstatat64() function is a large-file support version of fstatat().

Note: In QNX Neutrino 6.6 or later, the large-file support functions and data types appear in the name space only if you define _LARGEFILE64_SOURCE when you compile your code. For more information, see Classification in What's in a Function Description?

The results of the fstatat() function are the same as the results of lstat() or stat(), depending on whether or not AT_SYMLINK_NOFOLLOW is set in the flags.

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

The same as stat(), as well as the following:

EINVAL
The value of the flag argument was invalid.
ENOTSUP
The value of fd wasn't AT_FDCWD.

Classification:

fstatat() is POSIX 1003.1; fstatat64() is Large-file support

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes