(root)/
glibc-2.38/
sysdeps/
unix/
sysv/
linux/
microblaze/
bits/
struct_stat.h
       1  /* Definition for struct stat.
       2     Copyright (C) 2020-2023 Free Software Foundation, Inc.
       3     This file is part of the GNU C Library.
       4  
       5     The GNU C Library is free software; you can redistribute it and/or
       6     modify it under the terms of the GNU Lesser General Public
       7     License as published by the Free Software Foundation; either
       8     version 2.1 of the License, or (at your option) any later version.
       9  
      10     The GNU C Library is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13     Lesser General Public License for more details.
      14  
      15     You should have received a copy of the GNU Lesser General Public
      16     License along with the GNU C Library.  If not, see
      17     <https://www.gnu.org/licenses/>.  */
      18  
      19  #if !defined _SYS_STAT_H && !defined _FCNTL_H
      20  # error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
      21  #endif
      22  
      23  #ifndef _BITS_STRUCT_STAT_H
      24  #define _BITS_STRUCT_STAT_H	1
      25  
      26  #ifndef __USE_FILE_OFFSET64
      27  struct stat
      28  {
      29  #ifdef __USE_TIME_BITS64
      30  # include <bits/struct_stat_time64_helper.h>
      31  #else
      32          __dev_t         st_dev;     /* Device.  */
      33          __ino_t         st_ino;     /* File serial number.  */
      34          __mode_t        st_mode;    /* File mode.  */
      35          __nlink_t       st_nlink;   /* Link count.  */
      36          __uid_t         st_uid;     /* User ID of the file's owner.  */
      37          __gid_t         st_gid;     /* Group ID of the file's group.  */
      38          __dev_t         st_rdev;    /* Device number, if device.  */
      39          unsigned long   __pad2;
      40          __off_t         st_size;    /* Size of file, in bytes.  */
      41          __blksize_t     st_blksize; /* Optimal block size for I/O.  */
      42          int             __pad3;
      43          __blkcnt_t      st_blocks;  /* Number 512-byte blocks allocated.  */
      44  # ifdef __USE_XOPEN2K8
      45          /* Nanosecond resolution timestamps are stored in a format
      46           * equivalent to 'struct timespec'. This is the type used
      47           * whenever possible but the Unix namespace rules do not allow the
      48           * identifier 'timespec' to appear in the <sys/stat.h> header.
      49           * Therefore we have to handle the use of this header in strictly
      50           * standard-compliant sources special.  */
      51          struct timespec         st_atim; /* Time of last access.  */
      52          struct timespec         st_mtim; /* Time of last modification.  */
      53          struct timespec         st_ctim; /* Time of last status change.  */
      54  #  define st_atime st_atim.tv_sec         /* Backward compatibility.  */
      55  #  define st_mtime st_mtim.tv_sec
      56  #  define st_ctime st_ctim.tv_sec
      57  # else
      58          __time_t                st_atime;     /* Time of last access.  */
      59          unsigned long int       st_atimensec; /* Nscecs of last access.  */
      60          __time_t                st_mtime;     /* Time of last modification.  */
      61          unsigned long int       st_mtimensec; /* Nsecs of last modification.  */
      62          __time_t                st_ctime;     /* Time of last status change.  */
      63          unsigned long int       st_ctimensec; /* Nsecs of last status change.  */
      64  # endif
      65          unsigned int            __glibc_reserved4;
      66          unsigned int            __glibc_reserved5;
      67  #endif /* __USE_TIME_BITS64  */
      68  };
      69  #else /* __USE_FILE_OFFSET64 */
      70  /* MS: If __USE_FILE_OFFSET64 is setup then struct stat should match stat64
      71   * structure. Glibc has no type __dev64_t that's why I had to use standard
      72   * type for st_dev and st_rdev. Several architectures uses pads after st_dev
      73   * but this approach covers BIG and LITTLE endian. I think it is better to
      74   * create one ifdef to separate stats structures.  */
      75  struct stat
      76  {
      77  #ifdef __USE_TIME_BITS64
      78  # include <bits/struct_stat_time64_helper.h>
      79  #else
      80          unsigned long long      st_dev;     /* Device.  */
      81          __ino64_t               st_ino;     /* 32bit file serial number.  */
      82          __mode_t                st_mode;    /* File mode.  */
      83          __nlink_t               st_nlink;   /* Link count.  */
      84          __uid_t                 st_uid;     /* User ID of the file's owner.  */
      85          __gid_t                 st_gid;     /* Group ID of the file's group.  */
      86          unsigned long long      st_rdev;    /* Device number, if device.  */
      87          unsigned long long      __pad2;
      88          __off64_t               st_size;    /* Size of file, in bytes.  */
      89          __blksize_t             st_blksize; /* Optimal block size for I/O.  */
      90          int                     __pad3;
      91          __blkcnt64_t            st_blocks;  /* Number 512-byte blocks allocated.  */
      92  # ifdef __USE_XOPEN2K8
      93          /* Nanosecond resolution timestamps are stored in a format
      94           * equivalent to 'struct timespec'. This is the type used
      95           * whenever possible but the Unix namespace rules do not allow the
      96           * identifier 'timespec' to appear in the <sys/stat.h> header.
      97           * Therefore we have to handle the use of this header in strictly
      98           * standard-compliant sources special.  */
      99          struct timespec         st_atim;      /* Time of last access.  */
     100          struct timespec         st_mtim;      /* Time of last modification.  */
     101          struct timespec         st_ctim;      /* Time of last status change.  */
     102  #  define st_atime st_atim.tv_sec              /* Backward compatibility.  */
     103  #  define st_mtime st_mtim.tv_sec
     104  #  define st_ctime st_ctim.tv_sec
     105  # else
     106          __time_t                st_atime;     /* Time of last access.  */
     107          unsigned long int       st_atimensec; /* Nscecs of last access.  */
     108          __time_t                st_mtime;     /* Time of last modification.  */
     109          unsigned long int       st_mtimensec; /* Nsecs of last modification.  */
     110          __time_t                st_ctime;     /* Time of last status change.  */
     111          unsigned long int       st_ctimensec; /* Nsecs of last status change.  */
     112  # endif
     113          unsigned int            __glibc_reserved4;
     114          unsigned int            __glibc_reserved5;
     115  # endif /* __USE_TIME_BITS64 */
     116  };
     117  #endif /* __USE_FILE_OFFSET64 */
     118  
     119  #ifdef __USE_LARGEFILE64
     120  struct stat64
     121  {
     122  # ifdef __USE_TIME_BITS64
     123  #  include <bits/struct_stat_time64_helper.h>
     124  # else
     125          unsigned long long      st_dev;     /* Device.  */
     126          __ino64_t               st_ino;     /* 32bit file serial number.  */
     127          __mode_t                st_mode;    /* File mode.  */
     128          __nlink_t               st_nlink;   /* Link count.  */
     129          __uid_t                 st_uid;     /* User ID of the file's owner.  */
     130          __gid_t                 st_gid;     /* Group ID of the file's group.  */
     131          unsigned long long      st_rdev;    /* Device number, if device.  */
     132          unsigned long long      __pad2;
     133          __off64_t               st_size;    /* Size of file, in bytes.  */
     134          __blksize_t             st_blksize; /* Optimal block size for I/O.  */
     135          int                     __pad3;
     136          __blkcnt64_t            st_blocks;  /* Number 512-byte blocks allocated.  */
     137  #  ifdef __USE_XOPEN2K8
     138          /* Nanosecond resolution timestamps are stored in a format
     139           * equivalent to 'struct timespec'. This is the type used
     140           * whenever possible but the Unix namespace rules do not allow the
     141           * identifier 'timespec' to appear in the <sys/stat.h> header.
     142           * Therefore we have to handle the use of this header in strictly
     143           * standard-compliant sources special.  */
     144          struct timespec         st_atim;    /* Time of last access.  */
     145          struct timespec         st_mtim;    /* Time of last modification.  */
     146          struct timespec         st_ctim;    /* Time of last status change.  */
     147  #   define st_atime st_atim.tv_sec           /* Backward compatibility.  */
     148  #   define st_mtime st_mtim.tv_sec
     149  #   define st_ctime st_ctim.tv_sec
     150  #  else
     151          __time_t                st_atime;     /* Time of last access.  */
     152          unsigned long int       st_atimensec; /* Nscecs of last access.  */
     153          __time_t                st_mtime;     /* Time of last modification.  */
     154          unsigned long int       st_mtimensec; /* Nsecs of last modification.  */
     155          __time_t                st_ctime;     /* Time of last status change.  */
     156          unsigned long int       st_ctimensec; /* Nsecs of last status change.  */
     157  #  endif
     158          unsigned int            __glibc_reserved4;
     159          unsigned int            __glibc_reserved5;
     160  # endif /* __USE_TIME_BITS64 */
     161  };
     162  #endif
     163  
     164  /* Tell code we have these members.  */
     165  #define _STATBUF_ST_BLKSIZE
     166  #define _STATBUF_ST_RDEV
     167  /* Nanosecond resolution time values are supported.  */
     168  #define _STATBUF_ST_NSEC
     169  
     170  #endif /* _BITS_STRUCT_STAT_H  */