From: Lionel Sambuc Date: Tue, 13 May 2014 17:02:12 +0000 (+0200) Subject: Message type for PM_{KILL,SIGACTION} X-Git-Tag: v3.3.0~251 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/index.html?a=commitdiff_plain;h=b90d99dab35b7b39c011298b8fb2bfc317e805f7;p=minix.git Message type for PM_{KILL,SIGACTION} Change-Id: I7fac9a894e319671e12bfa7430984ca1cf24da33 --- diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 93da5ada7..603068788 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -61,13 +61,6 @@ #define NR_PM_CALLS 48 /* highest number from base plus one */ -/* Field names for the kill(2), srv_kill(2), and sigaction(2) calls. */ -#define PM_SIG_PID m1_i1 /* pid_t */ -#define PM_SIG_NR m1_i2 /* int */ -#define PM_SIG_ACT m1_p1 /* const struct sigaction * */ -#define PM_SIG_OACT m1_p2 /* struct sigaction * */ -#define PM_SIG_RET m1_p3 /* int (*)(void) */ - /*===========================================================================* * Calls to VFS * *===========================================================================*/ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 55db51754..d0e94f07c 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -251,6 +251,17 @@ typedef struct { } mess_lc_pm_sysuname; _ASSERT_MSG_SIZE(mess_lc_pm_sysuname); +typedef struct { + pid_t pid; + int nr; + vir_bytes act; /* const struct sigaction * */ + vir_bytes oact; /* struct sigaction * */ + vir_bytes ret; /* int (*)(void) */ + + uint8_t padding[36]; +} mess_lc_pm_sig; +_ASSERT_MSG_SIZE(mess_lc_pm_sig); + typedef struct { int how; vir_bytes ctx; @@ -1117,6 +1128,7 @@ typedef struct { mess_lc_pm_reboot m_lc_pm_reboot; mess_lc_pm_setgid m_lc_pm_setgid; mess_lc_pm_setuid m_lc_pm_setuid; + mess_lc_pm_sig m_lc_pm_sig; mess_lc_pm_sigset m_lc_pm_sigset; mess_lc_pm_sysuname m_lc_pm_sysuname; mess_lc_pm_time m_lc_pm_time; diff --git a/lib/libc/sys-minix/kill.c b/lib/libc/sys-minix/kill.c index 367d2ef22..4bedfdd5f 100644 --- a/lib/libc/sys-minix/kill.c +++ b/lib/libc/sys-minix/kill.c @@ -16,7 +16,7 @@ int sig; /* signal number */ message m; memset(&m, 0, sizeof(m)); - m.PM_SIG_PID = proc; - m.PM_SIG_NR = sig; + m.m_lc_pm_sig.pid = proc; + m.m_lc_pm_sig.nr = sig; return(_syscall(PM_PROC_NR, PM_KILL, &m)); } diff --git a/lib/libc/sys-minix/sigaction.c b/lib/libc/sys-minix/sigaction.c index 7f006caf1..c01adaa45 100644 --- a/lib/libc/sys-minix/sigaction.c +++ b/lib/libc/sys-minix/sigaction.c @@ -12,10 +12,10 @@ int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) message m; memset(&m, 0, sizeof(m)); - m.PM_SIG_NR = sig; - m.PM_SIG_ACT = (char *) __UNCONST(act); - m.PM_SIG_OACT = (char *) oact; - m.PM_SIG_RET = (char *) __sigreturn; + m.m_lc_pm_sig.nr = sig; + m.m_lc_pm_sig.act = (vir_bytes)act; + m.m_lc_pm_sig.oact = (vir_bytes)oact; + m.m_lc_pm_sig.ret = (vir_bytes)__sigreturn; return(_syscall(PM_PROC_NR, PM_SIGACTION, &m)); } diff --git a/servers/pm/signal.c b/servers/pm/signal.c index 115df742a..304fd6085 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -45,23 +45,23 @@ int do_sigaction(void) assert(!(mp->mp_flags & (PROC_STOPPED | VFS_CALL | UNPAUSED))); - sig_nr = m_in.PM_SIG_NR; + sig_nr = m_in.m_lc_pm_sig.nr; if (sig_nr == SIGKILL) return(OK); if (sig_nr < 1 || sig_nr >= _NSIG) return(EINVAL); svp = &mp->mp_sigact[sig_nr]; - if ((struct sigaction *) m_in.PM_SIG_OACT != (struct sigaction *) NULL) { + if (m_in.m_lc_pm_sig.oact != 0) { r = sys_datacopy(PM_PROC_NR,(vir_bytes) svp, who_e, - (vir_bytes) m_in.PM_SIG_OACT, (phys_bytes) sizeof(svec)); + m_in.m_lc_pm_sig.oact, (phys_bytes) sizeof(svec)); if (r != OK) return(r); } - if ((struct sigaction *) m_in.PM_SIG_ACT == (struct sigaction *) NULL) + if (m_in.m_lc_pm_sig.act == 0) return(OK); /* Read in the sigaction structure. */ - r = sys_datacopy(who_e, (vir_bytes) m_in.PM_SIG_ACT, - PM_PROC_NR, (vir_bytes) &svec, (phys_bytes) sizeof(svec)); + r = sys_datacopy(who_e, m_in.m_lc_pm_sig.act, PM_PROC_NR, (vir_bytes) &svec, + (phys_bytes) sizeof(svec)); if (r != OK) return(r); if (svec.sa_handler == SIG_IGN) { @@ -81,7 +81,7 @@ int do_sigaction(void) sigdelset(&svec.sa_mask, SIGSTOP); mp->mp_sigact[sig_nr].sa_mask = svec.sa_mask; mp->mp_sigact[sig_nr].sa_flags = svec.sa_flags; - mp->mp_sigreturn = (vir_bytes) m_in.PM_SIG_RET; + mp->mp_sigreturn = m_in.m_lc_pm_sig.ret; return(OK); } @@ -198,7 +198,7 @@ int do_kill(void) { /* Perform the kill(pid, signo) system call. */ - return check_sig(m_in.PM_SIG_PID, m_in.PM_SIG_NR, FALSE /* ksig */); + return check_sig(m_in.m_lc_pm_sig.pid, m_in.m_lc_pm_sig.nr, FALSE /* ksig */); } /*===========================================================================*