void do_syscall(TrapFrame *tf) { int id = tf->eax; switch(id) { case SYS_fork: syscall_fork(tf); break; case SYS_exec: syscall_exec(tf); break; case SYS_exit: syscall_exit(tf); break; case SYS_getpid: syscall_getpid(tf); break; case SYS_waitpid: syscall_waitpid(tf); break; case SYS_puts1: printk((char*)(tf->ebx)); printk(" %d\n", current->pid); break; case SYS_puts: syscall_puts(tf); break; case SYS_read_line: syscall_read_line(tf); break; case SYS_sleep: syscall_sleep(tf); break; case SYS_open: syscall_open(tf); break; case SYS_read: syscall_read(tf); break; case SYS_write: syscall_write(tf); break; case SYS_create: syscall_create(tf); break; case SYS_close: syscall_close(tf); break; case SYS_delete: syscall_delete(tf); break; case SYS_lseek: syscall_lseek(tf); break; case SYS_dup: syscall_dup(tf); break; case SYS_dup2: syscall_dup2(tf); break; case SYS_mkdir: syscall_mkdir(tf); break; case SYS_rmdir: syscall_rmdir(tf); break; case SYS_lsdir: syscall_lsdir(tf); break; case SYS_chdir: syscall_chdir(tf); break; //default: panic("Unknown system call type"); } }
int waitpid(int pid, int *status, int options) { /* XXX: status, options? */ int i = syscall_waitpid(pid, status, options); if (i < 0) { errno = -i; return -1; } return i; }
int waitpid(int pid, int *status, int options) { /* XXX: status, options? */ __sets_errno(syscall_waitpid(pid, status, options)); }