1: /* 2: * Copyright (c) 1982, 1986 Regents of the University of California. 3: * All rights reserved. The Berkeley software License Agreement 4: * specifies the terms and conditions for redistribution. 5: * 6: * @(#)stat.h 7.1.5 (2.11BSD) 1996/09/20 7: */ 8: 9: #ifndef _STAT_H_ 10: #define _STAT_H_ 11: 12: struct stat 13: { 14: dev_t st_dev; 15: ino_t st_ino; 16: unsigned short st_mode; 17: short st_nlink; 18: uid_t st_uid; 19: gid_t st_gid; 20: dev_t st_rdev; 21: off_t st_size; 22: time_t st_atime; 23: int st_spare1; 24: time_t st_mtime; 25: int st_spare2; 26: time_t st_ctime; 27: int st_spare3; 28: long st_blksize; 29: long st_blocks; 30: u_short st_flags; 31: u_short st_spare4[3]; 32: }; 33: 34: #define S_IFMT 0170000 /* type of file */ 35: #define S_IFDIR 0040000 /* directory */ 36: #define S_IFCHR 0020000 /* character special */ 37: #define S_IFBLK 0060000 /* block special */ 38: #define S_IFREG 0100000 /* regular */ 39: #define S_IFLNK 0120000 /* symbolic link */ 40: #define S_IFSOCK 0140000/* socket */ 41: #define S_ISUID 0004000 /* set user id on execution */ 42: #define S_ISGID 0002000 /* set group id on execution */ 43: #define S_ISVTX 0001000 /* save swapped text even after use */ 44: #define S_IREAD 0000400 /* read permission, owner */ 45: #define S_IWRITE 0000200 /* write permission, owner */ 46: #define S_IEXEC 0000100 /* execute/search permission, owner */ 47: 48: /* 49: * Definitions of flags in mode that are 4.4 compatible. 50: */ 51: 52: #define S_IFIFO 0010000 /* named pipe (fifo) - Not used by 2.11BSD */ 53: 54: #define S_IRWXU 0000700 /* RWX mask for owner */ 55: #define S_IRUSR 0000400 /* R for owner */ 56: #define S_IWUSR 0000200 /* W for owner */ 57: #define S_IXUSR 0000100 /* X for owner */ 58: 59: #define S_IRWXG 0000070 /* RWX mask for group */ 60: #define S_IRGRP 0000040 /* R for group */ 61: #define S_IWGRP 0000020 /* W for group */ 62: #define S_IXGRP 0000010 /* X for group */ 63: 64: #define S_IRWXO 0000007 /* RWX mask for other */ 65: #define S_IROTH 0000004 /* R for other */ 66: #define S_IWOTH 0000002 /* W for other */ 67: #define S_IXOTH 0000001 /* X for other */ 68: 69: #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ 70: #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ 71: #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ 72: #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ 73: 74: /* 75: * Definitions of flags stored in file flags word. Different from 4.4 because 76: * 2.11BSD only could afford a u_short for the flags. It is not a great 77: * inconvenience since there are still 5 bits in each byte available for 78: * future use. 79: * 80: * Super-user and owner changeable flags. 81: */ 82: #define UF_SETTABLE 0x00ff /* mask of owner changeable flags */ 83: #define UF_NODUMP 0x0001 /* do not dump file */ 84: #define UF_IMMUTABLE 0x0002 /* file may not be changed */ 85: #define UF_APPEND 0x0004 /* writes to file may only append */ 86: /* 87: * Super-user changeable flags. 88: */ 89: #define SF_SETTABLE 0xff00 /* mask of superuser changeable flags */ 90: #define SF_ARCHIVED 0x0100 /* file is archived */ 91: #define SF_IMMUTABLE 0x0200 /* file may not be changed */ 92: #define SF_APPEND 0x0400 /* writes to file may only append */ 93: 94: #ifdef KERNEL 95: /* 96: * Shorthand abbreviations of above. 97: */ 98: #define APPEND (UF_APPEND | SF_APPEND) 99: #define IMMUTABLE (UF_IMMUTABLE | SF_IMMUTABLE) 100: #endif 101: 102: #endif /* !_STAT_H_ */