|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * The contents of this file constitute Original Code as defined in and ! 7: * are subject to the Apple Public Source License Version 1.1 (the ! 8: * "License"). You may not use this file except in compliance with the ! 9: * License. Please obtain a copy of the License at ! 10: * http://www.apple.com/publicsource and read it before using this file. ! 11: * ! 12: * This Original Code and all software distributed under the License are ! 13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 17: * License for the specific language governing rights and limitations ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ ! 23: /*- ! 24: * Copyright (c) 1982, 1986, 1989, 1993 ! 25: * The Regents of the University of California. All rights reserved. ! 26: * (c) UNIX System Laboratories, Inc. ! 27: * All or some portions of this file are derived from material licensed ! 28: * to the University of California by American Telephone and Telegraph ! 29: * Co. or Unix System Laboratories, Inc. and are reproduced herein with ! 30: * the permission of UNIX System Laboratories, Inc. ! 31: * ! 32: * Redistribution and use in source and binary forms, with or without ! 33: * modification, are permitted provided that the following conditions ! 34: * are met: ! 35: * 1. Redistributions of source code must retain the above copyright ! 36: * notice, this list of conditions and the following disclaimer. ! 37: * 2. Redistributions in binary form must reproduce the above copyright ! 38: * notice, this list of conditions and the following disclaimer in the ! 39: * documentation and/or other materials provided with the distribution. ! 40: * 3. All advertising materials mentioning features or use of this software ! 41: * must display the following acknowledgement: ! 42: * This product includes software developed by the University of ! 43: * California, Berkeley and its contributors. ! 44: * 4. Neither the name of the University nor the names of its contributors ! 45: * may be used to endorse or promote products derived from this software ! 46: * without specific prior written permission. ! 47: * ! 48: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ! 49: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ! 50: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ! 51: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ! 52: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ! 53: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ! 54: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ! 55: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ! 56: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ! 57: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! 58: * SUCH DAMAGE. ! 59: * ! 60: * @(#)stat.h 8.9 (Berkeley) 8/17/94 ! 61: */ ! 62: ! 63: ! 64: #ifndef _SYS_STAT_H_ ! 65: #define _SYS_STAT_H_ ! 66: ! 67: #include <sys/time.h> ! 68: ! 69: #ifndef _POSIX_SOURCE ! 70: struct ostat { ! 71: u_int16_t st_dev; /* inode's device */ ! 72: ino_t st_ino; /* inode's number */ ! 73: mode_t st_mode; /* inode protection mode */ ! 74: nlink_t st_nlink; /* number of hard links */ ! 75: u_int16_t st_uid; /* user ID of the file's owner */ ! 76: u_int16_t st_gid; /* group ID of the file's group */ ! 77: u_int16_t st_rdev; /* device type */ ! 78: int32_t st_size; /* file size, in bytes */ ! 79: struct timespec st_atimespec; /* time of last access */ ! 80: struct timespec st_mtimespec; /* time of last data modification */ ! 81: struct timespec st_ctimespec; /* time of last file status change */ ! 82: int32_t st_blksize; /* optimal blocksize for I/O */ ! 83: int32_t st_blocks; /* blocks allocated for file */ ! 84: u_int32_t st_flags; /* user defined flags for file */ ! 85: u_int32_t st_gen; /* file generation number */ ! 86: }; ! 87: #endif /* !_POSIX_SOURCE */ ! 88: ! 89: struct stat { ! 90: dev_t st_dev; /* inode's device */ ! 91: ino_t st_ino; /* inode's number */ ! 92: mode_t st_mode; /* inode protection mode */ ! 93: nlink_t st_nlink; /* number of hard links */ ! 94: uid_t st_uid; /* user ID of the file's owner */ ! 95: gid_t st_gid; /* group ID of the file's group */ ! 96: dev_t st_rdev; /* device type */ ! 97: #ifndef _POSIX_SOURCE ! 98: struct timespec st_atimespec; /* time of last access */ ! 99: struct timespec st_mtimespec; /* time of last data modification */ ! 100: struct timespec st_ctimespec; /* time of last file status change */ ! 101: #else ! 102: time_t st_atime; /* time of last access */ ! 103: long st_atimensec; /* nsec of last access */ ! 104: time_t st_mtime; /* time of last data modification */ ! 105: long st_mtimensec; /* nsec of last data modification */ ! 106: time_t st_ctime; /* time of last file status change */ ! 107: long st_ctimensec; /* nsec of last file status change */ ! 108: #endif ! 109: off_t st_size; /* file size, in bytes */ ! 110: int64_t st_blocks; /* blocks allocated for file */ ! 111: u_int32_t st_blksize; /* optimal blocksize for I/O */ ! 112: u_int32_t st_flags; /* user defined flags for file */ ! 113: u_int32_t st_gen; /* file generation number */ ! 114: int32_t st_lspare; ! 115: int64_t st_qspare[2]; ! 116: }; ! 117: ! 118: ! 119: #ifndef _POSIX_SOURCE ! 120: #define st_atime st_atimespec.tv_sec ! 121: #define st_mtime st_mtimespec.tv_sec ! 122: #define st_ctime st_ctimespec.tv_sec ! 123: #endif ! 124: ! 125: #define S_ISUID 0004000 /* set user id on execution */ ! 126: #define S_ISGID 0002000 /* set group id on execution */ ! 127: #ifndef _POSIX_SOURCE ! 128: #define S_ISTXT 0001000 /* sticky bit */ ! 129: #endif ! 130: ! 131: #define S_IRWXU 0000700 /* RWX mask for owner */ ! 132: #define S_IRUSR 0000400 /* R for owner */ ! 133: #define S_IWUSR 0000200 /* W for owner */ ! 134: #define S_IXUSR 0000100 /* X for owner */ ! 135: ! 136: #ifndef _POSIX_SOURCE ! 137: #define S_IREAD S_IRUSR ! 138: #define S_IWRITE S_IWUSR ! 139: #define S_IEXEC S_IXUSR ! 140: #endif ! 141: ! 142: #define S_IRWXG 0000070 /* RWX mask for group */ ! 143: #define S_IRGRP 0000040 /* R for group */ ! 144: #define S_IWGRP 0000020 /* W for group */ ! 145: #define S_IXGRP 0000010 /* X for group */ ! 146: ! 147: #define S_IRWXO 0000007 /* RWX mask for other */ ! 148: #define S_IROTH 0000004 /* R for other */ ! 149: #define S_IWOTH 0000002 /* W for other */ ! 150: #define S_IXOTH 0000001 /* X for other */ ! 151: ! 152: #ifndef _POSIX_SOURCE ! 153: #define S_IFMT 0170000 /* type of file mask */ ! 154: #define S_IFIFO 0010000 /* named pipe (fifo) */ ! 155: #define S_IFCHR 0020000 /* character special */ ! 156: #define S_IFDIR 0040000 /* directory */ ! 157: #define S_IFBLK 0060000 /* block special */ ! 158: #define S_IFREG 0100000 /* regular */ ! 159: #define S_IFLNK 0120000 /* symbolic link */ ! 160: #define S_IFSOCK 0140000 /* socket */ ! 161: #define S_IFWHT 0160000 /* whiteout */ ! 162: #define S_ISVTX 0001000 /* save swapped text even after use */ ! 163: #endif ! 164: ! 165: #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ ! 166: #define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */ ! 167: #define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */ ! 168: #define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */ ! 169: #define S_ISFIFO(m) ((m & 0170000) == 0010000 || \ ! 170: (m & 0170000) == 0140000) /* fifo or socket */ ! 171: #ifndef _POSIX_SOURCE ! 172: #define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */ ! 173: #define S_ISSOCK(m) ((m & 0170000) == 0010000 || \ ! 174: (m & 0170000) == 0140000) /* fifo or socket */ ! 175: #define S_ISWHT(m) ((m & 0170000) == 0160000) /* whiteout */ ! 176: #endif ! 177: ! 178: #ifndef _POSIX_SOURCE ! 179: #define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ ! 180: /* 7777 */ ! 181: #define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO) ! 182: /* 0666 */ ! 183: #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) ! 184: ! 185: #define S_BLKSIZE 512 /* block size used in the stat struct */ ! 186: ! 187: /* ! 188: * Definitions of flags stored in file flags word. ! 189: * ! 190: * Super-user and owner changeable flags. ! 191: */ ! 192: #define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */ ! 193: #define UF_NODUMP 0x00000001 /* do not dump file */ ! 194: #define UF_IMMUTABLE 0x00000002 /* file may not be changed */ ! 195: #define UF_APPEND 0x00000004 /* writes to file may only append */ ! 196: #define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */ ! 197: /* ! 198: * Super-user changeable flags. ! 199: */ ! 200: #define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */ ! 201: #define SF_ARCHIVED 0x00010000 /* file is archived */ ! 202: #define SF_IMMUTABLE 0x00020000 /* file may not be changed */ ! 203: #define SF_APPEND 0x00040000 /* writes to file may only append */ ! 204: ! 205: #ifdef KERNEL ! 206: /* ! 207: * Shorthand abbreviations of above. ! 208: */ ! 209: #define OPAQUE (UF_OPAQUE) ! 210: #define APPEND (UF_APPEND | SF_APPEND) ! 211: #define IMMUTABLE (UF_IMMUTABLE | SF_IMMUTABLE) ! 212: #endif ! 213: #endif ! 214: ! 215: #ifndef KERNEL ! 216: #include <sys/cdefs.h> ! 217: ! 218: __BEGIN_DECLS ! 219: int chmod __P((const char *, mode_t)); ! 220: int fstat __P((int, struct stat *)); ! 221: int mkdir __P((const char *, mode_t)); ! 222: int mkfifo __P((const char *, mode_t)); ! 223: int stat __P((const char *, struct stat *)); ! 224: mode_t umask __P((mode_t)); ! 225: #ifndef _POSIX_SOURCE ! 226: int chflags __P((const char *, u_long)); ! 227: int fchflags __P((int, u_long)); ! 228: int fchmod __P((int, mode_t)); ! 229: int lstat __P((const char *, struct stat *)); ! 230: #endif ! 231: __END_DECLS ! 232: #endif ! 233: #endif /* !_SYS_STAT_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.