|
Packit |
6c4009 |
/* Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if !defined _SYS_STAT_H && !defined _FCNTL_H
|
|
Packit |
6c4009 |
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef _BITS_STAT_H
|
|
Packit |
6c4009 |
#define _BITS_STAT_H 1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Versions of the `struct stat' data structure. */
|
|
Packit |
6c4009 |
#ifndef __x86_64__
|
|
Packit |
6c4009 |
# define _STAT_VER_LINUX_OLD 1
|
|
Packit |
6c4009 |
# define _STAT_VER_KERNEL 1
|
|
Packit |
6c4009 |
# define _STAT_VER_SVR4 2
|
|
Packit |
6c4009 |
# define _STAT_VER_LINUX 3
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* i386 versions of the `xmknod' interface. */
|
|
Packit |
6c4009 |
# define _MKNOD_VER_LINUX 1
|
|
Packit |
6c4009 |
# define _MKNOD_VER_SVR4 2
|
|
Packit |
6c4009 |
# define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define _STAT_VER_KERNEL 0
|
|
Packit |
6c4009 |
# define _STAT_VER_LINUX 1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* x86-64 versions of the `xmknod' interface. */
|
|
Packit |
6c4009 |
# define _MKNOD_VER_LINUX 0
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define _STAT_VER _STAT_VER_LINUX
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct stat
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
__dev_t st_dev; /* Device. */
|
|
Packit |
6c4009 |
#ifndef __x86_64__
|
|
Packit |
6c4009 |
unsigned short int __pad1;
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#if defined __x86_64__ || !defined __USE_FILE_OFFSET64
|
|
Packit |
6c4009 |
__ino_t st_ino; /* File serial number. */
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
__ino_t __st_ino; /* 32bit file serial number. */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#ifndef __x86_64__
|
|
Packit |
6c4009 |
__mode_t st_mode; /* File mode. */
|
|
Packit |
6c4009 |
__nlink_t st_nlink; /* Link count. */
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
__nlink_t st_nlink; /* Link count. */
|
|
Packit |
6c4009 |
__mode_t st_mode; /* File mode. */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
__uid_t st_uid; /* User ID of the file's owner. */
|
|
Packit |
6c4009 |
__gid_t st_gid; /* Group ID of the file's group.*/
|
|
Packit |
6c4009 |
#ifdef __x86_64__
|
|
Packit |
6c4009 |
int __pad0;
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
__dev_t st_rdev; /* Device number, if device. */
|
|
Packit |
6c4009 |
#ifndef __x86_64__
|
|
Packit |
6c4009 |
unsigned short int __pad2;
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#if defined __x86_64__ || !defined __USE_FILE_OFFSET64
|
|
Packit |
6c4009 |
__off_t st_size; /* Size of file, in bytes. */
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
__off64_t st_size; /* Size of file, in bytes. */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
__blksize_t st_blksize; /* Optimal block size for I/O. */
|
|
Packit |
6c4009 |
#if defined __x86_64__ || !defined __USE_FILE_OFFSET64
|
|
Packit |
6c4009 |
__blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#ifdef __USE_XOPEN2K8
|
|
Packit |
6c4009 |
/* Nanosecond resolution timestamps are stored in a format
|
|
Packit |
6c4009 |
equivalent to 'struct timespec'. This is the type used
|
|
Packit |
6c4009 |
whenever possible but the Unix namespace rules do not allow the
|
|
Packit |
6c4009 |
identifier 'timespec' to appear in the <sys/stat.h> header.
|
|
Packit |
6c4009 |
Therefore we have to handle the use of this header in strictly
|
|
Packit |
6c4009 |
standard-compliant sources special. */
|
|
Packit |
6c4009 |
struct timespec st_atim; /* Time of last access. */
|
|
Packit |
6c4009 |
struct timespec st_mtim; /* Time of last modification. */
|
|
Packit |
6c4009 |
struct timespec st_ctim; /* Time of last status change. */
|
|
Packit |
6c4009 |
# define st_atime st_atim.tv_sec /* Backward compatibility. */
|
|
Packit |
6c4009 |
# define st_mtime st_mtim.tv_sec
|
|
Packit |
6c4009 |
# define st_ctime st_ctim.tv_sec
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
__time_t st_atime; /* Time of last access. */
|
|
Packit |
6c4009 |
__syscall_ulong_t st_atimensec; /* Nscecs of last access. */
|
|
Packit |
6c4009 |
__time_t st_mtime; /* Time of last modification. */
|
|
Packit |
6c4009 |
__syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */
|
|
Packit |
6c4009 |
__time_t st_ctime; /* Time of last status change. */
|
|
Packit |
6c4009 |
__syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#ifdef __x86_64__
|
|
Packit |
6c4009 |
__syscall_slong_t __glibc_reserved[3];
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# ifndef __USE_FILE_OFFSET64
|
|
Packit |
6c4009 |
unsigned long int __glibc_reserved4;
|
|
Packit |
6c4009 |
unsigned long int __glibc_reserved5;
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
__ino64_t st_ino; /* File serial number. */
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __USE_LARGEFILE64
|
|
Packit |
6c4009 |
/* Note stat64 has the same shape as stat for x86-64. */
|
|
Packit |
6c4009 |
struct stat64
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
__dev_t st_dev; /* Device. */
|
|
Packit |
6c4009 |
# ifdef __x86_64__
|
|
Packit |
6c4009 |
__ino64_t st_ino; /* File serial number. */
|
|
Packit |
6c4009 |
__nlink_t st_nlink; /* Link count. */
|
|
Packit |
6c4009 |
__mode_t st_mode; /* File mode. */
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
unsigned int __pad1;
|
|
Packit |
6c4009 |
__ino_t __st_ino; /* 32bit file serial number. */
|
|
Packit |
6c4009 |
__mode_t st_mode; /* File mode. */
|
|
Packit |
6c4009 |
__nlink_t st_nlink; /* Link count. */
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
__uid_t st_uid; /* User ID of the file's owner. */
|
|
Packit |
6c4009 |
__gid_t st_gid; /* Group ID of the file's group.*/
|
|
Packit |
6c4009 |
# ifdef __x86_64__
|
|
Packit |
6c4009 |
int __pad0;
|
|
Packit |
6c4009 |
__dev_t st_rdev; /* Device number, if device. */
|
|
Packit |
6c4009 |
__off_t st_size; /* Size of file, in bytes. */
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
__dev_t st_rdev; /* Device number, if device. */
|
|
Packit |
6c4009 |
unsigned int __pad2;
|
|
Packit |
6c4009 |
__off64_t st_size; /* Size of file, in bytes. */
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
__blksize_t st_blksize; /* Optimal block size for I/O. */
|
|
Packit |
6c4009 |
__blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
|
|
Packit |
6c4009 |
# ifdef __USE_XOPEN2K8
|
|
Packit |
6c4009 |
/* Nanosecond resolution timestamps are stored in a format
|
|
Packit |
6c4009 |
equivalent to 'struct timespec'. This is the type used
|
|
Packit |
6c4009 |
whenever possible but the Unix namespace rules do not allow the
|
|
Packit |
6c4009 |
identifier 'timespec' to appear in the <sys/stat.h> header.
|
|
Packit |
6c4009 |
Therefore we have to handle the use of this header in strictly
|
|
Packit |
6c4009 |
standard-compliant sources special. */
|
|
Packit |
6c4009 |
struct timespec st_atim; /* Time of last access. */
|
|
Packit |
6c4009 |
struct timespec st_mtim; /* Time of last modification. */
|
|
Packit |
6c4009 |
struct timespec st_ctim; /* Time of last status change. */
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
__time_t st_atime; /* Time of last access. */
|
|
Packit |
6c4009 |
__syscall_ulong_t st_atimensec; /* Nscecs of last access. */
|
|
Packit |
6c4009 |
__time_t st_mtime; /* Time of last modification. */
|
|
Packit |
6c4009 |
__syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */
|
|
Packit |
6c4009 |
__time_t st_ctime; /* Time of last status change. */
|
|
Packit |
6c4009 |
__syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
# ifdef __x86_64__
|
|
Packit |
6c4009 |
__syscall_slong_t __glibc_reserved[3];
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
__ino64_t st_ino; /* File serial number. */
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Tell code we have these members. */
|
|
Packit |
6c4009 |
#define _STATBUF_ST_BLKSIZE
|
|
Packit |
6c4009 |
#define _STATBUF_ST_RDEV
|
|
Packit |
6c4009 |
/* Nanosecond resolution time values are supported. */
|
|
Packit |
6c4009 |
#define _STATBUF_ST_NSEC
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Encoding of the file mode. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define __S_IFMT 0170000 /* These bits determine file type. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* File types. */
|
|
Packit |
6c4009 |
#define __S_IFDIR 0040000 /* Directory. */
|
|
Packit |
6c4009 |
#define __S_IFCHR 0020000 /* Character device. */
|
|
Packit |
6c4009 |
#define __S_IFBLK 0060000 /* Block device. */
|
|
Packit |
6c4009 |
#define __S_IFREG 0100000 /* Regular file. */
|
|
Packit |
6c4009 |
#define __S_IFIFO 0010000 /* FIFO. */
|
|
Packit |
6c4009 |
#define __S_IFLNK 0120000 /* Symbolic link. */
|
|
Packit |
6c4009 |
#define __S_IFSOCK 0140000 /* Socket. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* POSIX.1b objects. Note that these macros always evaluate to zero. But
|
|
Packit |
6c4009 |
they do it by enforcing the correct use of the macros. */
|
|
Packit |
6c4009 |
#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
|
|
Packit |
6c4009 |
#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
|
|
Packit |
6c4009 |
#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Protection bits. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define __S_ISUID 04000 /* Set user ID on execution. */
|
|
Packit |
6c4009 |
#define __S_ISGID 02000 /* Set group ID on execution. */
|
|
Packit |
6c4009 |
#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
|
|
Packit |
6c4009 |
#define __S_IREAD 0400 /* Read by owner. */
|
|
Packit |
6c4009 |
#define __S_IWRITE 0200 /* Write by owner. */
|
|
Packit |
6c4009 |
#define __S_IEXEC 0100 /* Execute by owner. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __USE_ATFILE
|
|
Packit |
6c4009 |
# define UTIME_NOW ((1l << 30) - 1l)
|
|
Packit |
6c4009 |
# define UTIME_OMIT ((1l << 30) - 2l)
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif /* bits/stat.h */
|