2 * Acess2 POSIX Emulation Layer
13 //! \brief flags for open(2)
19 #define O_DIRECTORY 0x10
22 #define O_NOFOLLOW 0x80 // don't follow symlinks
24 #define O_NOCTTY 0 // unsupported
25 #define O_NONBLOCK 0x200
26 #define O_SYNC 0 // not supported
28 #define STDIN_FILENO 0
29 #define STDOUT_FILENO 1
30 #define STDERR_FILENO 2
32 typedef signed long ssize_t;
34 #include "sys/stat.h" // mode_t
36 extern int open(const char *path, int flags, ...);
37 extern int creat(const char *path, mode_t mode);
38 extern int close(int fd);
40 extern ssize_t write(int fd, const void *buf, size_t count);
41 extern ssize_t read(int fd, void *buf, size_t count);
42 extern off_t lseek(int fd, off_t offset, int whence);
44 extern int fork(void);
45 extern int execv(const char *b, char *v[]);
47 extern int dup2(int oldfd, int newfd);
49 extern int chown(const char *path, uid_t owner, gid_t group);
66 extern int chmod(const char *path, mode_t mode);
68 extern pid_t setsid(void);
70 extern uid_t getuid(void);
71 //extern int setuid(uid_t uid);
72 extern uid_t geteuid(void);
73 extern pid_t getpid(void);
74 extern int seteuid(uid_t euid);
75 extern int setegid(gid_t egid);
76 //extern int setgid(gid_t gid);
78 typedef uint32_t useconds_t;
80 extern unsigned int sleep(unsigned int seconds);
81 extern int usleep(useconds_t usec);
84 extern char *crypt(const char *key, const char *salt);
87 // signal.h / sys/types.h
88 extern int kill(pid_t pid, int sig);
90 extern int chdir(const char *dir);
91 extern int rmdir(const char *pathname);
93 // Deprecated POSIX.1-2001
95 extern char *getpass(const char *prompt);