]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/alpha/bits/stat.h
Update to LGPL v2.1.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / alpha / bits / stat.h
1 /* Copyright (C) 1996,1997,1998,1999,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_KERNEL 0
25 #define _STAT_VER_GLIBC2 1
26 #define _STAT_VER_GLIBC2_1 2
27 #define _STAT_VER _STAT_VER_GLIBC2_1
28
29 /* Versions of the `xmknod' interface. */
30 #define _MKNOD_VER_LINUX 0
31
32 struct stat
33 {
34 __dev_t st_dev; /* Device. */
35 #ifdef __USE_FILE_OFFSET64
36 __ino64_t st_ino; /* File serial number. */
37 #else
38 __ino_t st_ino; /* File serial number. */
39 int __pad1;
40 #endif
41 __mode_t st_mode; /* File mode. */
42 __nlink_t st_nlink; /* Link count. */
43 __uid_t st_uid; /* User ID of the file's owner. */
44 __gid_t st_gid; /* Group ID of the file's group.*/
45 __dev_t st_rdev; /* Device number, if device. */
46 __off_t st_size; /* Size of file, in bytes. */
47 __time_t st_atime; /* Time of last access. */
48 __time_t st_mtime; /* Time of last modification. */
49 __time_t st_ctime; /* Time of last status change. */
50 #ifdef __USE_FILE_OFFSET64
51 __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
52 #else
53 __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */
54 int __pad2;
55 #endif
56 __blksize_t st_blksize; /* Optimal block size for I/O. */
57 unsigned int st_flags;
58 unsigned int st_gen;
59 int __pad3;
60 long __unused[4];
61 };
62
63 #ifdef __USE_LARGEFILE64
64 /* Note stat64 is the same shape as stat. */
65 struct stat64
66 {
67 __dev_t st_dev; /* Device. */
68 __ino64_t st_ino; /* File serial number. */
69 __mode_t st_mode; /* File mode. */
70 __nlink_t st_nlink; /* Link count. */
71 __uid_t st_uid; /* User ID of the file's owner. */
72 __gid_t st_gid; /* Group ID of the file's group.*/
73 __dev_t st_rdev; /* Device number, if device. */
74 __off_t st_size; /* Size of file, in bytes. */
75 __time_t st_atime; /* Time of last access. */
76 __time_t st_mtime; /* Time of last modification. */
77 __time_t st_ctime; /* Time of last status change. */
78 __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
79 __blksize_t st_blksize; /* Optimal block size for I/O. */
80 unsigned int st_flags;
81 unsigned int st_gen;
82 int __pad3;
83 long __unused[4];
84 };
85 #endif
86
87 /* Tell code we have these members. */
88 #define _STATBUF_ST_BLKSIZE
89 #define _STATBUF_ST_RDEV
90
91 /* Encoding of the file mode. */
92
93 #define __S_IFMT 0170000 /* These bits determine file type. */
94
95 /* File types. */
96 #define __S_IFDIR 0040000 /* Directory. */
97 #define __S_IFCHR 0020000 /* Character device. */
98 #define __S_IFBLK 0060000 /* Block device. */
99 #define __S_IFREG 0100000 /* Regular file. */
100 #define __S_IFIFO 0010000 /* FIFO. */
101 #define __S_IFLNK 0120000 /* Symbolic link. */
102 #define __S_IFSOCK 0140000 /* Socket. */
103
104 /* POSIX.1b objects. Note that these macros always evaluate to zero. But
105 they do it by enforcing the correct use of the macros. */
106 #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
107 #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
108 #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
109
110 /* Protection bits. */
111
112 #define __S_ISUID 04000 /* Set user ID on execution. */
113 #define __S_ISGID 02000 /* Set group ID on execution. */
114 #define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
115 #define __S_IREAD 0400 /* Read by owner. */
116 #define __S_IWRITE 0200 /* Write by owner. */
117 #define __S_IEXEC 0100 /* Execute by owner. */