aboutsummaryrefslogtreecommitdiff
path: root/include/sys.h
blob: e7573bf76ca24a1b14f054e5dc2149aa79de5801 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once

#include <arch/constants.h>
#include <arch/errno.h>

// -----------------------------------------------------------------------
// global constants

/* open */
#define sys·ORead    0x0u
#define sys·OWrite   0x1u
#define sys·ORdwr    0x2u

/* seek */
#define sys·SeekSet  0u
#define sys·SeekCur  1u
#define sys·SeekEnd  2u

// -----------------------------------------------------------------------
// functions

char *sys·errormsg(int num);

/* file operations */
int sys·open(char *path, int flag, int mode, int *fd);
int sys·close(int fd);
int sys·write(int fd, uintptr len, void *buf, intptr *nw);
int sys·read(int fd, uintptr len, void *buf, intptr *nr);
int sys·seek(int fd, intptr offset, int from, intptr *pos);
int sys·dup(int from, int to);

/* directory operations */
int sys·chdirfd(int fd);
int sys·chdir(char *path);
int sys·direntry(int fd, int len, void *buffer, uintptr *size);

/* process operations */
int sys·fork(void);
int sys·exec(char *program, char *argv[], char *env[]);

/* memory operations */
int sys·brk(void *addr);
int sys·sbrk(intptr delta, void **ret);

int sys·mmap(void *addr, uintptr len, int prot, int flags, int fd, intptr off, void **ret);
int sys·mremap(void *old, uintptr from, uintptr to, int flags, void **new);
int sys·munmap(void *addr, uintptr len);
int sys·madvise(void *addr, uintptr len, int advice);
int sys·mprotect(void *addr, uintptr len, int prot);
int sys·mlock(void *addr, uintptr len);
int sys·munlock(void *addr, uintptr len);