2012-02-21 18:30:34 -05:00
|
|
|
/*******************************************************************************
|
|
|
|
|
2014-01-03 16:20:52 -05:00
|
|
|
Copyright(C) Jonas 'Sortie' Termansen 2012, 2013, 2014.
|
2012-02-21 18:30:34 -05:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
This file is part of Sortix.
|
2012-02-21 18:30:34 -05:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
Sortix is free software: you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
version.
|
2012-02-21 18:30:34 -05:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
Sortix is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
details.
|
2012-02-21 18:30:34 -05:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
Sortix. If not, see <http://www.gnu.org/licenses/>.
|
2012-02-21 18:30:34 -05:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
sortix/stat.h
|
|
|
|
Defines the struct stat used for file meta-information and other useful
|
|
|
|
macros and values relating to values stored in it.
|
2012-02-21 18:30:34 -05:00
|
|
|
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2013-03-22 15:19:45 -04:00
|
|
|
#ifndef INCLUDE_SORTIX_STAT_H
|
|
|
|
#define INCLUDE_SORTIX_STAT_H
|
2012-02-21 18:30:34 -05:00
|
|
|
|
2013-10-13 07:04:27 -04:00
|
|
|
#include <sys/cdefs.h>
|
2013-09-23 10:37:33 -04:00
|
|
|
|
2012-08-07 18:19:44 -04:00
|
|
|
#include <sys/types.h>
|
2014-01-03 16:20:52 -05:00
|
|
|
|
|
|
|
#include <sortix/__/dirent.h>
|
|
|
|
#include <sortix/__/dt.h>
|
|
|
|
#include <sortix/__/stat.h>
|
|
|
|
|
2013-03-22 15:19:45 -04:00
|
|
|
#include <sortix/timespec.h>
|
2012-02-21 18:30:34 -05:00
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
|
|
struct stat
|
|
|
|
{
|
2012-03-04 10:48:24 -05:00
|
|
|
dev_t st_dev;
|
2013-03-22 15:19:45 -04:00
|
|
|
dev_t st_rdev;
|
2012-02-21 18:30:34 -05:00
|
|
|
ino_t st_ino;
|
|
|
|
mode_t st_mode;
|
|
|
|
nlink_t st_nlink;
|
|
|
|
uid_t st_uid;
|
|
|
|
gid_t st_gid;
|
|
|
|
off_t st_size;
|
2013-03-22 15:19:45 -04:00
|
|
|
struct timespec st_atim;
|
|
|
|
struct timespec st_mtim;
|
|
|
|
struct timespec st_ctim;
|
2012-02-21 18:30:34 -05:00
|
|
|
blksize_t st_blksize;
|
|
|
|
blkcnt_t st_blocks;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define S_IXOTH 01
|
|
|
|
#define S_IWOTH 02
|
|
|
|
#define S_IROTH 03
|
|
|
|
#define S_IRWXO 07
|
|
|
|
#define S_IXGRP 010
|
|
|
|
#define S_IWGRP 020
|
|
|
|
#define S_IRGRP 040
|
|
|
|
#define S_IRWXG 070
|
|
|
|
#define S_IXUSR 0100
|
|
|
|
#define S_IWUSR 0200
|
|
|
|
#define S_IRUSR 0400
|
|
|
|
#define S_IRWXU 0700
|
2014-01-03 16:20:52 -05:00
|
|
|
#define S_IFMT __DTTOIF(__DT_BITS)
|
|
|
|
#define S_IFSOCK __DTTOIF(__DT_SOCK)
|
|
|
|
#define S_IFLNK __DTTOIF(__DT_LNK)
|
|
|
|
#define S_IFREG __DTTOIF(__DT_REG)
|
|
|
|
#define S_IFBLK __DTTOIF(__DT_BLK)
|
|
|
|
#define S_IFDIR __DTTOIF(__DT_DIR)
|
|
|
|
#define S_IFCHR __DTTOIF(__DT_CHR)
|
|
|
|
#define S_IFIFO __DTTOIF(__DT_FIFO)
|
2012-03-23 14:36:51 -04:00
|
|
|
/* Intentionally not part of Sortix. */
|
|
|
|
/*#define S_ISUID 0x0800 */
|
|
|
|
/*#define S_ISGID 0x0400 */
|
|
|
|
#define S_ISVTX 0x0200
|
2012-08-07 18:19:44 -04:00
|
|
|
#define S_SETABLE (0777 | 0x0200 | 0x0400 | 0x0800)
|
2014-01-03 16:20:52 -05:00
|
|
|
#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
|
|
|
|
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
|
|
|
|
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
|
|
|
#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
|
|
|
|
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
|
|
|
#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
|
|
|
|
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
|
2012-02-21 18:30:34 -05:00
|
|
|
|
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif
|