12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #include <types.h>
- #include <kern/errno.h>
- #include <kern/unistd.h>
- #include <kern/wait.h>
- #include <lib.h>
- #include <syscall.h>
- #include <current.h>
- #include <proc.h>
- #include <thread.h>
- #include <addrspace.h>
- #include <copyinout.h>
-
-
- void sys__exit(int exitcode) {
- struct addrspace *as;
- struct proc *p = curproc;
-
- (void)exitcode;
- DEBUG(DB_SYSCALL,"Syscall: _exit(%d)\n",exitcode);
- KASSERT(curproc->p_addrspace != NULL);
- as_deactivate();
-
- as = curproc_setas(NULL);
- as_destroy(as);
-
-
- proc_remthread(curthread);
-
- proc_destroy(p);
-
- thread_exit();
-
- panic("return from thread_exit in sys_exit\n");
- }
- int
- sys_getpid(pid_t *retval)
- {
-
-
- *retval = 1;
- return(0);
- }
- int
- sys_waitpid(pid_t pid,
- userptr_t status,
- int options,
- pid_t *retval)
- {
- int exitstatus;
- int result;
-
- if (options != 0) {
- return(EINVAL);
- }
-
- exitstatus = 0;
- result = copyout((void *)&exitstatus,status,sizeof(int));
- if (result) {
- return(result);
- }
- *retval = pid;
- return(0);
- }
|