Back to index

glibc  2.9
stat.h
Go to the documentation of this file.
00001 /* Copyright (C) 1991, 92, 96, 97, 99, 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 #include <bits/types.h>
00024 
00025 /* Structure describing file characteristics.  */
00026 struct stat
00027   {
00028     /* This is a short instead of dev_t for compatibility with 4.3.  */
00029     short int st_dev;              /* Device containing the file.     */
00030     __ino_t st_ino;         /* File serial number.             */
00031 
00032     /* This is a short instead of mode_t for compatibility with 4.3.  */
00033     unsigned short int st_mode;    /* File mode.  */
00034 
00035     __nlink_t st_nlink;            /* Link count.  */
00036 
00037     /* These are shorts instead of uid_t/gid_t for compatibility with 4.3.  */
00038     unsigned short int st_uid;     /* User ID of the file's owner.    */
00039     unsigned short int st_gid;     /* Group ID of the file's group.*/
00040 
00041     /* This is a short instead of dev_t for compatibility with 4.3.  */
00042     short int st_rdev;             /* Device number, if device.  */
00043 
00044     __off_t st_size;        /* Size of file, in bytes.  */
00045 
00046     __time_t st_atime;             /* Time of last access.  */
00047     unsigned long int st_atime_usec;
00048     __time_t st_mtime;             /* Time of last modification.  */
00049     unsigned long int st_mtime_usec;
00050     __time_t st_ctime;             /* Time of last status change.  */
00051     unsigned long int st_ctime_usec;
00052 
00053     __blksize_t st_blksize; /* Optimal block size for I/O.  */
00054 #define       _STATBUF_ST_BLKSIZE  /* Tell code we have this member.  */
00055 
00056     __blkcnt_t st_blocks;   /* Number of 512-byte blocks allocated.  */
00057 
00058     long int st_spare[2];
00059   };
00060 
00061 /* Encoding of the file mode.  */
00062 
00063 #define       __S_IFMT      0170000       /* These bits determine file type.  */
00064 
00065 /* File types.  */
00066 #define       __S_IFDIR     0040000       /* Directory.  */
00067 #define       __S_IFCHR     0020000       /* Character device.  */
00068 #define       __S_IFBLK     0060000       /* Block device.  */
00069 #define       __S_IFREG     0100000       /* Regular file.  */
00070 #define       __S_IFLNK     0120000       /* Symbolic link.  */
00071 #define       __S_IFSOCK    0140000       /* Socket.  */
00072 #define       __S_IFIFO     0010000       /* FIFO.  */
00073 
00074 /* POSIX.1b objects.  */
00075 #define __S_TYPEISMQ(buf) (0)
00076 #define __S_TYPEISSEM(buf) (0)
00077 #define __S_TYPEISSHM(buf) (0)
00078 
00079 /* Protection bits.  */
00080 
00081 #define       __S_ISUID     04000  /* Set user ID on execution.  */
00082 #define       __S_ISGID     02000  /* Set group ID on execution.  */
00083 #define       __S_ISVTX     01000  /* Save swapped text after use (sticky).  */
00084 #define       __S_IREAD     0400   /* Read by owner.  */
00085 #define       __S_IWRITE    0200   /* Write by owner.  */
00086 #define       __S_IEXEC     0100   /* Execute by owner.  */