master
  1/* Definition for struct stat.
  2   Copyright (C) 2020-2025 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#include <sgidefs.h>
 27
 28#if _MIPS_SIM == _ABIO32
 29/* Structure describing file characteristics.  */
 30struct stat
 31  {
 32# ifdef __USE_TIME64_REDIRECTS
 33#  include <bits/struct_stat_time64_helper.h>
 34# else
 35    unsigned long int st_dev;
 36    long int st_pad1[3];
 37#  ifndef __USE_FILE_OFFSET64
 38    __ino_t st_ino;		/* File serial number.		*/
 39#  else
 40    __ino64_t st_ino;		/* File serial number.		*/
 41#  endif
 42    __mode_t st_mode;		/* File mode.  */
 43    __nlink_t st_nlink;		/* Link count.  */
 44    __uid_t st_uid;		/* User ID of the file's owner.	*/
 45    __gid_t st_gid;		/* Group ID of the file's group.*/
 46    unsigned long int st_rdev;	/* Device number, if device.  */
 47#  ifndef __USE_FILE_OFFSET64
 48    long int st_pad2[2];
 49    __off_t st_size;		/* Size of file, in bytes.  */
 50    /* SVR4 added this extra long to allow for expansion of off_t.  */
 51    long int st_pad3;
 52#  else
 53    long int st_pad2[3];
 54    __off64_t st_size;		/* Size of file, in bytes.  */
 55#  endif
 56#  ifdef __USE_XOPEN2K8
 57    /* Nanosecond resolution timestamps are stored in a format
 58       equivalent to 'struct timespec'.  This is the type used
 59       whenever possible but the Unix namespace rules do not allow the
 60       identifier 'timespec' to appear in the <sys/stat.h> header.
 61       Therefore we have to handle the use of this header in strictly
 62       standard-compliant sources special.  */
 63    struct timespec st_atim;            /* Time of last access.  */
 64    struct timespec st_mtim;            /* Time of last modification.  */
 65    struct timespec st_ctim;            /* Time of last status change.  */
 66#   define st_atime st_atim.tv_sec        /* Backward compatibility.  */
 67#   define st_mtime st_mtim.tv_sec
 68#   define st_ctime st_ctim.tv_sec
 69#  else
 70    __time_t st_atime;			/* Time of last access.  */
 71    unsigned long int st_atimensec;	/* Nscecs of last access.  */
 72    __time_t st_mtime;			/* Time of last modification.  */
 73    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
 74    __time_t st_ctime;			/* Time of last status change.  */
 75    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
 76#  endif
 77    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
 78#  ifndef __USE_FILE_OFFSET64
 79    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
 80#  else
 81    long int st_pad4;
 82    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
 83#  endif
 84    long int st_pad5[14];
 85# endif /* __USE_TIME64_REDIRECTS  */
 86  };
 87
 88# ifdef __USE_LARGEFILE64
 89struct stat64
 90  {
 91#  ifdef __USE_TIME64_REDIRECTS
 92#   include <bits/struct_stat_time64_helper.h>
 93#  else
 94    unsigned long int st_dev;
 95    long int st_pad1[3];
 96    __ino64_t st_ino;		/* File serial number.		*/
 97    __mode_t st_mode;		/* File mode.  */
 98    __nlink_t st_nlink;		/* Link count.  */
 99    __uid_t st_uid;		/* User ID of the file's owner.	*/
100    __gid_t st_gid;		/* Group ID of the file's group.*/
101    unsigned long int st_rdev;	/* Device number, if device.  */
102    long int st_pad2[3];
103    __off64_t st_size;		/* Size of file, in bytes.  */
104#   ifdef __USE_XOPEN2K8
105    /* Nanosecond resolution timestamps are stored in a format
106       equivalent to 'struct timespec'.  This is the type used
107       whenever possible but the Unix namespace rules do not allow the
108       identifier 'timespec' to appear in the <sys/stat.h> header.
109       Therefore we have to handle the use of this header in strictly
110       standard-compliant sources special.  */
111    struct timespec st_atim;            /* Time of last access.  */
112    struct timespec st_mtim;            /* Time of last modification.  */
113    struct timespec st_ctim;            /* Time of last status change.  */
114#   else
115    __time_t st_atime;			/* Time of last access.  */
116    unsigned long int st_atimensec;	/* Nscecs of last access.  */
117    __time_t st_mtime;			/* Time of last modification.  */
118    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
119    __time_t st_ctime;			/* Time of last status change.  */
120    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
121#   endif
122    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
123    long int st_pad3;
124    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
125    long int st_pad4[14];
126#  endif /* __USE_TIME64_REDIRECTS  */
127  };
128# endif /* __USE_LARGEFILE64  */
129
130#else /* _MIPS_SIM != _ABIO32  */
131
132struct stat
133  {
134# ifdef __USE_TIME64_REDIRECTS
135#  include <bits/struct_stat_time64_helper.h>
136# else
137    __dev_t st_dev;
138    int	st_pad1[3];		/* Reserved for st_dev expansion  */
139#  ifndef __USE_FILE_OFFSET64
140    __ino_t st_ino;
141#  else
142    __ino64_t st_ino;
143#  endif
144    __mode_t st_mode;
145    __nlink_t st_nlink;
146    __uid_t st_uid;
147    __gid_t st_gid;
148    __dev_t st_rdev;
149#  if !defined __USE_FILE_OFFSET64
150    unsigned int st_pad2[2];	/* Reserved for st_rdev expansion  */
151    __off_t st_size;
152    int st_pad3;
153#  else
154    unsigned int st_pad2[3];	/* Reserved for st_rdev expansion  */
155    __off64_t st_size;
156#  endif
157#  ifdef __USE_XOPEN2K8
158    /* Nanosecond resolution timestamps are stored in a format
159       equivalent to 'struct timespec'.  This is the type used
160       whenever possible but the Unix namespace rules do not allow the
161       identifier 'timespec' to appear in the <sys/stat.h> header.
162       Therefore we have to handle the use of this header in strictly
163       standard-compliant sources special.  */
164    struct timespec st_atim;            /* Time of last access.  */
165    struct timespec st_mtim;            /* Time of last modification.  */
166    struct timespec st_ctim;            /* Time of last status change.  */
167#   define st_atime st_atim.tv_sec        /* Backward compatibility.  */
168#   define st_mtime st_mtim.tv_sec
169#   define st_ctime st_ctim.tv_sec
170#  else
171    __time_t st_atime;			/* Time of last access.  */
172    unsigned long int st_atimensec;	/* Nscecs of last access.  */
173    __time_t st_mtime;			/* Time of last modification.  */
174    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
175    __time_t st_ctime;			/* Time of last status change.  */
176    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
177#  endif
178    __blksize_t st_blksize;
179    unsigned int st_pad4;
180#  ifndef __USE_FILE_OFFSET64
181    __blkcnt_t st_blocks;
182#  else
183    __blkcnt64_t st_blocks;
184#  endif
185    int st_pad5[14];
186# endif
187  };
188
189#ifdef __USE_LARGEFILE64
190struct stat64
191  {
192# ifdef __USE_TIME64_REDIRECTS
193#  include <bits/struct_stat_time64_helper.h>
194# else
195    __dev_t st_dev;
196    unsigned int st_pad1[3];	/* Reserved for st_dev expansion  */
197    __ino64_t st_ino;
198    __mode_t st_mode;
199    __nlink_t st_nlink;
200    __uid_t st_uid;
201    __gid_t st_gid;
202    __dev_t st_rdev;
203    unsigned int st_pad2[3];	/* Reserved for st_rdev expansion  */
204    __off64_t st_size;
205#  ifdef __USE_XOPEN2K8
206    /* Nanosecond resolution timestamps are stored in a format
207       equivalent to 'struct timespec'.  This is the type used
208       whenever possible but the Unix namespace rules do not allow the
209       identifier 'timespec' to appear in the <sys/stat.h> header.
210       Therefore we have to handle the use of this header in strictly
211       standard-compliant sources special.  */
212    struct timespec st_atim;            /* Time of last access.  */
213    struct timespec st_mtim;            /* Time of last modification.  */
214    struct timespec st_ctim;            /* Time of last status change.  */
215#  else
216    __time_t st_atime;			/* Time of last access.  */
217    unsigned long int st_atimensec;	/* Nscecs of last access.  */
218    __time_t st_mtime;			/* Time of last modification.  */
219    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
220    __time_t st_ctime;			/* Time of last status change.  */
221    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
222#  endif
223    __blksize_t st_blksize;
224    unsigned int st_pad3;
225    __blkcnt64_t st_blocks;
226    int st_pad4[14];
227# endif /* __USE_TIME64_REDIRECTS  */
228};
229#endif
230
231#endif
232
233/* Tell code we have these members.  */
234#define	_STATBUF_ST_BLKSIZE
235#define	_STATBUF_ST_RDEV
236
237#endif /* _BITS_STRUCT_STAT_H  */