1 #ifndef __LIB_USER_SYSCALL_H
2 #define __LIB_USER_SYSCALL_H
7 /* Process identifier. */
9 #define PID_ERROR ((pid_t) -1)
11 /* Map region identifier. */
13 #define MAP_FAILED ((mapid_t) -1)
15 /* Maximum characters in a filename written by readdir(). */
16 #define READDIR_MAX_LEN 14
18 /* Typical return values from main() and arguments to exit(). */
19 #define EXIT_SUCCESS 0 /* Successful execution. */
20 #define EXIT_FAILURE 1 /* Unsuccessful execution. */
22 /* Projects 2 and later. */
23 void halt (void) NO_RETURN;
24 void exit (int status) NO_RETURN;
25 pid_t exec (const char *file);
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);
37 /* Project 3 and optionally project 4. */
38 mapid_t mmap (int fd, void *addr);
39 void munmap (mapid_t);
42 bool chdir (const char *dir);
43 bool mkdir (const char *dir);
44 bool readdir (int fd, char name[READDIR_MAX_LEN + 1]);
48 #endif /* lib/user/syscall.h */