fstatat(), fstatat64()

QNX SDP8.0C Library ReferenceAPIDeveloper

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.

Note:
The fstatat64() function is a large-file support version of fstatat() provided for backwards compatibility. If you're using large-file support functions and data types, you should define _LARGEFILE64_SOURCE with a value of 1 to ensure they appear in the name space. 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 pointNo
Signal handlerYes
ThreadYes
Page updated: