Nios® V Processor Software Developer Handbook

ID 743810
Date 2/14/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

12.1.1.58. fstat()

Prototype

int fstat (int fd, struct stat *st)

Commonly Called By

C/C++ programs

Device drivers

Thread-safe

See description.

Available from ISR

No.

Include

<sys/stat.h>

Description

The fstat() function obtains information about the capabilities of an open file descriptor. The underlying device driver fills in the input st structure with a description of its functionality. Refer to the header file sys/stat.h provided with the compiler for the available options.

By default, file descriptors are marked as character devices, unless the underlying driver provides its own implementation of the fstat() function.

Calls to fstat() are thread-safe only if the implementation of fstat() provided by the driver that is manipulated is thread-safe.

Valid values for the fd parameter are: stdout, stdin, and stderr, or any value returned from a call to open().

Return

The return value is zero on success, or –1 otherwise. If the call fails, errno is set to indicate the cause of the error.