fstat

Accesses information about the file specified by the file descriptor.

Format

#include  <stat.h>

int fstat  (int file_desc, struct stat *buffer);
Function Variants Compiling with the _DECC_V4_SOURCE and _VMS_V6_SOURCE feature- test macros defined enables a local-time-based entry point to this function that is equivalent to the behavior before OpenVMS Version 7.0.

Arguments

file_desc
A file descriptor.
buffer
A pointer to a structure of type stat_t, which is defined in the <stat.h> header file. The argument receives information about that particular file. The members of the structure pointed to by buffer are as follows:
Member  Type  Definition 
st_dev  dev_ t  Pointer to a physical device name 
st_ino[3]  ino_t  Three words to receive the file ID 
st_ mode  mode_t  File "mode" (prot, dir, . . . ) 
st_nlink  nlink_ t  For UNIX system compatibility only 
st_uid  uid_t  Owner user ID 
st_gid  gid_t  Group member: from st_uid 
st_ rdev  dev_t  UNIX system compatibility - always 0 
st_size  off_ t  File size, in bytes 
st_atime  time_t  File access time; always the same as st_mtime 
st_ mtime  time_t  Last modification time 
st_ctime  time_ t  File creation time 
st_ fab_rfm  char  Record format 
st_fab_rat  char  Record attributes 
st_fab_fsz  char  Fixed header size 
st_fab_mrs  unsigned  Record size 

The types dev_t, ino_t, off_t, mode_t, nlink_t, uid_t, gid_t, and time_t, are defined in the <stat.h> header file. However, when compiling for compatibility (/DEFINE=_DECC_V4_SOURCE), only dev_ t, ino_t, and off_t are defined.

As of OpenVMS Version 7.0, times are given in seconds since the Epoch (00:00:00 GMT, January 1, 1970).

The st_mode structure member is the status information mode and is defined in the <stat.h> header file. The st_mode bits follow:
Bits  Constant  Definition 
0170000  S_IFMT  Type of file 
0040000  S_IFDIR  Directory 
0020000  S_IFCHR  Character special 
0060000  S_IFBLK  Block special 
0100000  S_IFREG  Regular 
0030000  S_IFMPC  Multiplexed char special 
0070000  S_ IFMPB  Multiplexed block special 
0004000  S_ISUID  Set user ID on execution 
0002000  S_ ISGID  Set group ID on execution 
0001000  S_ISVTX  Save swapped text even after use 
0000400  S_ IREAD  Read permission, owner 
0000200  S_IWRITE  Write permission, owner 
0000100  S_ IEXEC  Execute/search permission, owner 

Description

This function does not work on remote network files.

Return Values
Indicates successful completion. 
-1  Indicates an error other than a protection violation. 
-2  Indicates a protection violation. 


Previous Page | Next Page | Table of Contents | Index