mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 04:50:07 +00:00
Sat Feb 25 02:17:52 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* sysdeps/mach/hurd/kill.c: When the process has no message port registered and we have its task port, translate a few signals to task_suspend/task_resume/task_terminate.
This commit is contained in:
parent
22a1292a42
commit
3c46a92d40
@ -1,3 +1,9 @@
|
||||
Sat Feb 25 02:17:52 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* sysdeps/mach/hurd/kill.c: When the process has no message port
|
||||
registered and we have its task port, translate a few signals to
|
||||
task_suspend/task_resume/task_terminate.
|
||||
|
||||
Fri Feb 24 14:40:48 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* io/Makefile (routines): Add euidaccess.
|
||||
|
@ -37,6 +37,8 @@ __kill (pid_t pid, int sig)
|
||||
|
||||
inline void kill_pid (pid_t pid) /* Kill one PID. */
|
||||
{
|
||||
|
||||
|
||||
/* SIGKILL is not delivered as a normal signal.
|
||||
Sending SIGKILL to a process means to terminate its task. */
|
||||
if (sig == SIGKILL)
|
||||
@ -58,12 +60,48 @@ __kill (pid_t pid, int sig)
|
||||
} while (err == MACH_SEND_INVALID_DEST ||
|
||||
err == MIG_SERVER_DIED);
|
||||
else
|
||||
err = HURD_MSGPORT_RPC (__proc_getmsgport (proc, pid, &msgport),
|
||||
__proc_pid2task (proc, pid, &refport) ?
|
||||
__proc_getsidport (proc, &refport) : 0, 1,
|
||||
/* If no msgport, we cannot send a signal. */
|
||||
msgport == MACH_PORT_NULL ? EPERM :
|
||||
__msg_sig_post (msgport, sig, refport));
|
||||
{
|
||||
error_t taskerr;
|
||||
error_t kill_port (mach_port_t msgport, mach_port_t refport)
|
||||
{
|
||||
if (msgport != MACH_PORT_NULL)
|
||||
/* Send a signal message to his message port. */
|
||||
return __msg_sig_post (msgport, sig, refport);
|
||||
|
||||
/* The process has no message port. Perhaps try direct
|
||||
frobnication of the task. */
|
||||
|
||||
if (taskerr)
|
||||
/* If we could not get the task port, we can do nothing. */
|
||||
return taskerr;
|
||||
|
||||
/* For user convenience in the case of a task that has
|
||||
not registered any message port with the proc server,
|
||||
translate a few signals to direct task operations. */
|
||||
switch (sig)
|
||||
{
|
||||
/* The only signals that really make sense for an
|
||||
unregistered task are kill, suspend, and continue. */
|
||||
case SIGSTOP:
|
||||
case SIGTSTP:
|
||||
return __task_suspend (refport);
|
||||
case SIGCONT:
|
||||
return __task_resume (refport);
|
||||
case SIGQUIT:
|
||||
case SIGINT:
|
||||
return __task_terminate (refport);
|
||||
default:
|
||||
/* We have full permission to send signals, but there is
|
||||
no meaningful way to express this signal. */
|
||||
return EPERM;
|
||||
}
|
||||
}
|
||||
err = HURD_MSGPORT_RPC (__proc_getmsgport (proc, pid, &msgport),
|
||||
(taskerr = __proc_pid2task (proc, pid,
|
||||
&refport)) ?
|
||||
__proc_getsidport (proc, &refport) : 0, 1,
|
||||
kill_port (msgport, refport));
|
||||
}
|
||||
if (! err)
|
||||
delivered = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user