diff --git a/user/user.h b/user/user.h index 8b3a1b6..1e56f3d 100644 --- a/user/user.h +++ b/user/user.h @@ -4,43 +4,121 @@ struct stat; -// system calls -int fork(void); -int exit(int) __attribute__((noreturn)); -int wait(int *); -int pipe(int *); -int write(int, const void *, int); -int read(int, void *, int); -int close(int); -int kill(int); -int exec(const char *, char **); -int open(const char *, int); -int mknod(const char *, short, short); -int unlink(const char *); -int fstat(int fd, struct stat *); -int link(const char *, const char *); -int mkdir(const char *); -int chdir(const char *); -int dup(int); -int getpid(void); -char *sbrk(int); -int sleep(int); -int uptime(void); -int trace(int); +/** + * System calls + */ -// ulib.c -int stat(const char *, struct stat *); +/** Create a child process */ +int fork(void); + +/** Exit (terminate) the calling process */ +int exit(int) __attribute__((noreturn)); + +/** Blocks the calling process until child process terminates. */ +int wait(int *); + +/** pipe */ +int pipe(int *); + +/** write */ +int write(int, const void *, int); + +/** read */ +int read(int, void *, int); + +/** close */ +int close(int); + +/** kill */ +int kill(int); + +/** exec */ +int exec(const char *, char **); + +/** open */ +int open(const char *, int); + +/** mknod */ +int mknod(const char *, short, short); + +/** unlink */ +int unlink(const char *); + +/** fstat */ +int fstat(int fd, struct stat *); + +/** link */ +int link(const char *, const char *); + +/** mkdir */ +int mkdir(const char *); + +/** chdir */ +int chdir(const char *); + +/** dup */ +int dup(int); + +/** getpid */ +int getpid(void); + +/** sbrk */ +char *sbrk(int); + +/** sleep */ +int sleep(int); + +/** uptime */ +int uptime(void); + +/** trace */ +int trace(int); + +/** + * Library functions (ulib.c) + */ + +/** stat */ +int stat(const char *, struct stat *); + +/** strcpy */ char *strcpy(char *, const char *); + +/** memmove */ void *memmove(void *, const void *, int); + +/** strchr */ char *strchr(const char *, char c); -int strcmp(const char *, const char *); -void fprintf(int, const char *, ...); -void printf(const char *, ...); + +/** strcmp */ +int strcmp(const char *, const char *); + +/** fprintf */ +void fprintf(int, const char *, ...); + +/** printf */ +void printf(const char *, ...); + +/** gets */ char *gets(char *, int max); -u32 strlen(const char *); + +/** strlen */ +u32 strlen(const char *); + +/** memset */ void *memset(void *, int, u32); + +/** malloc */ void *malloc(u32); -void free(void *); -int atoi(const char *); -int memcmp(const void *, const void *, u32); + +/** free */ +void free(void *); + +/** atoi */ +int atoi(const char *); + +/** memcmp */ +int memcmp(const void *, const void *, u32); + +/** memcpy */ void *memcpy(void *, const void *, u32);