Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Latest commit

 

History

History
53 lines (44 loc) · 1.44 KB

type.md

File metadata and controls

53 lines (44 loc) · 1.44 KB

第04章 文件和目录

章节目录 笔记 函数表


结构体stat

struct stat{
    mode_t            st_mode;   /* file type & mode (permission) */
    ino_t             st_ino;    /* i-note number (servial number) */
    dev_t             st_dev;    /* device number (file system) */
    dev_t             st_rdev;   /* device number for special files */
    nlink_t           st_nlink;  /* number of links */
    uid_t             st_uid;    /* user ID of owner */
    gid_t             st_gid;    /* group ID of owner */
    off_t             st_size;   /* size in bytes, for regular files */
    struct timespec   st_atime;  /* time of last access */
    struct timespec   st_mtime;  /* time of last modification */
    struct timespec   st_ctime;  /* time of last file status change */
    blkszie_t         st_blksize;/* best I/O block size */
    blkcnt_t          st_blocks; /* bumber of disk blocks allocated */
};

stat结构体成员及其对应的函数

stat结构体成员及其对应的函数

结构体timespec

至少包含以下两个字段:

struct timespec {
    time_t tv_sec;
    long   tv_nsec;
};