Add new syscall stubs.
[pintos-anon] / src / lib / user / syscall.c
1 #include <syscall.h>
2 #include "syscall-stub.h"
3 #include "../syscall-nr.h"
4
5 void
6 halt (void)
7 {
8   syscall (SYS_halt);
9   NOT_REACHED ();
10 }
11
12 void
13 exit (int status)
14 {
15   syscall (SYS_exit, status);
16   NOT_REACHED ();
17 }
18
19 pid_t
20 exec (const char *file)
21 {
22   return syscall (SYS_exec, file);
23 }
24
25 int
26 join (pid_t pid)
27 {
28   return syscall (SYS_join, pid);
29 }
30
31 bool
32 create (const char *file)
33 {
34   return syscall (SYS_create, file);
35 }
36
37 bool
38 remove (const char *file)
39 {
40   return syscall (SYS_remove, file);
41 }
42
43 int
44 open (const char *file)
45 {
46   return syscall (SYS_open, file);
47 }
48
49 int
50 read (int fd, void *buffer, unsigned size)
51 {
52   return syscall (SYS_read, fd, buffer, size);
53 }
54
55 int
56 write (int fd, const void *buffer, unsigned size)
57 {
58   return syscall (SYS_write, fd, buffer, size);
59 }
60
61 void
62 close (int fd)
63 {
64   syscall (SYS_close, fd);
65 }
66
67 bool
68 mmap (int fd, void *addr, unsigned length)
69 {
70   return syscall (SYS_mmap, fd, addr, length);
71 }
72
73 bool
74 munmap (void *addr, unsigned length)
75 {
76   return syscall (SYS_munmap, addr, length);
77 }
78
79 bool
80 chdir (const char *dir)
81 {
82   return syscall (SYS_chdir, dir);
83 }
84
85 bool
86 mkdir (const char *dir)
87 {
88   return syscall (SYS_mkdir, dir);
89 }
90
91 void
92 lsdir (void)
93 {
94   syscall (SYS_lsdir);
95 }
96