340d1b15fea253155bbe30c50eb7bc9cb73ee383
[pintos-anon] / src / lib / user / syscall.h
1 #ifndef __LIB_USER_SYSCALL_H
2 #define __LIB_USER_SYSCALL_H
3
4 #include <stdbool.h>
5 #include <debug.h>
6
7 typedef int pid_t;
8 #define PID_ERROR ((pid_t) -1)
9
10 typedef int mapid_t;
11 #define MAP_FAILED ((mapid_t) -1)
12
13 #define READDIR_MAX_LEN 14
14
15 void halt (void) NO_RETURN;
16 void exit (int status) NO_RETURN;
17 pid_t exec (const char *file);
18 int wait (pid_t);
19 bool create (const char *file, unsigned initial_size);
20 bool remove (const char *file);
21 int open (const char *file);
22 int filesize (int fd);
23 int read (int fd, void *buffer, unsigned length);
24 int write (int fd, const void *buffer, unsigned length);
25 void seek (int fd, unsigned position);
26 unsigned tell (int fd);
27 void close (int fd);
28 mapid_t mmap (int fd, void *addr);
29 void munmap (mapid_t);
30 bool chdir (const char *dir);
31 bool mkdir (const char *dir);
32 bool readdir (int fd, char name[READDIR_MAX_LEN + 1]);
33 bool isdir (int fd);
34
35 #endif /* lib/user/syscall.h */