您的位置:首页 > 运维架构 > Linux

Linux 文件系统(部分)

2017-02-05 22:22 204 查看

Linux 文件系统

struct stat:



文件属性 解释

dev_t st_dev 设备号

ino_t st_ino inode 编号

mode_t st_mode 访问权限相关

nlink_t st_nlink 硬链接数量

uid_t st_uid 拥有该文件的用户

gid_t st_gid 拥有该文件的组

dev_t st_rdev 设备号

off_t st_size 文件尺寸

blksize_t st_blksize 文件系统的IO尺寸

blkcnt_t st_blocks 占用的block数量,一个block为512字节

time_t st_atime 最后访问时间

time_t st_mtime 最后修改时间

time_t st_ctime 最后文件状态修改时间

struct dirent

Markdown Extra 定义列表语法:

struct dirent {
long            d_ino;                  /* inode number 索引节点号 */
off_t           d_off;                  /* offset to this dirent 在目录文件中的偏移 */
unsigned short  d_reclen;               /* length of this d_name 文件名长 */
unsigned char   d_type;                 /* the type of d_name 文件类型 */
char            d_name [NAME_MAX+1];    /* file name (null-terminated) 文件名,最长255字符 */
}

//d_type
DT_UNKNOWN = 0,  // unknown type
#define DT_UNKNOWN DT_UNKNOWN
DT_FIFO = 1,     // a named pipe, or FIFO
#define DT_FIFO DT_FIFO
DT_CHR = 2,     // a character device
#define DT_CHR DT_CHR
DT_DIR = 4,     // a directory
#define DT_DIR DT_DIR
DT_BLK = 6,     // a block device
#define DT_BLK DT_BLK
DT_REG = 8,     // regular file
#define DT_REG DT_REG
DT_LNK = 10,    // symbolic link
#define DT_LNK DT_LNK
DT_SOCK = 12,   // local domain socket
#define DT_SOCK DT_SOCK
DT_WHT = 14     // ?
#define DT_WHT DT_WHT
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux
相关文章推荐