From: Lionel Sambuc Date: Tue, 13 May 2014 16:29:11 +0000 (+0200) Subject: Message type for PM_SIG{RETURN,SUSPEND,PROCMASK} X-Git-Tag: v3.3.0~253 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/Bv9ARM.ch02.html?a=commitdiff_plain;h=9a4c1520cf0bae9a543dda2fb6833ba5db4e5c6f;p=minix.git Message type for PM_SIG{RETURN,SUSPEND,PROCMASK} Change-Id: Id20352db47892eb6b870ea64ba52b3b1a293cbaa --- diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 76c278d4b..93da5ada7 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -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 * *===========================================================================*/ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 39ca32d9f..b3224d9ed 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -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; diff --git a/lib/libc/sys-minix/sigpending.c b/lib/libc/sys-minix/sigpending.c index e851c9228..01b8fffbf 100644 --- a/lib/libc/sys-minix/sigpending.c +++ b/lib/libc/sys-minix/sigpending.c @@ -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); } diff --git a/lib/libc/sys-minix/sigprocmask.c b/lib/libc/sys-minix/sigprocmask.c index ee3f0edf5..b1906d790 100644 --- a/lib/libc/sys-minix/sigprocmask.c +++ b/lib/libc/sys-minix/sigprocmask.c @@ -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); } diff --git a/lib/libc/sys-minix/sigreturn.c b/lib/libc/sys-minix/sigreturn.c index c2685e7f4..f81a0ad5c 100644 --- a/lib/libc/sys-minix/sigreturn.c +++ b/lib/libc/sys-minix/sigreturn.c @@ -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 */ } diff --git a/lib/libc/sys-minix/sigsuspend.c b/lib/libc/sys-minix/sigsuspend.c index abfdc8ff7..34a969521 100644 --- a/lib/libc/sys-minix/sigsuspend.c +++ b/lib/libc/sys-minix/sigsuspend.c @@ -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)); } diff --git a/servers/pm/signal.c b/servers/pm/signal.c index 01623c13d..054f69e9b 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -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); }