| 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 | * 4. 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 | * $FreeBSD: src/sys/sys/stat.h,v 1.40 2004/06/17 17:16:52 phk Exp $
|
|---|
| 36 | */
|
|---|
| 37 |
|
|---|
| 38 | /** @file
|
|---|
| 39 | * FreeBSD 5.3
|
|---|
| 40 | * @changed bird: EMX isms and hid the BSD specific structs and related stuff.
|
|---|
| 41 | * @changed bird: No UF_ and SF_ because we ain't got any st_flags.
|
|---|
| 42 | */
|
|---|
| 43 |
|
|---|
| 44 | #ifndef _SYS_STAT_H_
|
|---|
| 45 | #define _SYS_STAT_H_
|
|---|
| 46 |
|
|---|
| 47 | #include <sys/cdefs.h>
|
|---|
| 48 | #include <sys/_types.h>
|
|---|
| 49 |
|
|---|
| 50 | /* XXX missing blkcnt_t, blksize_t. */
|
|---|
| 51 |
|
|---|
| 52 | #ifndef _DEV_T_DECLARED
|
|---|
| 53 | typedef __dev_t dev_t;
|
|---|
| 54 | #define _DEV_T_DECLARED
|
|---|
| 55 | #endif
|
|---|
| 56 |
|
|---|
| 57 | #ifndef _FFLAGS_T_DECLARED
|
|---|
| 58 | typedef __fflags_t fflags_t;
|
|---|
| 59 | #define _FFLAGS_T_DECLARED
|
|---|
| 60 | #endif
|
|---|
| 61 |
|
|---|
| 62 | #if !defined(_GID_T_DECLARED) && !defined(_GID_T) /* bird: emx */
|
|---|
| 63 | typedef __gid_t gid_t;
|
|---|
| 64 | #define _GID_T_DECLARED
|
|---|
| 65 | #define _GID_T /* bird: emx */
|
|---|
| 66 | #endif
|
|---|
| 67 |
|
|---|
| 68 | #if !defined(_INO_T_DECLARED) && !defined(_INO_T) /* bird: emx */
|
|---|
| 69 | typedef __ino_t ino_t;
|
|---|
| 70 | #define _INO_T_DECLARED
|
|---|
| 71 | #define _INO_T /* bird: emx */
|
|---|
| 72 | #endif
|
|---|
| 73 |
|
|---|
| 74 | #if !defined(_MODE_T_DECLARED) && !defined(_MODE_T) /* bird: emx */
|
|---|
| 75 | typedef __mode_t mode_t;
|
|---|
| 76 | #define _MODE_T_DECLARED
|
|---|
| 77 | #define _MODE_T /* bird: emx */
|
|---|
| 78 | #endif
|
|---|
| 79 |
|
|---|
| 80 | #ifndef _NLINK_T_DECLARED
|
|---|
| 81 | typedef __nlink_t nlink_t;
|
|---|
| 82 | #define _NLINK_T_DECLARED
|
|---|
| 83 | #endif
|
|---|
| 84 |
|
|---|
| 85 | #if !defined(_OFF_T_DECLARED) && !defined(_OFF_T) /* bird: emx */
|
|---|
| 86 | typedef __off_t off_t;
|
|---|
| 87 | #define _OFF_T_DECLARED
|
|---|
| 88 | #define _OFF_T /* bird: emx */
|
|---|
| 89 | #endif
|
|---|
| 90 |
|
|---|
| 91 | #if !defined(_TIME_T_DECLARED) && !defined(_TIME_T) /* bird: emx */
|
|---|
| 92 | typedef __time_t time_t;
|
|---|
| 93 | #define _TIME_T_DECLARED
|
|---|
| 94 | #define _TIME_T /* bird: emx */
|
|---|
| 95 | #endif
|
|---|
| 96 |
|
|---|
| 97 | #if !defined(_UID_T_DECLARED) && !defined(_UID_T) /* bird: emx */
|
|---|
| 98 | typedef __uid_t uid_t;
|
|---|
| 99 | #define _UID_T_DECLARED
|
|---|
| 100 | #define _UID_T /* bird: emx */
|
|---|
| 101 | #endif
|
|---|
| 102 |
|
|---|
| 103 | #if !defined(_KERNEL) && __BSD_VISIBLE
|
|---|
| 104 | /*
|
|---|
| 105 | * XXX we need this for struct timespec. We get miscellaneous namespace
|
|---|
| 106 | * pollution with it.
|
|---|
| 107 | */
|
|---|
| 108 | #include <sys/time.h>
|
|---|
| 109 | #endif
|
|---|
| 110 |
|
|---|
| 111 | /*#if !__BSD_VISIBLE bird: we don't need any of this (we don't have it either)
|
|---|
| 112 | #include <sys/_timespec.h>
|
|---|
| 113 | #endif */
|
|---|
| 114 |
|
|---|
| 115 | #if 0 /* bird: emx */
|
|---|
| 116 | #if __BSD_VISIBLE
|
|---|
| 117 | struct ostat {
|
|---|
| 118 | __uint16_t st_dev; /* inode's device */
|
|---|
| 119 | ino_t st_ino; /* inode's number */
|
|---|
| 120 | mode_t st_mode; /* inode protection mode */
|
|---|
| 121 | nlink_t st_nlink; /* number of hard links */
|
|---|
| 122 | __uint16_t st_uid; /* user ID of the file's owner */
|
|---|
| 123 | __uint16_t st_gid; /* group ID of the file's group */
|
|---|
| 124 | __uint16_t st_rdev; /* device type */
|
|---|
| 125 | __int32_t st_size; /* file size, in bytes */
|
|---|
| 126 | struct timespec st_atimespec; /* time of last access */
|
|---|
| 127 | struct timespec st_mtimespec; /* time of last data modification */
|
|---|
| 128 | struct timespec st_ctimespec; /* time of last file status change */
|
|---|
| 129 | __int32_t st_blksize; /* optimal blocksize for I/O */
|
|---|
| 130 | __int32_t st_blocks; /* blocks allocated for file */
|
|---|
| 131 | fflags_t st_flags; /* user defined flags for file */
|
|---|
| 132 | __uint32_t st_gen; /* file generation number */
|
|---|
| 133 | };
|
|---|
| 134 | #endif /* __BSD_VISIBLE */
|
|---|
| 135 | #endif /* bird: emx */
|
|---|
| 136 |
|
|---|
| 137 | struct stat {
|
|---|
| 138 | __dev_t st_dev; /* inode's device */
|
|---|
| 139 | #if 1 /* bird: emx: */
|
|---|
| 140 | __uint32_t st_attr; /* emx: OS/2 & DOS attributes */
|
|---|
| 141 | #endif
|
|---|
| 142 | ino_t st_ino; /* inode's number */
|
|---|
| 143 | mode_t st_mode; /* inode protection mode */
|
|---|
| 144 | nlink_t st_nlink; /* number of hard links */
|
|---|
| 145 | uid_t st_uid; /* user ID of the file's owner */
|
|---|
| 146 | gid_t st_gid; /* group ID of the file's group */
|
|---|
| 147 | __dev_t st_rdev; /* device type */
|
|---|
| 148 | #if 1 /* bird: emx - better alignment of 64-bit types */
|
|---|
| 149 | __int32_t st_lspare;
|
|---|
| 150 | #endif /* bird */
|
|---|
| 151 | #if __BSD_VISIBLE
|
|---|
| 152 | struct timespec st_atimespec; /* time of last access */
|
|---|
| 153 | struct timespec st_mtimespec; /* time of last data modification */
|
|---|
| 154 | struct timespec st_ctimespec; /* time of last file status change */
|
|---|
| 155 | #else
|
|---|
| 156 | time_t st_atime; /* time of last access */
|
|---|
| 157 | long st_atimensec; /* nsec of last access */
|
|---|
| 158 | time_t st_mtime; /* time of last data modification */
|
|---|
| 159 | long st_mtimensec; /* nsec of last data modification */
|
|---|
| 160 | time_t st_ctime; /* time of last file status change */
|
|---|
| 161 | long st_ctimensec; /* nsec of last file status change */
|
|---|
| 162 | #endif
|
|---|
| 163 | off_t st_size; /* file size, in bytes */
|
|---|
| 164 | __int64_t st_blocks; /* blocks allocated for file */
|
|---|
| 165 | __uint32_t st_blksize; /* optimal blocksize for I/O */
|
|---|
| 166 | fflags_t st_flags; /* user defined flags for file */
|
|---|
| 167 | __uint32_t st_gen; /* file generation number */
|
|---|
| 168 | #if 0 /* bird: !emx - it's higher up for packing reasons */
|
|---|
| 169 | __int32_t st_lspare;
|
|---|
| 170 | #endif /* bird */
|
|---|
| 171 | #if __BSD_VISIBLE
|
|---|
| 172 | struct timespec st_birthtimespec; /* time of file creation */
|
|---|
| 173 | /*
|
|---|
| 174 | * Explicitly pad st_birthtimespec to 16 bytes so that the size of
|
|---|
| 175 | * struct stat is backwards compatible. We use bitfields instead
|
|---|
| 176 | * of an array of chars so that this doesn't require a C99 compiler
|
|---|
| 177 | * to compile if the size of the padding is 0. We use 2 bitfields
|
|---|
| 178 | * to cover up to 64 bits on 32-bit machines. We assume that
|
|---|
| 179 | * CHAR_BIT is 8...
|
|---|
| 180 | */
|
|---|
| 181 | unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
|
|---|
| 182 | unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
|
|---|
| 183 | #else
|
|---|
| 184 | time_t st_birthtime; /* time of file creation */
|
|---|
| 185 | long st_birthtimensec; /* nsec of file creation */
|
|---|
| 186 | unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
|
|---|
| 187 | unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
|
|---|
| 188 | #endif
|
|---|
| 189 | };
|
|---|
| 190 |
|
|---|
| 191 | #if 0 /* bird: emx */
|
|---|
| 192 | #if __BSD_VISIBLE
|
|---|
| 193 | struct nstat {
|
|---|
| 194 | __dev_t st_dev; /* inode's device */
|
|---|
| 195 | ino_t st_ino; /* inode's number */
|
|---|
| 196 | __uint32_t st_mode; /* inode protection mode */
|
|---|
| 197 | __uint32_t st_nlink; /* number of hard links */
|
|---|
| 198 | uid_t st_uid; /* user ID of the file's owner */
|
|---|
| 199 | gid_t st_gid; /* group ID of the file's group */
|
|---|
| 200 | __dev_t st_rdev; /* device type */
|
|---|
| 201 | struct timespec st_atimespec; /* time of last access */
|
|---|
| 202 | struct timespec st_mtimespec; /* time of last data modification */
|
|---|
| 203 | struct timespec st_ctimespec; /* time of last file status change */
|
|---|
| 204 | off_t st_size; /* file size, in bytes */
|
|---|
| 205 | __int64_t st_blocks; /* blocks allocated for file */
|
|---|
| 206 | __uint32_t st_blksize; /* optimal blocksize for I/O */
|
|---|
| 207 | fflags_t st_flags; /* user defined flags for file */
|
|---|
| 208 | __uint32_t st_gen; /* file generation number */
|
|---|
| 209 | struct timespec st_birthtimespec; /* time of file creation */
|
|---|
| 210 | /*
|
|---|
| 211 | * See above about the following padding.
|
|---|
| 212 | */
|
|---|
| 213 | unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
|
|---|
| 214 | unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
|
|---|
|
|---|