#include <sys/stat.h> int fstat64(int fildes, struct stat64 *buf);Service Program Name: QP0LLIB1
The fstat64() function gets status information about the file specified by the open file descriptor file_descriptor and stores the information in the area of memory indicated by the buf argument. The status information is returned in a stat64 structure, as defined in the <sys/stat.h> header file.
fstat64() is enabled for large files. It is capable of operating on files larger than 2GB minus 1 byte as long as the file has been opened by either of the following:
The elements of the stat64 structure are described in stat64()--Get File Information (Large File Enabled).
For additional information about parameters, authorities required, and error conditions, see fstat()--Get File Information by Descriptor.
See Code disclaimer information for information pertaining to code examples.
The following example gets status information:
#define _LARGE_FILE_API #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <time.h> main() { char fn[]="temp.file"; struct stat64 info; int file_descriptor; if ((file_descriptor = creat64(fn, S_IWUSR)) < 0) perror("creat64() error"); else { if (ftruncate64(file_descriptor, 8589934662) != 0) perror("ftruncate64() error"); else { if (fstat64(file_descriptor, &info) != 0) perror("fstat64() error"); else { puts("fstat64() returned:"); printf(" inode: %d\n", (int) info.st_ino); printf(" dev id: %d\n", (int) info.st_dev); printf(" mode: %08x\n", info.st_mode); printf(" links: %d\n", info.st_nlink); printf(" uid: %d\n", (int) info.st_uid); printf(" gid: %d\n", (int) info.st_gid); printf(" size: %lld\n", (long long) info.st_size); } } close(file_descriptor); unlink(fn); } }
Output: Note that the output may vary from system to system.
fstat64() returned: inode: 3057 dev id: 1 mode: 03000080 links: 1 uid: 137 gid: 500 size: 8589934662
Top | UNIX-Type APIs | APIs by category |