Back to index

glibc  2.9
stat.h
Go to the documentation of this file.
00001 /* Copyright (C) 1993, 1996, 1997, 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 #include <bits/types.h>
00024 
00025 /* Versions of the `struct stat' data structure and
00026    the bits of the `xmknod' interface.  */
00027 #define _STAT_VER    2
00028 #define _MKNOD_VER   2
00029 
00030 /* Structure describing file characteristics.  */
00031 struct stat
00032   {
00033     unsigned long itn st_dev;      /* Device.  */
00034     long int st_filler1[3];
00035     unsigned long int st_ino;      /* File serial number.             */
00036     unsigned long int st_mode;     /* File mode.  */
00037     unsigned long int st_nlink;    /* Link count.  */
00038     long int st_uid;        /* User ID of the file's owner.    */
00039     long int st_gid;        /* Group ID of the file's group.*/
00040     unsigned long int st_rdev;     /* Device number, if device.  */
00041     long int st_filler2[2];
00042 
00043     long int st_size;              /* Size of file, in bytes.  */
00044     /* SVR4 added this extra long to allow for expansion of off_t.  */
00045     long int st_filler3;
00046 
00047     long int st_atime;             /* Time of last access.  */
00048     unsigned long int st_atime_usec;
00049     long int st_mtime;             /* Time of last modification.  */
00050     unsigned long int st_mtime_usec;
00051     long int st_ctime;             /* Time of last status change.  */
00052     unsigned long int st_ctime_usec;
00053 
00054     __blksize_t st_blksize; /* Optimal block size for I/O.  */
00055 #define       _STATBUF_ST_BLKSIZE  /* Tell code we have this member.  */
00056 
00057     __blkcnt_t st_blocks;   /* Number of 512-byte blocks allocated.  */
00058     char st_fstype[16];            /* The type of this filesystem.  */
00059     int st_aclcnt;
00060     unsigned long int st_level;
00061     unsigned long int st_flags;
00062     unsigned long int st_cmwlevel;
00063     long int st_filler4[4];
00064   };
00065 
00066 /* Encoding of the file mode.  */
00067 
00068 #define       __S_IFMT      0170000       /* These bits determine file type.  */
00069 
00070 /* File types.  */
00071 #define       __S_IFDIR     0040000       /* Directory.  */
00072 #define       __S_IFCHR     0020000       /* Character device.  */
00073 #define       __S_IFBLK     0060000       /* Block device.  */
00074 #define       __S_IFREG     0100000       /* Regular file.  */
00075 #define       __S_IFIFO     0010000       /* FIFO.  */
00076 
00077 /* These don't actually exist on System V, but having them doesn't hurt.  */
00078 #define       __S_IFLNK     0120000       /* Symbolic link.  */
00079 #define       __S_IFSOCK    0140000       /* Socket.  */
00080 
00081 /* POSIX.1b objects.  */
00082 #define __S_TYPEISMQ(buf) (0)
00083 #define __S_TYPEISSEM(buf) (0)
00084 #define __S_TYPEISSHM(buf) (0)
00085 
00086 /* Protection bits.  */
00087 
00088 #define       __S_ISUID     04000  /* Set user ID on execution.  */
00089 #define       __S_ISGID     02000  /* Set group ID on execution.  */
00090 #define       __S_ISVTX     01000  /* Save swapped text after use (sticky).  */
00091 #define       __S_IREAD     0400   /* Read by owner.  */
00092 #define       __S_IWRITE    0200   /* Write by owner.  */
00093 #define       __S_IEXEC     0100   /* Execute by owner.  */