分析 mode_t st_mode
st_mode 是一个16位的位图,用于表示文件类型,文件访问权限,及特殊权限位。
mhr@ubuntu:~/work/linux/wenjianxitong/20$ ls -l total 24 -rwxrwxr-x 1 mhr mhr 8936 May 4 09:04 a.out -rw-rw-r-- 1 mhr mhr 436 May 4 09:04 big.c -rw------- 1 mhr mhr 5368709120 May 4 09:04 bigfile -rw------- 1 mhr mhr 5368709120 May 4 09:07 bigfile.bak mhr@ubuntu:~/work/linux/wenjianxitong/20$
即最前面一串 -rwxrwxr-x 等等,这些信息全部存放在 st_mode 中,以位图的形式存放。mode_t 是一个16位的整型数。mode_t 由2部分组成: 文件类型 + 文件权限
文件类型 user权限 group 同组用户的权限 other 用户的权限 - rwx rwx r-x
文件类型分为如下几类:
dcb-lsp 7种类型
1 普通文件 - 2 目录文件 d 3 块特殊文件 b 4 字符特殊文件 c 5 FIFO p 6 套接字(socket) s 7 符号链接(symbolic link) l
用如下宏测试文件类型,成立返回真,不成立返回假
位图
.
struct stat { dev_t st_dev; /* ID of device containing file */文件所在设备的ID ino_t st_ino; /* inode number */节点号 mode_t st_mode; /* protection */文件的类型和存取的权限 nlink_t st_nlink; /* number of hard links */链向此文件的连接数(硬连接) uid_t st_uid; /* user ID of owner */ gid_t st_gid; /* group ID of owner */ dev_t st_rdev; /* device ID (if special file) */设备ID号,针对设备文件 off_t st_size; /* total size, in bytes */文件大小,字节为单位 blksize_t st_blksize; /* blocksize for filesystem I/O */系统块的大小 blkcnt_t st_blocks; /* number of 512B blocks allocated */文件所占块数 /* Since Linux 2.6, the kernel supports nanosecond precision for the following timestamp fields. For the details before Linux 2.6, see NOTES. */ struct timespec st_atim; /* time of last access */最近存取时间 struct timespec st_mtim; /* time of last modification */最近修改时间 struct timespec st_ctim; /* time of last status change */ #define st_atime st_atim.tv_sec /* Backward compatibility */ #define st_mtime st_mtim.tv_sec #define st_ctime st_ctim.tv_sec };
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算