[prev] 36 [next]

File System Operations (cont)

int stat(char *FileName, struct stat *StatBuf)
  • stores meta-data associated with FileName into StatBuf
  • information includes
    • inode number, file type + access mode, owner, group
    • size in bytes, storage block size, allocated blocks
    • time of last access/modification/status-change
  • returns -1 and sets errno if meta-data not accessible
int fstat(int FileDesc, struct stat *StatBuf)
  • same as stat() but gets data via an open file descriptor
int lstat(char *FileName, struct stat *StatBuf)
  • same as stat() but doesn't follow symbolic links