2 * Acess2 POSIX Emulation Layer
17 //! \brief flags for open(2)
23 #define O_DIRECTORY 0x10
26 #define O_NOFOLLOW 0x80 // don't follow symlinks
28 #define O_NOCTTY 0 // unsupported
29 #define O_NONBLOCK 0x200
30 #define O_SYNC 0 // not supported
32 #define STDIN_FILENO 0
33 #define STDOUT_FILENO 1
34 #define STDERR_FILENO 2
36 typedef signed long ssize_t;
38 #include "sys/stat.h" // mode_t
40 extern int open(const char *path, int flags, ...);
41 extern int creat(const char *path, mode_t mode);
42 extern int close(int fd);
44 extern ssize_t write(int fd, const void *buf, size_t count);
45 extern ssize_t read(int fd, void *buf, size_t count);
46 extern off_t lseek(int fd, off_t offset, int whence);
48 extern int fork(void);
49 extern int execv(const char *b, char *v[]);
51 extern int dup2(int oldfd, int newfd);
53 extern int chown(const char *path, uid_t owner, gid_t group);
70 extern int chmod(const char *path, mode_t mode);
72 extern int unlink(const char *pathname);
74 extern int access(const char *pathname, int mode);
76 extern pid_t setsid(void);
78 extern uid_t getuid(void);
79 //extern int setuid(uid_t uid);
80 extern uid_t geteuid(void);
81 extern pid_t getpid(void);
82 extern int seteuid(uid_t euid);
83 extern int setegid(gid_t egid);
84 //extern int setgid(gid_t gid);
86 typedef uint32_t useconds_t;
88 extern unsigned int sleep(unsigned int seconds);
89 extern int usleep(useconds_t usec);
90 extern unsigned int alarm(unsigned int seconds);
93 extern char *crypt(const char *key, const char *salt);
96 extern char *ttyname(int fd);
97 extern int ttyname_r(int fd, char *buf, size_t buflen);
99 // signal.h / sys/types.h
100 extern int kill(pid_t pid, int sig);
102 extern int chdir(const char *dir);
103 extern int rmdir(const char *pathname);
105 // Deprecated POSIX.1-2001
107 extern char *getpass(const char *prompt);