Usermode - Better separation of types and calls in sys.h
[tpg/acess2.git] / Usermode / include / sys / types.h
1 /*
2  */
3 #ifndef _SYS_TYPES_H
4 #define _SYS_TYPES_H
5 #include <stdint.h>
6
7 typedef struct {
8         int             st_dev;         //dev_t
9         int             st_ino;         //ino_t
10         int             st_mode;        //mode_t
11         unsigned int    st_nlink;
12         unsigned int    st_uid;
13         unsigned int    st_gid;
14         int             st_rdev;        //dev_t
15         unsigned int    st_size;
16         long    st_atime;       //time_t
17         long    st_mtime;
18         long    st_ctime;
19 } t_fstat;
20
21 #define S_IFMT          0170000 /* type of file */
22 #define         S_IFDIR 0040000 /* directory */
23 #define         S_IFCHR 0020000 /* character special */
24 #define         S_IFBLK 0060000 /* block special */
25 #define         S_IFREG 0100000 /* regular */
26 #define         S_IFLNK 0120000 /* symbolic link */
27 #define         S_IFSOCK        0140000 /* socket */
28 #define         S_IFIFO 0010000 /* fifo */
29
30 #define FD_SETSIZE      128
31
32
33 #define CLONE_VM        0x10
34
35 /**
36  * \brief fd_set for select()
37  */
38 typedef struct
39 {
40         uint16_t        flags[FD_SETSIZE/16];
41 }       fd_set;
42
43 struct s_sysACL {
44         union {
45                 struct {
46                         unsigned        group: 1;
47                         unsigned        id:     31;
48                 };
49                 uint32_t        object;
50         };
51         union {
52                 struct {
53                         unsigned        invert: 1;
54                         unsigned        perms:  31;
55                 };
56                 uint32_t        rawperms;
57         };
58 };
59 struct s_sysFInfo {
60         unsigned int    uid, gid;
61         unsigned int    flags;
62         uint64_t        size;
63         uint64_t        atime;
64         uint64_t        mtime;
65         uint64_t        ctime;
66          int    numacls;
67         struct s_sysACL acls[];
68 };
69 typedef struct s_sysFInfo       t_sysFInfo;
70 typedef struct s_sysACL t_sysACL;
71
72 static inline void FD_ZERO(fd_set *fdsetp) {int i=FD_SETSIZE/16;while(i--)fdsetp->flags[i]=0; }
73 static inline void FD_CLR(int fd, fd_set *fdsetp) { fdsetp->flags[fd/16]&=~(1<<(fd%16)); }
74 static inline void FD_SET(int fd, fd_set *fdsetp) { fdsetp->flags[fd/16]|=1<<(fd%16); }
75 static inline int FD_ISSET(int fd, fd_set *fdsetp) { return fdsetp->flags[fd/16]&(1<<(fd%16)); }
76
77 typedef uint32_t        pid_t;
78 typedef uint32_t        tid_t;
79 typedef  int64_t        time_t;
80
81 typedef unsigned int    uint;
82
83 #endif

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