Message type for PM_SIG{RETURN,SUSPEND,PROCMASK}
Change-Id: Id20352db47892eb6b870ea64ba52b3b1a293cbaa
This commit is contained in:
parent
6495d409d6
commit
9a4c1520cf
7 changed files with 35 additions and 24 deletions
|
@ -68,13 +68,6 @@
|
|||
#define PM_SIG_OACT m1_p2 /* struct sigaction * */
|
||||
#define PM_SIG_RET m1_p3 /* int (*)(void) */
|
||||
|
||||
/* Field names for the remaining sigpending(2), sigprocmask(2), sigreturn(2),
|
||||
* sigsuspend(2) calls.
|
||||
*/
|
||||
#define PM_SIG_HOW m2_i1 /* int */
|
||||
#define PM_SIG_SET m2_sigset /* sigset_t */
|
||||
#define PM_SIG_CTX m2_p1 /* struct sigcontext * */
|
||||
|
||||
/*===========================================================================*
|
||||
* Calls to VFS *
|
||||
*===========================================================================*/
|
||||
|
|
|
@ -251,6 +251,22 @@ typedef struct {
|
|||
} mess_lc_pm_sysuname;
|
||||
_ASSERT_MSG_SIZE(mess_lc_pm_sysuname);
|
||||
|
||||
typedef struct {
|
||||
int how;
|
||||
vir_bytes ctx;
|
||||
sigset_t set;
|
||||
|
||||
uint8_t padding[32];
|
||||
} mess_lc_pm_sigset;
|
||||
_ASSERT_MSG_SIZE(mess_lc_pm_sigset);
|
||||
|
||||
typedef struct {
|
||||
sigset_t set;
|
||||
|
||||
uint8_t padding[40];
|
||||
} mess_pm_lc_sigset;
|
||||
_ASSERT_MSG_SIZE(mess_pm_lc_sigset);
|
||||
|
||||
typedef struct {
|
||||
time_t sec;
|
||||
|
||||
|
@ -1093,6 +1109,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_sigset m_lc_pm_sigset;
|
||||
mess_lc_pm_sysuname m_lc_pm_sysuname;
|
||||
mess_lc_pm_time m_lc_pm_time;
|
||||
mess_lc_pm_waitpid m_lc_pm_waitpid;
|
||||
|
@ -1138,6 +1155,7 @@ typedef struct {
|
|||
mess_pm_lc_getpid m_pm_lc_getpid;
|
||||
mess_pm_lc_getuid m_pm_lc_getuid;
|
||||
mess_pm_lc_ptrace m_pm_lc_ptrace;
|
||||
mess_pm_lc_sigset m_pm_lc_sigset;
|
||||
mess_pm_lc_time m_pm_lc_time;
|
||||
mess_pm_lc_waitpid m_pm_lc_waitpid;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ sigset_t *set;
|
|||
|
||||
memset(&m, 0, sizeof(m));
|
||||
if (_syscall(PM_PROC_NR, PM_SIGPENDING, &m) < 0) return(-1);
|
||||
*set = m.PM_SIG_SET;
|
||||
*set = m.m_pm_lc_sigset.set;
|
||||
return(m.m_type);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,14 @@ sigset_t *oset;
|
|||
|
||||
memset(&m, 0, sizeof(m));
|
||||
if (set == (sigset_t *) NULL) {
|
||||
m.PM_SIG_HOW = SIG_INQUIRE;
|
||||
sigemptyset(&m.PM_SIG_SET);
|
||||
m.m_lc_pm_sigset.how = SIG_INQUIRE;
|
||||
sigemptyset(&m.m_lc_pm_sigset.set);
|
||||
} else {
|
||||
m.PM_SIG_HOW = how;
|
||||
m.PM_SIG_SET = *set;
|
||||
m.m_lc_pm_sigset.how = how;
|
||||
m.m_lc_pm_sigset.set = *set;
|
||||
}
|
||||
if (_syscall(PM_PROC_NR, PM_SIGPROCMASK, &m) < 0) return(-1);
|
||||
if (oset != (sigset_t *) NULL) *oset = m.PM_SIG_SET;
|
||||
if (oset != NULL) *oset = m.m_pm_lc_sigset.set;
|
||||
|
||||
return(m.m_type);
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ int sigreturn(struct sigcontext *scp)
|
|||
|
||||
/* Protect against race conditions by blocking all interrupts. */
|
||||
sigfillset(&set); /* splhi */
|
||||
sigprocmask(SIG_SETMASK, &set, (sigset_t *) NULL);
|
||||
sigprocmask(SIG_SETMASK, &set, NULL);
|
||||
|
||||
memset(&m, 0, sizeof(m));
|
||||
m.PM_SIG_SET = scp->sc_mask;
|
||||
m.PM_SIG_CTX = (char *) scp;
|
||||
m.m_lc_pm_sigset.set = scp->sc_mask;
|
||||
m.m_lc_pm_sigset.ctx = (vir_bytes)scp;
|
||||
return(_syscall(PM_PROC_NR, PM_SIGRETURN, &m)); /* normally doesn't return */
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ const sigset_t *set;
|
|||
message m;
|
||||
|
||||
memset(&m, 0, sizeof(m));
|
||||
m.PM_SIG_SET = *set;
|
||||
m.m_lc_pm_sigset.set = *set;
|
||||
return(_syscall(PM_PROC_NR, PM_SIGSUSPEND, &m));
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ int do_sigpending(void)
|
|||
{
|
||||
assert(!(mp->mp_flags & (PROC_STOPPED | VFS_CALL | UNPAUSED)));
|
||||
|
||||
mp->mp_reply.PM_SIG_SET = mp->mp_sigpending;
|
||||
mp->mp_reply.m_pm_lc_sigset.set = mp->mp_sigpending;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -116,10 +116,10 @@ int do_sigprocmask(void)
|
|||
|
||||
assert(!(mp->mp_flags & (PROC_STOPPED | VFS_CALL | UNPAUSED)));
|
||||
|
||||
set = m_in.PM_SIG_SET;
|
||||
mp->mp_reply.PM_SIG_SET = mp->mp_sigmask;
|
||||
set = m_in.m_lc_pm_sigset.set;
|
||||
mp->mp_reply.m_pm_lc_sigset.set = mp->mp_sigmask;
|
||||
|
||||
switch (m_in.PM_SIG_HOW) {
|
||||
switch (m_in.m_lc_pm_sigset.how) {
|
||||
case SIG_BLOCK:
|
||||
sigdelset(&set, SIGKILL);
|
||||
sigdelset(&set, SIGSTOP);
|
||||
|
@ -162,7 +162,7 @@ int do_sigsuspend(void)
|
|||
assert(!(mp->mp_flags & (PROC_STOPPED | VFS_CALL | UNPAUSED)));
|
||||
|
||||
mp->mp_sigmask2 = mp->mp_sigmask; /* save the old mask */
|
||||
mp->mp_sigmask = m_in.PM_SIG_SET;
|
||||
mp->mp_sigmask = m_in.m_lc_pm_sigset.set;
|
||||
sigdelset(&mp->mp_sigmask, SIGKILL);
|
||||
sigdelset(&mp->mp_sigmask, SIGSTOP);
|
||||
mp->mp_flags |= SIGSUSPENDED;
|
||||
|
@ -182,11 +182,11 @@ int do_sigreturn(void)
|
|||
|
||||
assert(!(mp->mp_flags & (PROC_STOPPED | VFS_CALL | UNPAUSED)));
|
||||
|
||||
mp->mp_sigmask = m_in.PM_SIG_SET;
|
||||
mp->mp_sigmask = m_in.m_lc_pm_sigset.set;
|
||||
sigdelset(&mp->mp_sigmask, SIGKILL);
|
||||
sigdelset(&mp->mp_sigmask, SIGSTOP);
|
||||
|
||||
r = sys_sigreturn(who_e, (struct sigmsg *) m_in.PM_SIG_CTX);
|
||||
r = sys_sigreturn(who_e, (struct sigmsg *)m_in.m_lc_pm_sigset.ctx);
|
||||
check_pending(mp);
|
||||
return(r);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue