Back to index

glibc  2.9
stat.h
Go to the documentation of this file.
00001 /* Copyright (C) 1992, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _SYS_STAT_H
00020 # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
00021 #endif
00022 
00023 /* Versions of the `struct stat' data structure.  */
00024 #define _STAT_VER_SVR4             1
00025 #define _STAT_VER           _STAT_VER_SVR4       /* The one defined below.  */
00026 
00027 /* Versions of the `xmknod' interface.  */
00028 #define _MKNOD_VER_SVR4            1
00029 #define _MKNOD_VER          _MKNOD_VER_SVR4 /* The bits defined below.  */
00030 
00031 
00032 struct stat
00033   {
00034     __dev_t st_dev;                /* Device.  */
00035     unsigned short int __pad1;
00036 #ifndef __USE_FILE_OFFSET64
00037     __ino_t st_ino;                /* File serial number.      */
00038 #else
00039     __ino64_t st_ino;                     /* File serial number.      */
00040 #endif
00041     __mode_t st_mode;                     /* File mode.  */
00042     __nlink_t st_nlink;                   /* Link count.  */
00043     __uid_t st_uid;                /* User ID of the file's owner.    */
00044     __gid_t st_gid;                /* Group ID of the file's group.*/
00045     __dev_t st_rdev;               /* Device number, if device.  */
00046     unsigned short int __pad2;
00047 #ifndef __USE_FILE_OFFSET64
00048     __off_t st_size;               /* Size of file, in bytes.  */
00049 #else
00050     __off64_t st_size;                    /* Size of file, in bytes.  */
00051 #endif
00052     unsigned long int st_blksize;  /* Optimal block size for I/O.  */
00053 
00054 #ifndef __USE_FILE_OFFSET64
00055     __blkcnt_t st_blocks;          /* Number 512-byte blocks allocated. */
00056 #else
00057     __blkcnt64_t st_blocks;        /* Number 512-byte blocks allocated. */
00058 #endif
00059     __time_t st_atime;                    /* Time of last access.  */
00060     unsigned long int __unused1;
00061     __time_t st_mtime;                    /* Time of last modification.  */
00062     unsigned long int __unused2;
00063     __time_t st_ctime;                    /* Time of last status change.  */
00064     unsigned long int __unused3;
00065     unsigned long int __unused4;
00066     unsigned long int __unused5;
00067   };
00068 
00069 #ifdef __USE_LARGEFILE64
00070 struct stat64
00071   {
00072     __dev_t st_dev;                /* Device.  */
00073     unsigned short int __pad1;
00074 
00075     __ino64_t st_ino;                     /* File serial number.      */
00076     __mode_t st_mode;                     /* File mode.  */
00077     __nlink_t st_nlink;                   /* Link count.  */
00078     __uid_t st_uid;                /* User ID of the file's owner.    */
00079     __gid_t st_gid;                /* Group ID of the file's group.*/
00080     __dev_t st_rdev;               /* Device number, if device.  */
00081     unsigned short int __pad2;
00082     __off64_t st_size;                    /* Size of file, in bytes.  */
00083     unsigned long int st_blksize;  /* Optimal block size for I/O.  */
00084 
00085     __blkcnt64_t st_blocks;        /* Number 512-byte blocks allocated. */
00086     __time_t st_atime;                    /* Time of last access.  */
00087     unsigned long int __unused1;
00088     __time_t st_mtime;                    /* Time of last modification.  */
00089     unsigned long int __unused2;
00090     __time_t st_ctime;                    /* Time of last status change.  */
00091     unsigned long int __unused3;
00092     unsigned long int __unused4;
00093     unsigned long int __unused5;
00094   };
00095 #endif
00096 
00097 /* Tell code we have these members.  */
00098 #define       _STATBUF_ST_BLKSIZE
00099 #define _STATBUF_ST_RDEV
00100 
00101 /* Encoding of the file mode.  */
00102 
00103 #define       __S_IFMT      0170000       /* These bits determine file type.  */
00104 
00105 /* File types.  */
00106 #define       __S_IFDIR     0040000       /* Directory.  */
00107 #define       __S_IFCHR     0020000       /* Character device.  */
00108 #define       __S_IFBLK     0060000       /* Block device.  */
00109 #define       __S_IFREG     0100000       /* Regular file.  */
00110 #define       __S_IFIFO     0010000       /* FIFO.  */
00111 
00112 /* These don't actually exist on System V, but having them doesn't hurt.  */
00113 #define       __S_IFLNK     0120000       /* Symbolic link.  */
00114 #define       __S_IFSOCK    0140000       /* Socket.  */
00115 
00116 /* POSIX.1b objects.  */
00117 #define __S_TYPEISMQ(buf) (0)
00118 #define __S_TYPEISSEM(buf) (0)
00119 #define __S_TYPEISSHM(buf) (0)
00120 
00121 /* Protection bits.  */
00122 
00123 #define       __S_ISUID     04000  /* Set user ID on execution.  */
00124 #define       __S_ISGID     02000  /* Set group ID on execution.  */
00125 #define       __S_ISVTX     01000  /* Save swapped text after use (sticky).  */
00126 #define       __S_IREAD     0400   /* Read by owner.  */
00127 #define       __S_IWRITE    0200   /* Write by owner.  */
00128 #define       __S_IEXEC     0100   /* Execute by owner.  */