00001 #ifndef __LIB_USER_SYSCALL_H
00002 #define __LIB_USER_SYSCALL_H
00003
00004 #include <stdbool.h>
00005 #include <debug.h>
00006
00007
00008 typedef int pid_t;
00009 #define PID_ERROR ((pid_t) -1)
00010
00011
00012 typedef int mapid_t;
00013 #define MAP_FAILED ((mapid_t) -1)
00014
00015
00016 #define READDIR_MAX_LEN 14
00017
00018
00019 #define EXIT_SUCCESS 0
00020 #define EXIT_FAILURE 1
00021
00022
00023 void halt (void) NO_RETURN;
00024 void exit (int status) NO_RETURN;
00025 pid_t exec (const char *file);
00026 int wait (pid_t);
00027 bool create (const char *file, unsigned initial_size);
00028 bool remove (const char *file);
00029 int open (const char *file);
00030 int filesize (int fd);
00031 int read (int fd, void *buffer, unsigned length);
00032 int write (int fd, const void *buffer, unsigned length);
00033 void seek (int fd, unsigned position);
00034 unsigned tell (int fd);
00035 void close (int fd);
00036
00037
00038 mapid_t mmap (int fd, void *addr);
00039 void munmap (mapid_t);
00040
00041
00042 bool chdir (const char *dir);
00043 bool mkdir (const char *dir);
00044 bool readdir (int fd, char name[READDIR_MAX_LEN + 1]);
00045 bool isdir (int fd);
00046 int inumber (int fd);
00047
00048 #endif