Annotation of prex/include/sys/stat.h, Revision 1.1.1.1
1.1 nbrk 1: /*-
2: * Copyright (c) 1982, 1986, 1989, 1993
3: * The Regents of the University of California. All rights reserved.
4: * (c) UNIX System Laboratories, Inc.
5: * All or some portions of this file are derived from material licensed
6: * to the University of California by American Telephone and Telegraph
7: * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8: * the permission of UNIX System Laboratories, Inc.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: * 3. Neither the name of the University nor the names of its contributors
19: * may be used to endorse or promote products derived from this software
20: * without specific prior written permission.
21: *
22: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: * SUCH DAMAGE.
33: *
34: * @(#)stat.h 8.12 (Berkeley) 6/16/95
35: */
36:
37: #ifndef _SYS_STAT_H_
38: #define _SYS_STAT_H_
39:
40: #include <sys/time.h>
41:
42: struct stat {
43: dev_t st_dev; /* inode's device */
44: ino_t st_ino; /* inode's number */
45: mode_t st_mode; /* inode protection mode */
46: nlink_t st_nlink; /* number of hard links */
47: uid_t st_uid; /* user ID of the file's owner */
48: gid_t st_gid; /* group ID of the file's group */
49: dev_t st_rdev; /* device type */
50: off_t st_size; /* file size, in bytes */
51: time_t st_atime; /* time of last access */
52: time_t st_mtime; /* time of last data modification */
53: time_t st_ctime; /* time of last file status change */
54: int32_t st_blocks; /* blocks allocated for file */
55: uint32_t st_blksize; /* optimal blocksize for I/O */
56: };
57:
58: #define S_ISUID 0004000 /* set user id on execution */
59: #define S_ISGID 0002000 /* set group id on execution */
60: #define S_ISTXT 0001000 /* sticky bit */
61:
62: #define S_IRWXU 0000700 /* RWX mask for owner */
63: #define S_IRUSR 0000400 /* R for owner */
64: #define S_IWUSR 0000200 /* W for owner */
65: #define S_IXUSR 0000100 /* X for owner */
66:
67: #define S_IREAD S_IRUSR
68: #define S_IWRITE S_IWUSR
69: #define S_IEXEC S_IXUSR
70:
71: #define S_IRWXG 0000070 /* RWX mask for group */
72: #define S_IRGRP 0000040 /* R for group */
73: #define S_IWGRP 0000020 /* W for group */
74: #define S_IXGRP 0000010 /* X for group */
75:
76: #define S_IRWXO 0000007 /* RWX mask for other */
77: #define S_IROTH 0000004 /* R for other */
78: #define S_IWOTH 0000002 /* W for other */
79: #define S_IXOTH 0000001 /* X for other */
80:
81: #define S_IFMT 0170000 /* type of file mask */
82: #define S_IFIFO 0010000 /* named pipe (fifo) */
83: #define S_IFCHR 0020000 /* character special */
84: #define S_IFDIR 0040000 /* directory */
85: #define S_IFBLK 0060000 /* block special */
86: #define S_IFREG 0100000 /* regular */
87: #define S_IFLNK 0120000 /* symbolic link */
88: #define S_IFSOCK 0140000 /* socket */
89: #define S_IFWHT 0160000 /* whiteout */
90: #define S_ISVTX 0001000 /* save swapped text even after use */
91:
92: #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */
93: #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */
94: #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */
95: #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */
96: #define S_ISFIFO(m) ((m & 0170000) == 0010000 || \
97: (m & 0170000) == 0140000) /* fifo or socket */
98: #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */
99: #define S_ISSOCK(m) ((m & 0170000) == 0010000 || \
100: (m & 0170000) == 0140000) /* fifo or socket */
101: #define S_ISWHT(m) ((m & 0170000) == 0160000) /* whiteout */
102:
103: #define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
104: /* 7777 */
105: #define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
106: /* 0666 */
107: #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
108:
109: #define S_BLKSIZE 512 /* block size used in the stat struct */
110:
111: #include <sys/cdefs.h>
112:
113: __BEGIN_DECLS
114: int chmod(const char *, mode_t);
115: int fstat(int, struct stat *);
116: int mkdir(const char *, mode_t);
117: int mkfifo(const char *, mode_t);
118: int stat(const char *, struct stat *);
119: mode_t umask(mode_t);
120: int lstat(const char *, struct stat *);
121: __END_DECLS
122:
123: #endif /* !_SYS_STAT_H_ */
CVSweb