Back to index

glibc  2.9
stat.h
Go to the documentation of this file.
00001 /* Copyright (C) 1992, 1996, 1997, 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 /* This structure needs to be defined in accordance with the
00024    implementation of __stat, __fstat, and __lstat.  */
00025 
00026 #include <bits/types.h>
00027 
00028 /* Structure describing file characteristics.  */
00029 struct stat
00030   {
00031     /* These are the members that POSIX.1 requires.  */
00032 
00033     __mode_t st_mode;              /* File mode.  */
00034 #ifndef __USE_FILE_OFFSET64
00035     __ino_t st_ino;         /* File serial number.  */
00036 #else
00037     __ino64_t st_ino;              /* File serial number.      */
00038 #endif
00039     __dev_t st_dev;         /* Device containing the file.  */
00040     __nlink_t st_nlink;            /* Link count.  */
00041 
00042     __uid_t st_uid;         /* User ID of the file's owner.  */
00043     __gid_t st_gid;         /* Group ID of the file's group.  */
00044 #ifndef __USE_FILE_OFFSET64
00045     __off_t st_size;        /* Size of file, in bytes.  */
00046 #else
00047     __off64_t st_size;             /* Size of file, in bytes.  */
00048 #endif
00049 
00050     __time_t st_atime;             /* Time of last access.  */
00051     __time_t st_mtime;             /* Time of last modification.  */
00052     __time_t st_ctime;             /* Time of last status change.  */
00053 
00054     /* This should be defined if there is a `st_blksize' member.  */
00055 #undef _STATBUF_ST_BLKSIZE
00056   };
00057 
00058 /* Encoding of the file mode.  These are the standard Unix values,
00059    but POSIX.1 does not specify what values should be used.  */
00060 
00061 #define       __S_IFMT      0170000       /* These bits determine file type.  */
00062 
00063 /* File types.  */
00064 #define       __S_IFDIR     0040000       /* Directory.  */
00065 #define       __S_IFCHR     0020000       /* Character device.  */
00066 #define       __S_IFBLK     0060000       /* Block device.  */
00067 #define       __S_IFREG     0100000       /* Regular file.  */
00068 #define       __S_IFIFO     0010000       /* FIFO.  */
00069 
00070 /* POSIX.1b objects.  */
00071 #define __S_TYPEISMQ(buf) 0
00072 #define __S_TYPEISSEM(buf) 0
00073 #define __S_TYPEISSHM(buf) 0
00074 
00075 /* Protection bits.  */
00076 
00077 #define       __S_ISUID     04000  /* Set user ID on execution.  */
00078 #define       __S_ISGID     02000  /* Set group ID on execution.  */
00079 #define       __S_IREAD     0400   /* Read by owner.  */
00080 #define       __S_IWRITE    0200   /* Write by owner.  */
00081 #define       __S_IEXEC     0100   /* Execute by owner.  */
00082 
00083 #ifdef __USE_LARGEFILE64
00084 struct stat64
00085   {
00086     __mode_t st_mode;              /* File mode.  */
00087     __ino64_t st_ino;              /* File serial number.      */
00088     __dev_t st_dev;         /* Device.  */
00089     __nlink_t st_nlink;            /* Link count.  */
00090 
00091     __uid_t st_uid;         /* User ID of the file's owner.    */
00092     __gid_t st_gid;         /* Group ID of the file's group.*/
00093     __off64_t st_size;             /* Size of file, in bytes.  */
00094 
00095     __time_t st_atime;             /* Time of last access.  */
00096     __time_t st_mtime;             /* Time of last modification.  */
00097     __time_t st_ctime;             /* Time of last status change.  */
00098   };
00099 #endif