## fstat

#### OS/161 Reference Manual

### Name

fstat - get file state information

### Library

Standard C Library (libc, -lc)

### Synopsis

#include <unistd.h>
int
fstat(int fd, struct stat *statbuf);

### Description

fstat retrieves status information about the file referred to by the file handle fd and stores it in the stat structure pointed to by statbuf.

### Return Values

On success, fstat returns 0. On error, -1 is returned, and errno is set according to the error encountered.

### Errors

The following error codes should be returned under the conditions given. Other error codes may be returned for other errors not mentioned here.

> EBADF | fd is not a valid file handle.
> EIO | A hard I/O error occurred.
> EFAULT | statbuf points to an invalid address.