From 6628897dbfc4d34e56277959db986487bfb8af53 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 7 May 2011 21:40:23 +0800 Subject: [PATCH] Usermode - Better separation of types and calls in sys.h --- Usermode/include/acess/sys.h | 31 +------------------------------ Usermode/include/sys/types.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/Usermode/include/acess/sys.h b/Usermode/include/acess/sys.h index 35f582d8..fd219bca 100644 --- a/Usermode/include/acess/sys.h +++ b/Usermode/include/acess/sys.h @@ -5,7 +5,7 @@ #define _ACESS_SYS_H_ #include -#include +#include "../sys/types.h" // === CONSTANTS === #ifndef NULL @@ -22,40 +22,11 @@ # define SEEK_CUR 0 # define SEEK_END -1 #endif -#define CLONE_VM 0x10 #define GETMSG_IGNORE ((void*)-1) #define FILEFLAG_DIRECTORY 0x10 #define FILEFLAG_SYMLINK 0x20 // === TYPES === -struct s_sysACL { - union { - struct { - unsigned group: 1; - unsigned id: 31; - }; - uint32_t object; - }; - union { - struct { - unsigned invert: 1; - unsigned perms: 31; - }; - uint32_t rawperms; - }; -}; -struct s_sysFInfo { - uint uid, gid; - uint flags; - uint64_t size; - uint64_t atime; - uint64_t mtime; - uint64_t ctime; - int numacls; - struct s_sysACL acls[]; -}; -typedef struct s_sysFInfo t_sysFInfo; -typedef struct s_sysACL t_sysACL; // === VARIABLES === extern int _errno; diff --git a/Usermode/include/sys/types.h b/Usermode/include/sys/types.h index 92e27917..a1ed85b7 100644 --- a/Usermode/include/sys/types.h +++ b/Usermode/include/sys/types.h @@ -29,6 +29,9 @@ typedef struct { #define FD_SETSIZE 128 + +#define CLONE_VM 0x10 + /** * \brief fd_set for select() */ @@ -37,6 +40,35 @@ typedef struct uint16_t flags[FD_SETSIZE/16]; } fd_set; +struct s_sysACL { + union { + struct { + unsigned group: 1; + unsigned id: 31; + }; + uint32_t object; + }; + union { + struct { + unsigned invert: 1; + unsigned perms: 31; + }; + uint32_t rawperms; + }; +}; +struct s_sysFInfo { + unsigned int uid, gid; + unsigned int flags; + uint64_t size; + uint64_t atime; + uint64_t mtime; + uint64_t ctime; + int numacls; + struct s_sysACL acls[]; +}; +typedef struct s_sysFInfo t_sysFInfo; +typedef struct s_sysACL t_sysACL; + static inline void FD_ZERO(fd_set *fdsetp) {int i=FD_SETSIZE/16;while(i--)fdsetp->flags[i]=0; } static inline void FD_CLR(int fd, fd_set *fdsetp) { fdsetp->flags[fd/16]&=~(1<<(fd%16)); } static inline void FD_SET(int fd, fd_set *fdsetp) { fdsetp->flags[fd/16]|=1<<(fd%16); } @@ -46,4 +78,6 @@ typedef uint32_t pid_t; typedef uint32_t tid_t; typedef int64_t time_t; +typedef unsigned int uint; + #endif -- 2.20.1