2 * Acess2 System Interface Header
8 #include "../sys/types.h"
12 # define NULL ((void*)0)
15 #define THREAD_EVENT_VFS 0x0001
16 #define THREAD_EVENT_IPCMSG 0x0002
17 #define THREAD_EVENT_SIGNAL 0x0004
19 #define OPENFLAG_EXEC 0x01
20 #define OPENFLAG_READ 0x02
21 #define OPENFLAG_WRITE 0x04
22 #define OPENFLAG_NOLINK 0x40
23 #define OPENFLAG_CREATE 0x80
29 #define GETMSG_IGNORE ((void*)-1)
30 #define FILEFLAG_DIRECTORY 0x10
31 #define FILEFLAG_SYMLINK 0x20
39 extern void _SysDebug(const char *format, ...);
41 extern void _exit(int status) __attribute__((noreturn));
42 extern void sleep(void);
43 extern void yield(void);
44 extern int kill(int pid, int sig);
45 //extern void wait(int miliseconds);
46 extern int _SysWaitEvent(int EventMask);
47 extern int waittid(int id, int *status);
48 extern int clone(int flags, void *stack);
49 extern int execve(char *path, char **argv, char **envp);
50 extern int _SysSpawn(const char *Path, const char **argv, const char **envp, int nFDs, int *FDs);
51 extern int gettid(void);
52 extern int getpid(void);
53 extern int _SysSetFaultHandler(int (*Handler)(int));
54 extern void SysSetName(const char *Name);
55 //extern int SysGetName(const char *Name);
57 // --- Permissions ---
58 extern int getuid(void);
59 extern int getgid(void);
60 extern void setuid(int id);
61 extern void setgid(int id);
64 extern int chdir(const char *dir);
65 extern int open(const char *path, int flags, ...);
66 extern int reopen(int fd, const char *path, int flags);
67 extern int close(int fd);
68 extern uint read(int fd, void *buffer, uint length);
69 extern uint write(int fd, const void *buffer, uint length);
70 extern int seek(int fd, int64_t offset, int whence);
71 extern uint64_t tell(int fd);
72 extern int ioctl(int fd, int id, void *data);
73 extern int finfo(int fd, t_sysFInfo *info, int maxacls);
74 extern int readdir(int fd, char *dest);
75 extern int _SysOpenChild(int fd, char *name, int flags);
76 extern int _SysGetACL(int fd, t_sysACL *dest);
77 extern int _SysMount(const char *Device, const char *Directory, const char *Type, const char *Options);
78 extern int _SysSelect(int nfds, fd_set *read, fd_set *write, fd_set *err, time_t *timeout, int extraevents);
79 #define select(nfs, rdfds, wrfds, erfds, timeout) _SysSelect(nfs, rdfds, wrfds, erfds, timeout, 0)
82 extern int SysSendMessage(pid_t dest, uint length, const void *Data);
83 extern int SysGetMessage(pid_t *src, void *Data);
86 uint64_t _SysGetPhys(uint vaddr);
87 uint64_t _SysAllocate(uint vaddr);