int fstat(int fd, struct stat *buf);
This system call implements the POSIX _exit function, which returns various information about a file given an open file descriptor referring to the file.The most common use of fstat is to find the size of a file; the MOSS version of fstat works fine for this purpose. In addition, MOSS fills in most of the other fields with values that are ``sensible'' if not always completely accurate. For example, it provides the file size in blocks assuming a typical MS-DOS block size of 512 bytes. However, fields that have no real meaning on DOS, such as the device and inode numbers, are simply filled with zero.
- fd
- File descriptor of the file to examine.
- buf
- Buffer to fill with the file statistics.
Returns 0 if successful, or -1 on error, in which case errno indicates the error.