| [2] | 1 | /* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. |
|---|
| 2 | This file is part of the GNU C Library. |
|---|
| 3 | |
|---|
| 4 | The GNU C Library is free software; you can redistribute it and/or |
|---|
| 5 | modify it under the terms of the GNU Lesser General Public |
|---|
| 6 | License as published by the Free Software Foundation; either |
|---|
| 7 | version 2.1 of the License, or (at your option) any later version. |
|---|
| 8 | |
|---|
| 9 | The GNU C Library is distributed in the hope that it will be useful, |
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 12 | Lesser General Public License for more details. |
|---|
| 13 | |
|---|
| 14 | You should have received a copy of the GNU Lesser General Public |
|---|
| 15 | License along with the GNU C Library; if not, write to the Free |
|---|
| 16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|---|
| 17 | 02111-1307 USA. */ |
|---|
| 18 | |
|---|
| 19 | #ifndef _SYS_STAT_H |
|---|
| 20 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." |
|---|
| 21 | #endif |
|---|
| 22 | |
|---|
| 23 | /* Versions of the `struct stat' data structure. */ |
|---|
| 24 | #define _STAT_VER_LINUX_OLD 1 |
|---|
| 25 | #define _STAT_VER_KERNEL 1 |
|---|
| 26 | #define _STAT_VER_SVR4 2 |
|---|
| 27 | #define _STAT_VER_LINUX 3 |
|---|
| 28 | #define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ |
|---|
| 29 | |
|---|
| 30 | /* Versions of the `xmknod' interface. */ |
|---|
| 31 | #define _MKNOD_VER_LINUX 1 |
|---|
| 32 | #define _MKNOD_VER_SVR4 2 |
|---|
| 33 | #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | /* Structure describing file characteristics. */ |
|---|
| 37 | struct stat |
|---|
| 38 | { |
|---|
| 39 | __dev_t st_dev; |
|---|
| 40 | long int st_pad1[3]; |
|---|
| 41 | #ifndef __USE_FILE_OFFSET64 |
|---|
| 42 | __ino_t st_ino; /* File serial number. */ |
|---|
| 43 | #else |
|---|
| 44 | __ino64_t st_ino; /* File serial number. */ |
|---|
| 45 | #endif |
|---|
| 46 | __mode_t st_mode; /* File mode. */ |
|---|
| 47 | __nlink_t st_nlink; /* Link count. */ |
|---|
| 48 | __uid_t st_uid; /* User ID of the file's owner. */ |
|---|
| 49 | __gid_t st_gid; /* Group ID of the file's group.*/ |
|---|
| 50 | __dev_t st_rdev; /* Device number, if device. */ |
|---|
| 51 | #ifndef __USE_FILE_OFFSET64 |
|---|
| 52 | long int st_pad2[2]; |
|---|
| 53 | __off_t st_size; /* Size of file, in bytes. */ |
|---|
| 54 | /* SVR4 added this extra long to allow for expansion of off_t. */ |
|---|
| 55 | long int st_pad3; |
|---|
| 56 | #else |
|---|
| 57 | long int st_pad2[3]; |
|---|
| 58 | __off64_t st_size; /* Size of file, in bytes. */ |
|---|
| 59 | #endif |
|---|
| 60 | /* |
|---|
| 61 | * Actually this should be timestruc_t st_atime, st_mtime and |
|---|
| 62 | * st_ctime but we don't have it under Linux. |
|---|
| 63 | */ |
|---|
| 64 | __time_t st_atime; /* Time of last access. */ |
|---|
| 65 | long int __reserved0; |
|---|
| 66 | __time_t st_mtime; /* Time of last modification. */ |
|---|
| 67 | long int __reserved1; |
|---|
| 68 | __time_t st_ctime; /* Time of last status change. */ |
|---|
| 69 | long int __reserved2; |
|---|
| 70 | __blksize_t st_blksize; /* Optimal block size for I/O. */ |
|---|
| 71 | #ifndef __USE_FILE_OFFSET64 |
|---|
| 72 | __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ |
|---|
| 73 | #else |
|---|
| 74 | long int st_pad4; |
|---|
| 75 | __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ |
|---|
| 76 | #endif |
|---|
| 77 | long int st_pad5[14]; |
|---|
| 78 | }; |
|---|
| 79 | |
|---|
| 80 | #ifdef __USE_LARGEFILE64 |
|---|
| 81 | struct stat64 |
|---|
| 82 | { |
|---|
| 83 | __dev_t st_dev; |
|---|
| 84 | long int st_pad1[3]; |
|---|
| 85 | __ino64_t st_ino; /* File serial number. */ |
|---|
| 86 | __mode_t st_mode; /* File mode. */ |
|---|
| 87 | __nlink_t st_nlink; /* Link count. */ |
|---|
| 88 | __uid_t st_uid; /* User ID of the file's owner. */ |
|---|
| 89 | __gid_t st_gid; /* Group ID of the file's group.*/ |
|---|
| 90 | __dev_t st_rdev; /* Device number, if device. */ |
|---|
| 91 | long int st_pad2[3]; |
|---|
| 92 | __off64_t st_size; /* Size of file, in bytes. */ |
|---|
| 93 | /* |
|---|
| 94 | * Actually this should be timestruc_t st_atime, st_mtime and |
|---|
| 95 | * st_ctime but we don't have it under Linux. |
|---|
| 96 | */ |
|---|
| 97 | __time_t st_atime; /* Time of last access. */ |
|---|
| 98 | long int __reserved0; |
|---|
| 99 | __time_t st_mtime; /* Time of last modification. */ |
|---|
| 100 | long int __reserved1; |
|---|
| 101 | __time_t st_ctime; /* Time of last status change. */ |
|---|
| 102 | long int __reserved2; |
|---|
| 103 | __blksize_t st_blksize; /* Optimal block size for I/O. */ |
|---|
| 104 | long int st_pad3; |
|---|
| 105 | __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ |
|---|
| 106 | long int st_pad4[14]; |
|---|
| 107 | }; |
|---|
| 108 | #endif |
|---|
| 109 | |
|---|
| 110 | /* Tell code we have these members. */ |
|---|
| 111 | #define _STATBUF_ST_BLKSIZE |
|---|
| 112 | #define _STATBUF_ST_RDEV |
|---|
| 113 | |
|---|
| 114 | /* Encoding of the file mode. */ |
|---|
| 115 | |
|---|
| 116 | #define __S_IFMT 0170000 /* These bits determine file type. */ |
|---|
| 117 | |
|---|
| 118 | /* File types. */ |
|---|
| 119 | #define __S_IFDIR 0040000 /* Directory. */ |
|---|
| 120 | #define __S_IFCHR 0020000 /* Character device. */ |
|---|
| 121 | #define __S_IFBLK 0060000 /* Block device. */ |
|---|
| 122 | #define __S_IFREG 0100000 /* Regular file. */ |
|---|
| 123 | #define __S_IFIFO 0010000 /* FIFO. */ |
|---|
| 124 | #define __S_IFLNK 0120000 /* Symbolic link. */ |
|---|
| 125 | #define __S_IFSOCK 0140000 /* Socket. */ |
|---|
| 126 | |
|---|
| 127 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But |
|---|
| 128 | they do it by enforcing the correct use of the macros. */ |
|---|
| 129 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) |
|---|
| 130 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) |
|---|
| 131 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) |
|---|
| 132 | |
|---|
| 133 | /* Protection bits. */ |
|---|
| 134 | |
|---|
| 135 | #define __S_ISUID 04000 /* Set user ID on execution. */ |
|---|
| 136 | #define __S_ISGID 02000 /* Set group ID on execution. */ |
|---|
| 137 | #define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ |
|---|
| 138 | #define __S_IREAD 0400 /* Read by owner. */ |
|---|
| 139 | #define __S_IWRITE 0200 /* Write by owner. */ |
|---|
| 140 | #define __S_IEXEC 0100 /* Execute by owner. */ |
|---|