05f717b1018b57e6e675e39b7dbe3ab68d2f053a
[tpg/acess2.git] / Usermode / include / acess / sys.h
1 /*
2  * Acess2 System Interface Header
3  */
4 #ifndef _SYS_SYS_H_
5 #define _SYS_SYS_H_
6
7 #include <stdint.h>
8
9 // === CONSTANTS ===
10 #define OPENFLAG_EXEC   0x01
11 #define OPENFLAG_READ   0x02
12 #define OPENFLAG_WRITE  0x04
13 #define OPENFLAG_NOLINK 0x40
14 #define SEEK_SET        1
15 #define SEEK_CUR        0
16 #define SEEK_END        -1
17 #define CLONE_VM        0x10
18 #define FILEFLAG_DIRECTORY      0x10
19 #define FILEFLAG_SYMLINK        0x20
20
21 // === TYPES ===
22 struct s_sysACL {
23         uint32_t        object;
24         uint32_t        perms;
25 };
26 struct s_sysFInfo {
27         uint    uid, gid;
28         uint    flags;
29         uint64_t        size;
30         uint64_t        atime;
31         uint64_t        mtime;
32         uint64_t        ctime;
33          int    numacls;
34         struct s_sysACL acls[];
35 };
36 typedef struct s_sysFInfo       t_sysFInfo;
37
38 // === FUNCTIONS ===
39 void    _SysDebug(char *str, ...);
40 // --- Proc ---
41 void    sleep();
42 void    wait(int miliseconds);
43  int    waittid(int id, int *status);
44  int    clone(int flags, void *stack);
45  int    execve(char *path, char **argv, char **envp);
46 // --- VFS ---
47  int    open(char *path, int flags);
48  int    reopen(int fd, char *path, int flags);
49 void    close(int fd);
50 uint64_t        read(int fd, uint64_t length, void *buffer);
51 uint64_t        write(int fd, uint64_t length, void *buffer);
52  int    seek(int fd, uint64_t offset, int whence);
53  int    ioctl(int fd, int id, void *data);
54  int    finfo(int fd, t_sysFInfo *info, int maxacls);
55  int    readdir(int fd, char *dest);
56
57 // --- MEMORY ---
58 uint64_t        _SysGetPhys(uint vaddr);
59 uint64_t        _SysAllocate(uint vaddr);
60
61 #endif

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