[BACK]Return to kill.c CVS log [TXT][DIR] Up to [local] / prex-old / usr / server / proc

Diff for /prex-old/usr/server/proc/kill.c between version 1.1.1.1 and 1.1.1.1.2.1

version 1.1.1.1, 2008/06/03 10:38:51 version 1.1.1.1.2.1, 2008/08/13 17:12:45
Line 42 
Line 42 
 #include "proc.h"  #include "proc.h"
   
 /*  /*
  * Send a signal to the task.   * Send a signal to the process.
  */   */
 static int  static int
 send_sig(struct proc *proc, int sig)  send_sig(struct proc *p, int sig)
 {  {
   
         if (proc->pid == 0 || proc->pid == 1)          if (p->p_pid == 0 || p->p_pid == 1)
                 return EPERM;                  return EPERM;
         return exception_raise(proc->task, sig);  
           DPRINTF(("proc: send_sig task=%x\n", p->p_task));
           return exception_raise(p->p_task, sig);
 }  }
   
 /*  /*
Line 61 
Line 63 
 {  {
         struct proc *p;          struct proc *p;
   
         dprintf("killone pid=%x sig=%d\n", pid, sig);          DPRINTF(("proc: killone pid=%d sig=%d\n", pid, sig));
   
         if ((p = proc_find(pid)) == NULL)          if ((p = proc_find(pid)) == NULL)
                 return ESRCH;                  return ESRCH;
         return send_sig(p, sig);          return send_sig(p, sig);
 }  }
   
 /*  /*
  * Send signal to all process in the process group.   * Send a signal to all process in the process group.
  */   */
 int  int
 kill_pg(pid_t pgid, int sig)  kill_pg(pid_t pgid, int sig)
Line 78 
Line 81 
         list_t head, n;          list_t head, n;
         int err = 0;          int err = 0;
   
         dprintf("killpg pgid=%x sig=%d\n", pgid, sig);          DPRINTF(("proc: killpg pgid=%d sig=%d\n", pgid, sig));
   
         if ((pgrp = pgrp_find(pgid)) == NULL)          if ((pgrp = pgrp_find(pgid)) == NULL)
                 return ESRCH;                  return ESRCH;
   
         head = &pgrp->members;          head = &pgrp->pg_members;
         for (n = list_first(head); n != head; n = list_next(n)) {          for (n = list_first(head); n != head; n = list_next(n)) {
                 p = list_entry(n, struct proc, pgrp_link);                  p = list_entry(n, struct proc, p_link);
                 if ((err = send_sig(p, sig)) != 0)                  if ((err = send_sig(p, sig)) != 0)
                         break;                          break;
         }          }
Line 124 
Line 127 
         pid = (pid_t)msg->data[0];          pid = (pid_t)msg->data[0];
         sig = msg->data[1];          sig = msg->data[1];
   
         dprintf("kill pid=%x sig=%d\n", pid, sig);          DPRINTF(("proc: kill pid=%d sig=%d\n", pid, sig));
   
         switch (sig) {          switch (sig) {
         case SIGFPE:          case SIGFPE:
Line 133 
Line 136 
                 return EINVAL;                  return EINVAL;
         }          }
   
         if (curproc->cap & CAP_KILL)          if (curproc->p_cap & CAP_KILL)
                 capable = 1;                  capable = 1;
   
         if (pid > 0) {          if (pid > 0) {
                 if (pid != curproc->pid && !capable)                  if (pid != curproc->p_pid && !capable)
                         return EPERM;                          return EPERM;
                 err = kill_one(pid, sig);                  err = kill_one(pid, sig);
         }          }
Line 146 
Line 149 
                         return EPERM;                          return EPERM;
                 for (n = list_first(&allproc); n != &allproc;                  for (n = list_first(&allproc); n != &allproc;
                      n = list_next(n)) {                       n = list_next(n)) {
                         p = list_entry(n, struct proc, link);                          p = list_entry(n, struct proc, p_link);
                         if (p->pid != 0 && p->pid != 1) {                          if (p->p_pid != 0 && p->p_pid != 1) {
                                 err = kill_one(p->pid, sig);                                  err = kill_one(p->p_pid, sig);
                                 if (err != 0)                                  if (err != 0)
                                         break;                                          break;
                         }                          }
Line 157 
Line 160 
         else if (pid == 0) {          else if (pid == 0) {
                 if ((p = proc_find(pid)) == NULL)                  if ((p = proc_find(pid)) == NULL)
                         return ESRCH;                          return ESRCH;
                 err = kill_pg(p->pgrp->pgid, sig);                  err = kill_pg(p->p_pgrp->pg_pgid, sig);
         }          }
         else {          else {
                 if (curproc->pgrp->pgid != -pid && !capable)                  if (curproc->p_pgrp->pg_pgid != -pid && !capable)
                         return EPERM;                          return EPERM;
                 err = kill_pg(-pid, sig);                  err = kill_pg(-pid, sig);
         }          }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.1.2.1

CVSweb