diff options
Diffstat (limited to 'pintos-progos/lib/user/syscall.h')
| -rw-r--r-- | pintos-progos/lib/user/syscall.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pintos-progos/lib/user/syscall.h b/pintos-progos/lib/user/syscall.h new file mode 100644 index 0000000..a1bcf0b --- /dev/null +++ b/pintos-progos/lib/user/syscall.h | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | #ifndef __LIB_USER_SYSCALL_H | ||
| 2 | #define __LIB_USER_SYSCALL_H | ||
| 3 | |||
| 4 | #include <stdbool.h> | ||
| 5 | #include <debug.h> | ||
| 6 | |||
| 7 | /* Process identifier. */ | ||
| 8 | typedef int pid_t; | ||
| 9 | #define PID_ERROR ((pid_t) -1) | ||
| 10 | |||
| 11 | /* Map region identifier. */ | ||
| 12 | typedef int mapid_t; | ||
| 13 | #define MAP_FAILED ((mapid_t) -1) | ||
| 14 | |||
| 15 | /* Maximum characters in a filename written by readdir(). */ | ||
| 16 | #define READDIR_MAX_LEN 14 | ||
| 17 | |||
| 18 | /* Typical return values from main() and arguments to exit(). */ | ||
| 19 | #define EXIT_SUCCESS 0 /* Successful execution. */ | ||
| 20 | #define EXIT_FAILURE 1 /* Unsuccessful execution. */ | ||
| 21 | |||
| 22 | /* Projects 2 and later. */ | ||
| 23 | void halt (void) NO_RETURN; | ||
| 24 | void exit (int status) NO_RETURN; | ||
| 25 | pid_t exec (const char *cmd_line); | ||
| 26 | int wait (pid_t); | ||
| 27 | bool create (const char *file, unsigned initial_size); | ||
| 28 | bool remove (const char *file); | ||
| 29 | int open (const char *file); | ||
| 30 | int filesize (int fd); | ||
| 31 | int read (int fd, void *buffer, unsigned length); | ||
| 32 | int write (int fd, const void *buffer, unsigned length); | ||
| 33 | void seek (int fd, unsigned position); | ||
| 34 | unsigned tell (int fd); | ||
| 35 | void close (int fd); | ||
| 36 | |||
| 37 | /* Project 3 and optionally project 4. */ | ||
| 38 | mapid_t mmap (int fd, void *addr); | ||
| 39 | void munmap (mapid_t); | ||
| 40 | |||
| 41 | /* Project 4 only. */ | ||
| 42 | bool chdir (const char *dir); | ||
| 43 | bool mkdir (const char *dir); | ||
| 44 | bool readdir (int fd, char name[READDIR_MAX_LEN + 1]); | ||
| 45 | bool isdir (int fd); | ||
| 46 | int inumber (int fd); | ||
| 47 | |||
| 48 | #endif /* lib/user/syscall.h */ | ||
