|
@@ -13,10 +13,11 @@
|
|
/* this implementation of sys__exit does not do anything with the exit code */
|
|
/* this implementation of sys__exit does not do anything with the exit code */
|
|
/* this needs to be fixed to get exit() and waitpid() working properly */
|
|
/* this needs to be fixed to get exit() and waitpid() working properly */
|
|
|
|
|
|
-void sys__exit(int exitcode) {
|
|
|
|
|
|
+void sys__exit(int exitcode)
|
|
|
|
+{
|
|
|
|
|
|
- struct addrspace *as;
|
|
|
|
- struct proc *p = curproc;
|
|
|
|
|
|
+ struct addrspace * as;
|
|
|
|
+ struct proc * p = curproc;
|
|
/* for now, just include this to keep the compiler from complaining about
|
|
/* for now, just include this to keep the compiler from complaining about
|
|
an unused variable */
|
|
an unused variable */
|
|
(void)exitcode;
|
|
(void)exitcode;
|
|
@@ -50,8 +51,7 @@ void sys__exit(int exitcode) {
|
|
|
|
|
|
|
|
|
|
/* stub handler for getpid() system call */
|
|
/* stub handler for getpid() system call */
|
|
-int
|
|
|
|
-sys_getpid(pid_t *retval)
|
|
|
|
|
|
+int sys_getpid(pid_t * retval)
|
|
{
|
|
{
|
|
/* for now, this is just a stub that always returns a PID of 1 */
|
|
/* for now, this is just a stub that always returns a PID of 1 */
|
|
/* you need to fix this to make it work properly */
|
|
/* you need to fix this to make it work properly */
|
|
@@ -61,31 +61,29 @@ sys_getpid(pid_t *retval)
|
|
|
|
|
|
/* stub handler for waitpid() system call */
|
|
/* stub handler for waitpid() system call */
|
|
|
|
|
|
-int
|
|
|
|
-sys_waitpid(pid_t pid,
|
|
|
|
- userptr_t status,
|
|
|
|
- int options,
|
|
|
|
- pid_t *retval)
|
|
|
|
|
|
+int sys_waitpid(pid_t pid, userptr_t status, int options, pid_t *retval)
|
|
{
|
|
{
|
|
int exitstatus;
|
|
int exitstatus;
|
|
int result;
|
|
int result;
|
|
|
|
|
|
/* this is just a stub implementation that always reports an
|
|
/* this is just a stub implementation that always reports an
|
|
exit status of 0, regardless of the actual exit status of
|
|
exit status of 0, regardless of the actual exit status of
|
|
- the specified process.
|
|
|
|
|
|
+ the specified process.
|
|
In fact, this will return 0 even if the specified process
|
|
In fact, this will return 0 even if the specified process
|
|
is still running, and even if it never existed in the first place.
|
|
is still running, and even if it never existed in the first place.
|
|
|
|
|
|
Fix this!
|
|
Fix this!
|
|
*/
|
|
*/
|
|
|
|
|
|
- if (options != 0) {
|
|
|
|
|
|
+ if (options != 0)
|
|
|
|
+ {
|
|
return(EINVAL);
|
|
return(EINVAL);
|
|
}
|
|
}
|
|
/* for now, just pretend the exitstatus is 0 */
|
|
/* for now, just pretend the exitstatus is 0 */
|
|
exitstatus = 0;
|
|
exitstatus = 0;
|
|
result = copyout((void *)&exitstatus,status,sizeof(int));
|
|
result = copyout((void *)&exitstatus,status,sizeof(int));
|
|
- if (result) {
|
|
|
|
|
|
+ if (result)
|
|
|
|
+ {
|
|
return(result);
|
|
return(result);
|
|
}
|
|
}
|
|
*retval = pid;
|
|
*retval = pid;
|