HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
f
fstat(2) fstat(2)
NAME
fstat - get file status
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
int fstat(int fildes, struct stat *buf);
DESCRIPTION
The fstat() function obtains information about an open file associated with the file descriptor fildes, and
writes it to the area pointed to by buf. The buf argument is a pointer to a stat structure, as defined in
<sys/stat.h> , into which information is placed concerning the file.
The structure members st_mode, st_ino, st_dev, st_uid, st_gid, st_atime, st_ctime, and st_mtime will have
meaningful values for all file types defined in this document. The value of the member st_nlink will be set
to the number of links to the file.
An implementation that provides additional or alternative file access control mechanisms may, under
implementation-dependent conditions, cause
fstat() to fail.
The
fstat() function updates any time-related fields as described in File Times Update (see the XBD
specification, Chapter 4, Character Set), before writing into the stat structure.
RETURN VALUE
Upon successful completion, 0 is returned. Otherwise, 1 is returned and errno is set to indicate the
error.
ERRORS
The fstat() function will fail if:
[EBADF] The fildes argument is not a valid file descriptor.
[EIO] An I/O error occurred while reading from the file system.
The fstat() function may fail if:
[EOVERFLOW] One of the values is too large to store into the structure pointed to by the
buf argument.
SEE ALSO
lstat(2), stat(2), <sys/stat.h>, <sys/types.h>.
CHANGE HISTORY
First released in Issue 1.
Derived from Issue 1 of the SVID.
Issue 4
The following changes are incorporated in the DESCRIPTION section for alignment with the ISO POSIX-1
standard:
A paragraph defining the contents of stat structure members is added.
The words "extended security controls" are replaced by "additional or alternative file access control
mechanisms."
Another change is incorporated as follows:
The header <sys/types.h> is now marked as optional (OH); this header need not be included
on XSI-conformant systems.
Issue 4, Version 2
The ERRORS section is updated for X/OPEN UNIX conformance as follows:
The EIO error is added as a mandatory error indicated the occurrence of an I/O error.
The EOVERFLOW error is added as an optional error indicating that one of the values is too large
to store in the area pointed to by buf.
Section 270 1 HP-UX Release 11i: December 2000
___
___