stat,fstat - get satellite file status


#include <stdio_p.h>
#include <stat_p.h>

stat (path, stbuf)
char *path;
struct stat *stbuf;

fstat(fildes, stbuf)
FD fildes;
struct stat *stbuf;


path points to a path name of a file. Read, write, or execute permission of the named file is not required. stat obtains information about the named file.

Similarly, fstat obtains information about an open file known by the file descriptor fildes, obtained from a successful open, or create system call.

stbuf is a pointer to a stat structure into which stat and fstat place information about the file. The contents of the structure pointed to by stbuf includes the following:

ushort st_mode;   /* file mode */
ino_t  st_info;   /* inode number */
dev_t  st_dev;    /* satellite directory number */
short  st_nlink;  /* maximum size in blocks */
off_t  st_size;   /* file size in bytes */
stat will return no status information if one of more of the following are true:

fstat will fail if fildes is not a valid open satellite file descriptor. [EBADF]


If an error occurs during a call to stat or fstat, a value of -1 is returned and errno is set to indicate the error.


chmod(2F) , chsize(2F) , create(3F) , open(2F) , unlink(2F)