Back to index

glibc  2.9
stat.h
Go to the documentation of this file.
00001 /* Copyright (C) 1999, 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 struct stat
00024   {
00025     __dev_t st_dev;                /* Device.  */
00026     __ino_t st_ino;                /* File serial number.      */
00027     __mode_t st_mode;                     /* File mode.  */
00028     __nlink_t st_nlink;                   /* Link count.  */
00029     unsigned short int st_flag;           /* Flag word.  */
00030     __uid_t st_uid;                /* User ID of the file's owner.    */
00031     __gid_t st_gid;                /* Group ID of the file's group.*/
00032     __dev_t st_rdev;               /* Device number, if device.  */
00033 #ifndef __USE_FILE_OFFSET64
00034     __off_t st_size;               /* Size of file, in bytes.  */
00035 #else
00036     int st_ssize;                  /* Size of file, in bytes.  */
00037 #endif
00038     __time_t st_atime;                    /* Time of last access.  */
00039     unsigned long int __unused1;
00040     __time_t st_mtime;                    /* Time of last modification.  */
00041     unsigned long int __unused2;
00042     __time_t st_ctime;                    /* Time of last status change.  */
00043     unsigned long int __unused3;
00044     __blksize_t st_blksize;        /* Optimal block size for I/O.  */
00045     __blkcnt_t st_blocks;          /* Number 512-byte blocks allocated. */
00046     int st_vfstype;                /* Type of the filesystem.  */
00047     unsigned int st_vfs;           /* Vfs number.  */
00048     unsigned int st_type;          /* Vnode type.  */
00049     unsigned int st_gen;           /* Inode generation number.  */
00050 
00051 #define _STATBUF_RESERVED_SPACE 9
00052     unsigned int st_reserved[_STATBUF_RESERVED_SPACE];
00053 
00054 #ifdef __USE_FILE_OFFSET64
00055     unsigned int st_padto_ll;
00056     __off64_t st_size;                    /* 64 bit file size in bytes.  */
00057 #endif
00058   };
00059 
00060 #ifdef __USE_LARGEFILE64
00061 struct stat64
00062   {
00063     __dev_t st_dev;                /* Device.  */
00064     __ino_t st_ino;                /* File serial number.      */
00065     __mode_t st_mode;                     /* File mode.  */
00066     __nlink_t st_nlink;                   /* Link count.  */
00067     unsigned short int st_flag;           /* Flag word.  */
00068     __uid_t st_uid;                /* User ID of the file's owner.    */
00069     __gid_t st_gid;                /* Group ID of the file's group.*/
00070     __dev_t st_rdev;               /* Device number, if device.  */
00071     int st_ssize;                  /* Size of file, in bytes.  */
00072     __time_t st_atime;                    /* Time of last access.  */
00073     unsigned long int __unused1;
00074     __time_t st_mtime;                    /* Time of last modification.  */
00075     unsigned long int __unused2;
00076     __time_t st_ctime;                    /* Time of last status change.  */
00077     unsigned long int __unused3;
00078     __blksize_t st_blksize;        /* Optimal block size for I/O.  */
00079     __blkcnt_t st_blocks;          /* Number 512-byte blocks allocated. */
00080     int st_vfstype;                /* Type of the filesystem.  */
00081     unsigned int st_vfs;           /* Vfs number.  */
00082     unsigned int st_type;          /* Vnode type.  */
00083     unsigned int st_gen;           /* Inode generation number.  */
00084     unsigned int st_reserved[_STATBUF_RESERVED_SPACE];
00085     unsigned int st_padto_ll;
00086     __off64_t st_size;                    /* 64 bit file size in bytes.  */
00087   };
00088 #endif
00089 
00090 /* Tell code we have these members.  */
00091 #define       _STATBUF_ST_BLKSIZE
00092 #define _STATBUF_ST_RDEV
00093 
00094 /* Encoding of the file mode.  */
00095 
00096 #define       __S_IFMT      0170000       /* These bits determine file type.  */
00097 
00098 /* File types.  */
00099 #define       __S_IFDIR     0040000       /* Directory.  */
00100 #define       __S_IFCHR     0020000       /* Character device.  */
00101 #define       __S_IFBLK     0060000       /* Block device.  */
00102 #define       __S_IFREG     0100000       /* Regular file.  */
00103 #define       __S_IFIFO     0010000       /* FIFO.  */
00104 #define       __S_IFLNK     0120000       /* Symbolic link.  */
00105 #define       __S_IFSOCK    0140000       /* Socket.  */
00106 
00107 /* POSIX.1b objects.  */
00108 #define __S_TYPEISMQ(buf) (0)
00109 #define __S_TYPEISSEM(buf) (0)
00110 #define __S_TYPEISSHM(buf) (0)
00111 
00112 /* Protection bits.  */
00113 
00114 #define       __S_ISUID     04000  /* Set user ID on execution.  */
00115 #define       __S_ISGID     02000  /* Set group ID on execution.  */
00116 #define       __S_ISVTX     01000  /* Save swapped text after use (sticky).  */
00117 #define       __S_IREAD     0400   /* Read by owner.  */
00118 #define       __S_IWRITE    0200   /* Write by owner.  */
00119 #define       __S_IEXEC     0100   /* Execute by owner.  */