delete proc_ on proc_exit, proc_wait, proc_kill
This commit is contained in:
		
							parent
							
								
									eb52c7de1d
								
							
						
					
					
						commit
						5573c8f296
					
				
					 4 changed files with 12 additions and 12 deletions
				
			
		
							
								
								
									
										6
									
								
								defs.h
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								defs.h
									
										
									
									
									
								
							| 
						 | 
					@ -98,10 +98,10 @@ int             pipewrite(struct pipe*, char*, int);
 | 
				
			||||||
struct proc*    copyproc(struct proc*);
 | 
					struct proc*    copyproc(struct proc*);
 | 
				
			||||||
int             growproc(int);
 | 
					int             growproc(int);
 | 
				
			||||||
void            pinit(void);
 | 
					void            pinit(void);
 | 
				
			||||||
void            proc_exit(void);
 | 
					 | 
				
			||||||
int             proc_kill(int);
 | 
					 | 
				
			||||||
int             proc_wait(void);
 | 
					 | 
				
			||||||
void            procdump(void);
 | 
					void            procdump(void);
 | 
				
			||||||
 | 
					void            exit(void);
 | 
				
			||||||
 | 
					int             kill(int);
 | 
				
			||||||
 | 
					int             wait(void);
 | 
				
			||||||
void            scheduler(void) __attribute__((noreturn));
 | 
					void            scheduler(void) __attribute__((noreturn));
 | 
				
			||||||
void            setupsegs(struct proc*);
 | 
					void            setupsegs(struct proc*);
 | 
				
			||||||
void            sleep(void*, struct spinlock*);
 | 
					void            sleep(void*, struct spinlock*);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										6
									
								
								proc.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								proc.c
									
										
									
									
									
								
							| 
						 | 
					@ -318,7 +318,7 @@ wakeup(void *chan)
 | 
				
			||||||
// Process won't actually exit until it returns
 | 
					// Process won't actually exit until it returns
 | 
				
			||||||
// to user space (see trap in trap.c).
 | 
					// to user space (see trap in trap.c).
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
proc_kill(int pid)
 | 
					kill(int pid)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  struct proc *p;
 | 
					  struct proc *p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -341,7 +341,7 @@ proc_kill(int pid)
 | 
				
			||||||
// Exited processes remain in the zombie state
 | 
					// Exited processes remain in the zombie state
 | 
				
			||||||
// until their parent calls wait() to find out they exited.
 | 
					// until their parent calls wait() to find out they exited.
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
proc_exit(void)
 | 
					exit(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  struct proc *p;
 | 
					  struct proc *p;
 | 
				
			||||||
  int fd;
 | 
					  int fd;
 | 
				
			||||||
| 
						 | 
					@ -384,7 +384,7 @@ proc_exit(void)
 | 
				
			||||||
// Wait for a child process to exit and return its pid.
 | 
					// Wait for a child process to exit and return its pid.
 | 
				
			||||||
// Return -1 if this process has no children.
 | 
					// Return -1 if this process has no children.
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
proc_wait(void)
 | 
					wait(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  struct proc *p;
 | 
					  struct proc *p;
 | 
				
			||||||
  int i, havekids, pid;
 | 
					  int i, havekids, pid;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,14 +18,14 @@ sys_fork(void)
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
sys_exit(void)
 | 
					sys_exit(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  proc_exit();
 | 
					  exit();
 | 
				
			||||||
  return 0;  // not reached
 | 
					  return 0;  // not reached
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
sys_wait(void)
 | 
					sys_wait(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return proc_wait();
 | 
					  return wait();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,7 @@ sys_kill(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(argint(0, &pid) < 0)
 | 
					  if(argint(0, &pid) < 0)
 | 
				
			||||||
    return -1;
 | 
					    return -1;
 | 
				
			||||||
  return proc_kill(pid);
 | 
					  return kill(pid);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										6
									
								
								trap.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								trap.c
									
										
									
									
									
								
							| 
						 | 
					@ -36,11 +36,11 @@ trap(struct trapframe *tf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if(tf->trapno == T_SYSCALL){
 | 
					  if(tf->trapno == T_SYSCALL){
 | 
				
			||||||
    if(cp->killed)
 | 
					    if(cp->killed)
 | 
				
			||||||
      proc_exit();
 | 
					      exit();
 | 
				
			||||||
    cp->tf = tf;
 | 
					    cp->tf = tf;
 | 
				
			||||||
    syscall();
 | 
					    syscall();
 | 
				
			||||||
    if(cp->killed)
 | 
					    if(cp->killed)
 | 
				
			||||||
      proc_exit();
 | 
					      exit();
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,7 +89,7 @@ trap(struct trapframe *tf)
 | 
				
			||||||
  // (If it is still executing in the kernel, let it keep running 
 | 
					  // (If it is still executing in the kernel, let it keep running 
 | 
				
			||||||
  // until it gets to the regular system call return.)
 | 
					  // until it gets to the regular system call return.)
 | 
				
			||||||
  if(cp && cp->killed && (tf->cs&3) == DPL_USER)
 | 
					  if(cp && cp->killed && (tf->cs&3) == DPL_USER)
 | 
				
			||||||
    proc_exit();
 | 
					    exit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Force process to give up CPU on clock tick.
 | 
					  // Force process to give up CPU on clock tick.
 | 
				
			||||||
  // If interrupts were on while locks held, would need to check nlock.
 | 
					  // If interrupts were on while locks held, would need to check nlock.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue