⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stat.h

📁 一个简单的操作系统minix的核心代码
💻 H
字号:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				include/sys/stat.h	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

02300	/* The <sys/stat.h> header defines a struct that is used in the stat() and
02301	 * fstat functions.  The information in this struct comes from the i-node of
02302	 * some file.  These calls are the only approved way to inspect i-nodes.
02303	 */
02304	
02305	#ifndef _STAT_H
02306	#define _STAT_H
02307	
02308	struct stat {
02309	  dev_t st_dev;                 /* major/minor device number */
02310	  ino_t st_ino;                 /* i-node number */
02311	  mode_t st_mode;               /* file mode, protection bits, etc. */
02312	  short int st_nlink;           /* # links; TEMPORARY HACK: should be nlink_t*/
02313	  uid_t st_uid;                 /* uid of the file's owner */
02314	  short int st_gid;             /* gid; TEMPORARY HACK: should be gid_t */
02315	  dev_t st_rdev;
02316	  off_t st_size;                /* file size */
02317	  time_t st_atime;              /* time of last access */
02318	  time_t st_mtime;              /* time of last data modification */
02319	  time_t st_ctime;              /* time of last file status change */
02320	};
02321	
02322	/* Traditional mask definitions for st_mode. */
02323	/* The ugly casts on only some of the definitions are to avoid suprising sign
02324	 * extensions such as S_IFREG != (mode_t) S_IFREG when ints are 32 bits.
02325	 */
02326	#define S_IFMT  ((mode_t) 0170000)      /* type of file */
02327	#define S_IFREG ((mode_t) 0100000)      /* regular */
02328	#define S_IFBLK 0060000         /* block special */
02329	#define S_IFDIR 0040000         /* directory */
02330	#define S_IFCHR 0020000         /* character special */
02331	#define S_IFIFO 0010000         /* this is a FIFO */
02332	#define S_ISUID 0004000         /* set user id on execution */
02333	#define S_ISGID 0002000         /* set group id on execution */
02334	                                /* next is reserved for future use */
02335	#define S_ISVTX   01000         /* save swapped text even after use */
02336	
02337	/* POSIX masks for st_mode. */
02338	#define S_IRWXU   00700         /* owner:  rwx------ */
02339	#define S_IRUSR   00400         /* owner:  r-------- */
02340	#define S_IWUSR   00200         /* owner:  -w------- */
02341	#define S_IXUSR   00100         /* owner:  --x------ */
02342	
02343	#define S_IRWXG   00070         /* group:  ---rwx--- */
02344	#define S_IRGRP   00040         /* group:  ---r----- */
02345	#define S_IWGRP   00020         /* group:  ----w---- */
02346	#define S_IXGRP   00010         /* group:  -----x--- */
02347	
02348	#define S_IRWXO   00007         /* others: ------rwx */
02349	#define S_IROTH   00004         /* others: ------r-- */ 
02350	#define S_IWOTH   00002         /* others: -------w- */
02351	#define S_IXOTH   00001         /* others: --------x */
02352	
02353	/* The following macros test st_mode (from POSIX Sec. 5.6.1.1). */
02354	#define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)     /* is a reg file */
02355	#define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)     /* is a directory */
02356	#define S_ISCHR(m)      (((m) & S_IFMT) == S_IFCHR)     /* is a char spec */
02357	#define S_ISBLK(m)      (((m) & S_IFMT) == S_IFBLK)     /* is a block spec */
02358	#define S_ISFIFO(m)     (((m) & S_IFMT) == S_IFIFO)     /* is a pipe/FIFO */
02359	
02360	
02361	/* Function Prototypes. */
02362	#ifndef _ANSI_H
02363	#include <ansi.h>
02364	#endif
02365	
02366	_PROTOTYPE( int chmod, (const char *_path, Mode_t _mode)                );
02367	_PROTOTYPE( int fstat, (int _fildes, struct stat *_buf)                 );
02368	_PROTOTYPE( int mkdir, (const char *_path, Mode_t _mode)                );
02369	_PROTOTYPE( int mkfifo, (const char *_path, Mode_t _mode)               );
02370	_PROTOTYPE( int stat, (const char *_path, struct stat *_buf)            );
02371	_PROTOTYPE( mode_t umask, (Mode_t _cmask)                               );
02372	
02373	#endif /* _STAT_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -