-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.h
59 lines (54 loc) · 1.46 KB
/
user.h
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
52
53
54
55
56
57
58
59
struct stat;
struct rtcdate;
typedef struct lock{
uint locked; // locked or not?
}tlock;
// system calls
int fork(void);
int exit(void) __attribute__((noreturn));
int wait(void);
int pipe(int*);
int write(int, const void*, int);
int read(int, void*, int);
int close(int);
int kill(int);
int exec(char*, char**);
int open(const char*, int);
int mknod(const char*, short, short);
int unlink(const char*);
int fstat(int fd, struct stat*);
int link(const char*, const char*);
int mkdir(const char*);
int chdir(const char*);
int dup(int);
int getpid(void);
char* sbrk(int);
int sleep(int);
int uptime(void);
int clone(void(*fcn)(void *, void *), void *arg1, void *arg2, void *stack, int flags);
int join(void **stack);
int gettid(void);
int tgkill(int, int);
// ulib.c
int stat(const char*, struct stat*);
char* strcpy(char*, const char*);
void *memmove(void*, const void*, int);
char* strchr(const char*, char c);
int strcmp(const char*, const char*);
void printf(int, const char*, ...);
char* gets(char*, int max);
uint strlen(const char*);
void* memset(void*, int, uint);
void* malloc(uint);
void free(void*);
int atoi(const char*);
int thread_create(void(*start_routine)(void *, void *), void *arg1, void *arg2);
int thread_join();
int lock_init(tlock *lk);
void lock_acquire(tlock *lk);
void lock_release(tlock *lk);
#define CLONE_FS 0x00000001
#define CLONE_FILES 0x00000010
#define CLONE_THREAD 0x00000100
#define CLONE_PARENT 0x00001000
#define CLONE_VM 0x00010000