fstat.2 (2010 09)

f
fstat(2) fstat(2)
st_ctime Time when file status was last changed. Changed by the following system calls:
acl(), chmod(), chown(), creat()
, fchmod(), fchown(), truncate(),
ftruncate(), (see truncate (2)), link(), mknod()
, pipe(), prealloc(),
rename(), setacl(), unlink(), utime(),
write(), and writev() (see
write (2)). The
touch command (see touch(1)) can be used to explicitly control the
times of a file.
st_mode The value returned in this field is the bit-wise inclusive OR of a value indicating the
file’s type, attribute bits, and a value summarizing its access permission. See
mknod(2). For ordinary users, the least significant nine bits consist of the file’s per-
mission bits modified to reflect the access granted or denied to the caller by optional
entries in the file’s access control list. For users with appropriate privileges the
least significant nine bits are the file’s access permission bits. In addition, the
S_IXUSR (execute by owner) mode bit is set if the following conditions are met:
The file is a regular file,
No permission execute bits are set, and
An execute bit is set in one or more of the file’s optional access control list
entries.
The write bit is not cleared for a file on a read-only file system or a shared-text pro-
gram file that is being executed. However,
getaccess() clears this bit under
these conditions (see getaccess (2).
The value of the member st_nlink will be set to the number of links to the file. If the chosen path name or
file descriptor refers to a Multi-Level Directory (MLD), and the process does not have the multilevel
effective privilege, the i-node number returned in st_ino is the i-node of the MLD itself.
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.
Note: The st_natime , st_nmtime , and st_nctime fields are currently reserved. To avoid compatibility
problems, these fields should not be used.
RETURN VALUE
Upon successful completion,
0 is returned. Otherwise, 1 is returned and errno is set to indicate the
error.
When using
fstat() to get the status of a socket descriptor, the following return values are also possi-
ble:
[EINPROGRESS] Nonblocking I/O is enabled using
O_NONBLOCK, O_NODELAY,or
FIOSNBIO, and the connection cannot be completed immediately. This is
not a failure. Make the connect() call again a few seconds later. Alterna-
tively, wait for completion by calling select() and selecting for write.
[EWOULDBLOCK] Non-blocking I/O is enabled using the
ioctl() FIOSNBIO request, and the
requested operation would block.
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.
[EFAULT] buf or path points to an invalid address. The reliable detection of this error is
implementation-dependent.
[EOVERFLOW] A 32-bit application is making this call on a file where the
st_size or other
field(s) would need to hold a 64-bit value.
NETWORKING FEATURES
NFS
The st_basemode , st_acl and st_aclv fields are zero on files accessed remotely. The st_acl field is applica-
ble to HFS File Systems only. The st_aclv field is applicable to JFS File Systems only.
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010