199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 1982, 1986, 1989, 1993
199767f8919635c4928607450d9e0abb932109ceToomas Soome * The Regents of the University of California. All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * (c) UNIX System Laboratories, Inc.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All or some portions of this file are derived from material licensed
199767f8919635c4928607450d9e0abb932109ceToomas Soome * to the University of California by American Telephone and Telegraph
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Co. or Unix System Laboratories, Inc. and are reproduced herein with
199767f8919635c4928607450d9e0abb932109ceToomas Soome * the permission of UNIX System Laboratories, Inc.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 4. Neither the name of the University nor the names of its contributors
199767f8919635c4928607450d9e0abb932109ceToomas Soome * may be used to endorse or promote products derived from this software
199767f8919635c4928607450d9e0abb932109ceToomas Soome * without specific prior written permission.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @(#)stat.h 8.12 (Berkeley) 6/16/95
199767f8919635c4928607450d9e0abb932109ceToomas Soome * XXX We get miscellaneous namespace pollution with this.
199767f8919635c4928607450d9e0abb932109ceToomas Soome __uint16_t st_uid; /* user ID of the file's owner */
199767f8919635c4928607450d9e0abb932109ceToomas Soome __uint16_t st_gid; /* group ID of the file's group */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct timespec st_atim; /* time of last access */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct timespec st_mtim; /* time of last data modification */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct timespec st_ctim; /* time of last file status change */
199767f8919635c4928607450d9e0abb932109ceToomas Soome __int32_t st_blksize; /* optimal blocksize for I/O */
199767f8919635c4928607450d9e0abb932109ceToomas Soome __int32_t st_blocks; /* blocks allocated for file */
199767f8919635c4928607450d9e0abb932109ceToomas Soome fflags_t st_flags; /* user defined flags for file */
199767f8919635c4928607450d9e0abb932109ceToomas Soome __uint32_t st_gen; /* file generation number */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uid_t st_uid; /* user ID of the file's owner */
199767f8919635c4928607450d9e0abb932109ceToomas Soome gid_t st_gid; /* group ID of the file's group */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct timespec st_atim; /* time of last access */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct timespec st_mtim; /* time of last data modification */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct timespec st_ctim; /* time of last file status change */
199767f8919635c4928607450d9e0abb932109ceToomas Soome blkcnt_t st_blocks; /* blocks allocated for file */
199767f8919635c4928607450d9e0abb932109ceToomas Soome blksize_t st_blksize; /* optimal blocksize for I/O */
199767f8919635c4928607450d9e0abb932109ceToomas Soome fflags_t st_flags; /* user defined flags for file */
199767f8919635c4928607450d9e0abb932109ceToomas Soome __uint32_t st_gen; /* file generation number */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct timespec st_birthtim; /* time of file creation */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Explicitly pad st_birthtim to 16 bytes so that the size of
199767f8919635c4928607450d9e0abb932109ceToomas Soome * struct stat is backwards compatible. We use bitfields instead
199767f8919635c4928607450d9e0abb932109ceToomas Soome * of an array of chars so that this doesn't require a C99 compiler
199767f8919635c4928607450d9e0abb932109ceToomas Soome * to compile if the size of the padding is 0. We use 2 bitfields
199767f8919635c4928607450d9e0abb932109ceToomas Soome * to cover up to 64 bits on 32-bit machines. We assume that
199767f8919635c4928607450d9e0abb932109ceToomas Soome * CHAR_BIT is 8...
199767f8919635c4928607450d9e0abb932109ceToomas Soome unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
199767f8919635c4928607450d9e0abb932109ceToomas Soome unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
199767f8919635c4928607450d9e0abb932109ceToomas Soome __uint32_t st_mode; /* inode protection mode */
199767f8919635c4928607450d9e0abb932109ceToomas Soome __uint32_t st_nlink; /* number of hard links */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uid_t st_uid; /* user ID of the file's owner */
199767f8919635c4928607450d9e0abb932109ceToomas Soome gid_t st_gid; /* group ID of the file's group */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct timespec st_atim; /* time of last access */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct timespec st_mtim; /* time of last data modification */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct timespec st_ctim; /* time of last file status change */
199767f8919635c4928607450d9e0abb932109ceToomas Soome blkcnt_t st_blocks; /* blocks allocated for file */
199767f8919635c4928607450d9e0abb932109ceToomas Soome blksize_t st_blksize; /* optimal blocksize for I/O */
199767f8919635c4928607450d9e0abb932109ceToomas Soome fflags_t st_flags; /* user defined flags for file */
199767f8919635c4928607450d9e0abb932109ceToomas Soome __uint32_t st_gen; /* file generation number */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct timespec st_birthtim; /* time of file creation */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * See above about the following padding.
199767f8919635c4928607450d9e0abb932109ceToomas Soome unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
199767f8919635c4928607450d9e0abb932109ceToomas Soome unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* For compatibility. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_KERNEL */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_ISUID 0004000 /* set user id on execution */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_ISGID 0002000 /* set group id on execution */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_IRWXU 0000700 /* RWX mask for owner */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_IRWXG 0000070 /* RWX mask for group */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_IRWXO 0000007 /* RWX mask for other */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_ISVTX 0001000 /* save swapped text even after use */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_ISDIR(m) (((m) & 0170000) == 0040000) /* directory */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_ISCHR(m) (((m) & 0170000) == 0020000) /* char special */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_ISBLK(m) (((m) & 0170000) == 0060000) /* block special */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_ISREG(m) (((m) & 0170000) == 0100000) /* regular file */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_ISFIFO(m) (((m) & 0170000) == 0010000) /* fifo or socket */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_ISSOCK(m) (((m) & 0170000) == 0140000) /* socket */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_ISWHT(m) (((m) & 0170000) == 0160000) /* whiteout */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define S_BLKSIZE 512 /* block size used in the stat struct */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Definitions of flags stored in file flags word.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Super-user and owner changeable flags.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_NODUMP 0x00000001 /* do not dump file */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_IMMUTABLE 0x00000002 /* file may not be changed */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_APPEND 0x00000004 /* writes to file may only append */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * These two bits are defined in MacOS X. They are not currently used in
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_COMPRESSED 0x00000020 /* file is compressed */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_TRACKED 0x00000040 /* renames and deletes are tracked */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_SYSTEM 0x00000080 /* Windows system file bit */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_OFFLINE 0x00000200 /* file is offline */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_REPARSE 0x00000400 /* Windows reparse point file bit */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_ARCHIVE 0x00000800 /* file needs to be archived */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_READONLY 0x00001000 /* Windows readonly file bit */
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* This is the same as the MacOS X definition of UF_HIDDEN. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define UF_HIDDEN 0x00008000 /* file is hidden */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Super-user changeable flags.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SF_ARCHIVED 0x00010000 /* file is archived */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SF_IMMUTABLE 0x00020000 /* file may not be changed */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SF_APPEND 0x00040000 /* writes to file may only append */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SF_NOUNLINK 0x00100000 /* file may not be removed or renamed */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SF_SNAPSHOT 0x00200000 /* snapshot inode */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Shorthand abbreviations of above.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* __BSD_VISIBLE */
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint chflags(const char *, unsigned long);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint chflagsat(int, const char *, unsigned long, int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint fchflags(int, unsigned long);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint futimens(int fd, const struct timespec times[2]);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint utimensat(int fd, const char *path, const struct timespec times[2],
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint lchflags(const char *, unsigned long);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint lstat(const char * __restrict, struct stat * __restrict);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint stat(const char * __restrict, struct stat * __restrict);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint fstatat(int, const char *, struct stat *, int);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_KERNEL */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_SYS_STAT_H_ */