Usermode/libc - Fix strchr and strrchr behavior
[tpg/acess2.git] / Usermode / Libraries / libposix.so_src / include_exp / sys / stat.h
1 /*
2  * Acess2 POSIX Emulation Lib
3  * - By John Hodge (thePowersGang)
4  *
5  * sys/stat.h
6  * - stat(2)
7  */
8 #ifndef _SYS_STAT_H_
9 #define _SYS_STAT_H_
10
11 #include <stdint.h>
12 #include "sys/types.h"  // off_t
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 typedef void    *dev_t; /* TODO: How to identify a device with Acess */
19 typedef uint64_t        ino_t;
20 typedef unsigned int    blksize_t;
21 typedef uint64_t        blkcnt_t;
22 typedef unsigned int    nlink_t;
23 typedef uint32_t        mode_t;
24
25 #define S_IFMT          0170000 /* type of file */
26 #define         S_IFDIR 0040000 /* directory */
27 #define         S_IFCHR 0020000 /* character special */
28 #define         S_IFBLK 0060000 /* block special */
29 #define         S_IFREG 0100000 /* regular */
30 #define         S_IFLNK 0120000 /* symbolic link */
31 #define         S_IFSOCK        0140000 /* socket */
32 #define         S_IFIFO 0010000 /* fifo */
33
34 #define S_ISDIR(mode)   (((mode) & S_IFMT) == S_IFDIR)
35 #define S_ISREG(mode)   (((mode) & S_IFMT) == S_IFREG)
36 #define S_ISCHR(mode)   (((mode) & S_IFMT) == S_IFCHR)
37
38 struct stat
39 {
40         dev_t     st_dev;     /* ID of device containing file */
41         ino_t     st_ino;     /* inode number */
42         mode_t    st_mode;    /* protection */
43         nlink_t   st_nlink;   /* number of hard links */
44         uid_t     st_uid;     /* user ID of owner */
45         gid_t     st_gid;     /* group ID of owner */
46         dev_t     st_rdev;    /* device ID (if special file) */
47         off_t     st_size;    /* total size, in bytes */
48         blksize_t st_blksize; /* blocksize for file system I/O */
49         blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
50         time_t    st_atime;   /* time of last access */
51         time_t    st_mtime;   /* time of last modification */
52         time_t    st_ctime;   /* time of last status change */
53 };
54
55 extern int stat(const char *path, struct stat *buf);
56 extern int lstat(const char *path, struct stat *buf);
57 extern int fstat(int fd, struct stat *buf);
58 extern int mkdir(const char *pathname, mode_t mode);
59
60 #ifdef __cplusplus
61 }
62 #endif
63
64 #endif

UCC git Repository :: git.ucc.asn.au