summaryrefslogtreecommitdiffstats
path: root/pintos-progos/lib/user/syscall.h
diff options
context:
space:
mode:
Diffstat (limited to 'pintos-progos/lib/user/syscall.h')
-rw-r--r--pintos-progos/lib/user/syscall.h48
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. */
8typedef int pid_t;
9#define PID_ERROR ((pid_t) -1)
10
11/* Map region identifier. */
12typedef 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. */
23void halt (void) NO_RETURN;
24void exit (int status) NO_RETURN;
25pid_t exec (const char *cmd_line);
26int wait (pid_t);
27bool create (const char *file, unsigned initial_size);
28bool remove (const char *file);
29int open (const char *file);
30int filesize (int fd);
31int read (int fd, void *buffer, unsigned length);
32int write (int fd, const void *buffer, unsigned length);
33void seek (int fd, unsigned position);
34unsigned tell (int fd);
35void close (int fd);
36
37/* Project 3 and optionally project 4. */
38mapid_t mmap (int fd, void *addr);
39void munmap (mapid_t);
40
41/* Project 4 only. */
42bool chdir (const char *dir);
43bool mkdir (const char *dir);
44bool readdir (int fd, char name[READDIR_MAX_LEN + 1]);
45bool isdir (int fd);
46int inumber (int fd);
47
48#endif /* lib/user/syscall.h */