From 94c9376df59c62a5946e60b19794599c1942458e Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Thu, 28 Nov 2013 19:22:37 +0100 Subject: [PATCH] Removing SYS_SIG_* field macros. Change-Id: Ib4f1b48268d4539ae6d4502ad647ecb73ea87f79 --- include/minix/com.h | 8 -------- include/minix/ipc.h | 23 +++++++++++------------ kernel/system/do_endksig.c | 6 +++--- kernel/system/do_getksig.c | 13 ++++++------- kernel/system/do_kill.c | 10 +++++----- kernel/system/do_sigreturn.c | 19 ++++++++++--------- kernel/system/do_sigsend.c | 34 +++++++++++++++++----------------- lib/libsys/sys_endsig.c | 2 +- lib/libsys/sys_getsig.c | 4 ++-- lib/libsys/sys_kill.c | 4 ++-- lib/libsys/sys_sigreturn.c | 4 ++-- lib/libsys/sys_sigsend.c | 4 ++-- 12 files changed, 61 insertions(+), 70 deletions(-) diff --git a/include/minix/com.h b/include/minix/com.h index 463ded22c..0ea6126e9 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -470,14 +470,6 @@ #define SG_ADDR m2_p1 /* address */ #define SG_SIZE m2_i2 /* no. of entries */ -/* Field names for SYS_GETKSIG, _ENDKSIG, _KILL, _SIGSEND, _SIGRETURN. */ -#define SYS_SIG_ENDPT m_sigcalls.ep /* process number for inform */ -#define SYS_SIG_NUMBER m_sigcalls.sig /* signal number to send */ -#define SYS_SIG_FLAGS m_sigcalls.flags /* signal flags field */ -#define SYS_SIG_MAP m_sigcalls.sigs /* used to pass signal bit map */ -#define SYS_SIG_CTXT_PTR m_sigcalls.sigctx /* pointer to signal context */ -#define SYS_SIG_HOW m_sigcalls.how /* used to pass signal bit map */ - /* Field names for SYS_FORK, _EXEC, _EXIT, GETMCONTEXT, SETMCONTEXT.*/ #define PR_ENDPT m1_i1 /* indicates a process */ #define PR_PRIORITY m1_i2 /* process priority */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 9213e323e..6eae8bfa4 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -35,17 +35,6 @@ typedef struct { } mess_2; _ASSERT_MSG_SIZE(mess_2); -typedef struct { - endpoint_t ep; - int sig; - u32_t flags; - sigset_t sigs; - void *sigctx; - int how; - uint8_t padding[20]; -} mess_sigcalls; -_ASSERT_MSG_SIZE(mess_sigcalls); - typedef struct { int m3i1, m3i2; char *m3p1; @@ -135,6 +124,16 @@ typedef struct { } mess_notify; _ASSERT_MSG_SIZE(mess_notify); +/* For SYS_GETKSIG, _ENDKSIG, _KILL, _SIGSEND, _SIGRETURN. */ +typedef struct { + sigset_t map; /* used to pass signal bit map */ + endpoint_t endpt; /* process number for inform */ + int sig; /* signal number to send */ + void *sigctx; /* pointer to signal context */ + uint8_t padding[28]; +} mess_sigcalls; +_ASSERT_MSG_SIZE(mess_sigcalls); + typedef struct { off_t offset; dev_t dev; @@ -186,10 +185,10 @@ typedef struct { mess_11 m_m11; mess_mmap m_mmap; mess_notify m_notify; + mess_sigcalls m_sigcalls; mess_vm_vfs_mmap m_vm_vfs_mmap; mess_vmmcp m_vmmcp; mess_vmmcp_reply m_vmmcp_reply; - mess_sigcalls m_sigcalls; /* SYS_{GETKSIG,ENDKSIG,KILL,SIGSEND,SIGRETURN} */ u8_t size[56]; /* message payload may have 56 bytes at most */ }; } message __aligned(16); diff --git a/kernel/system/do_endksig.c b/kernel/system/do_endksig.c index 414e01179..eac6a3e70 100644 --- a/kernel/system/do_endksig.c +++ b/kernel/system/do_endksig.c @@ -1,8 +1,8 @@ /* The kernel call that is implemented in this file: - * m_type: SYS_ENDKSIG + * m_type: SYS_ENDKSIG * * The parameters for this kernel call are: - * m2_i1: SIG_ENDPT # process for which PM is done + * m_sigcalls.endpt # process for which PM is done */ #include "kernel/system.h" @@ -24,7 +24,7 @@ int do_endksig(struct proc * caller, message * m_ptr) /* Get process pointer and verify that it had signals pending. If the * process is already dead its flags will be reset. */ - if(!isokendpt(m_ptr->SYS_SIG_ENDPT, &proc_nr)) + if(!isokendpt(m_ptr->m_sigcalls.endpt, &proc_nr)) return EINVAL; rp = proc_addr(proc_nr); diff --git a/kernel/system/do_getksig.c b/kernel/system/do_getksig.c index 496066f91..a8b5e7dc9 100644 --- a/kernel/system/do_getksig.c +++ b/kernel/system/do_getksig.c @@ -1,9 +1,9 @@ /* The kernel call that is implemented in this file: - * m_type: SYS_GETKSIG + * m_type: SYS_GETKSIG * * The parameters for this kernel call are: - * m2_i1: SYS_SIG_ENDPT # process with pending signals - * m2_l1: SYS_SIG_MAP # bit map with pending signals + * m_sigcalls.endpt # process with pending signals + * m_sigcalls.map # bit map with pending signals */ #include "kernel/system.h" @@ -28,8 +28,8 @@ int do_getksig(struct proc * caller, message * m_ptr) if (RTS_ISSET(rp, RTS_SIGNALED)) { if (caller->p_endpoint != priv(rp)->s_sig_mgr) continue; /* store signaled process' endpoint */ - m_ptr->SYS_SIG_ENDPT = rp->p_endpoint; - m_ptr->SYS_SIG_MAP = rp->p_pending; /* pending signals map */ + m_ptr->m_sigcalls.endpt = rp->p_endpoint; + m_ptr->m_sigcalls.map = rp->p_pending; /* pending signals map */ (void) sigemptyset(&rp->p_pending); /* clear map in the kernel */ RTS_UNSET(rp, RTS_SIGNALED); /* blocked by SIG_PENDING */ return(OK); @@ -37,8 +37,7 @@ int do_getksig(struct proc * caller, message * m_ptr) } /* No process with pending signals was found. */ - m_ptr->SYS_SIG_ENDPT = NONE; + m_ptr->m_sigcalls.endpt = NONE; return(OK); } #endif /* USE_GETKSIG */ - diff --git a/kernel/system/do_kill.c b/kernel/system/do_kill.c index 7bc4a9568..b3e22f735 100644 --- a/kernel/system/do_kill.c +++ b/kernel/system/do_kill.c @@ -1,9 +1,9 @@ /* The kernel call that is implemented in this file: - * m_type: SYS_KILL + * m_type: SYS_KILL * * The parameters for this kernel call are: - * m2_i1: SYS_SIG_ENDPT # process to signal/ pending - * m2_i2: SYS_SIG_NUMBER # signal number to send to process + * m_sigcalls.endpt # process to signal/ pending + * m_sigcalls.sig # signal number to send to process */ #include "kernel/system.h" @@ -23,9 +23,9 @@ int do_kill(struct proc * caller, message * m_ptr) * translated into an IPC message for system services. */ proc_nr_t proc_nr, proc_nr_e; - int sig_nr = m_ptr->SYS_SIG_NUMBER; + int sig_nr = m_ptr->m_sigcalls.sig; - proc_nr_e= (proc_nr_t) m_ptr->SYS_SIG_ENDPT; + proc_nr_e = (proc_nr_t)m_ptr->m_sigcalls.endpt; if (!isokendpt(proc_nr_e, &proc_nr)) return(EINVAL); if (sig_nr >= _NSIG) return(EINVAL); diff --git a/kernel/system/do_sigreturn.c b/kernel/system/do_sigreturn.c index 833010733..09fc7d65d 100644 --- a/kernel/system/do_sigreturn.c +++ b/kernel/system/do_sigreturn.c @@ -1,9 +1,9 @@ /* The kernel call that is implemented in this file: - * m_type: SYS_SIGRETURN + * m_type: SYS_SIGRETURN * * The parameters for this kernel call are: - * m2_i1: SIG_ENDPT # process returning from handler - * m2_p1: SIG_CTXT_PTR # pointer to sigcontext structure + * m_sigcalls.endp # process returning from handler + * m_sigcalls.sigctx # pointer to sigcontext structure * */ @@ -25,13 +25,14 @@ int do_sigreturn(struct proc * caller, message * m_ptr) register struct proc *rp; int proc_nr, r; - if (! isokendpt(m_ptr->SYS_SIG_ENDPT, &proc_nr)) return(EINVAL); - if (iskerneln(proc_nr)) return(EPERM); + if (!isokendpt(m_ptr->m_sigcalls.endpt, &proc_nr)) return EINVAL; + if (iskerneln(proc_nr)) return EPERM; rp = proc_addr(proc_nr); /* Copy in the sigcontext structure. */ - if((r=data_copy(m_ptr->SYS_SIG_ENDPT, (vir_bytes) m_ptr->SYS_SIG_CTXT_PTR, - KERNEL, (vir_bytes) &sc, sizeof(struct sigcontext))) != OK) + if ((r = data_copy(m_ptr->m_sigcalls.endpt, + (vir_bytes)m_ptr->m_sigcalls.sigctx, KERNEL, + (vir_bytes)&sc, sizeof(struct sigcontext))) != OK) return r; #if defined(__i386__) @@ -53,7 +54,7 @@ int do_sigreturn(struct proc * caller, message * m_ptr) /* Restore the registers. */ arch_proc_setcontext(rp, &sc.sc_regs, 1, sc.trap_style); #if defined(__i386__) - if(sc.sc_flags & MF_FPU_INITIALIZED) + if (sc.sc_flags & MF_FPU_INITIALIZED) { memcpy(rp->p_seg.fpu_state, &sc.sc_fpu_state, FPU_XFP_SIZE); rp->p_misc_flags |= MF_FPU_INITIALIZED; /* Restore math usage flag. */ @@ -62,7 +63,7 @@ int do_sigreturn(struct proc * caller, message * m_ptr) } #endif - return(OK); + return OK; } #endif /* USE_SIGRETURN */ diff --git a/kernel/system/do_sigsend.c b/kernel/system/do_sigsend.c index 95f46e3e1..430a2b083 100644 --- a/kernel/system/do_sigsend.c +++ b/kernel/system/do_sigsend.c @@ -1,10 +1,9 @@ /* The kernel call that is implemented in this file: - * m_type: SYS_SIGSEND + * m_type: SYS_SIGSEND * * The parameters for this kernel call are: - * m2_i1: SYS_SIG_ENDPT # process to call signal handler - * m2_p1: SYS_SIG_CTXT_PTR # pointer to sigcontext structure - * m2_i3: SYS_SIG_FLAGS # flags for S_SIGRETURN call + * m_sigcalls.endpt # process to call signal handler + * m_sigcalls.sigctx # pointer to sigcontext structure * */ @@ -27,14 +26,14 @@ int do_sigsend(struct proc * caller, message * m_ptr) struct sigframe fr, *frp; int proc_nr, r; - if (!isokendpt(m_ptr->SYS_SIG_ENDPT, &proc_nr)) return(EINVAL); - if (iskerneln(proc_nr)) return(EPERM); + if (!isokendpt(m_ptr->m_sigcalls.endpt, &proc_nr)) return EINVAL; + if (iskerneln(proc_nr)) return EPERM; rp = proc_addr(proc_nr); /* Get the sigmsg structure into our address space. */ - if((r=data_copy_vmcheck(caller, caller->p_endpoint, - (vir_bytes) m_ptr->SYS_SIG_CTXT_PTR, KERNEL, (vir_bytes) &smsg, - (phys_bytes) sizeof(struct sigmsg))) != OK) + if ((r = data_copy_vmcheck(caller, caller->p_endpoint, + (vir_bytes)m_ptr->m_sigcalls.sigctx, KERNEL, + (vir_bytes)&smsg, (phys_bytes) sizeof(struct sigmsg))) != OK) return r; /* Compute the user stack pointer where sigcontext will be stored. */ @@ -47,12 +46,12 @@ int do_sigsend(struct proc * caller, message * m_ptr) #if defined(__i386__) sc.trap_style = rp->p_seg.p_kern_trap_style; - if(sc.trap_style == KTS_NONE) { + if (sc.trap_style == KTS_NONE) { printf("do_sigsend: sigsend an unsaved process\n"); return EINVAL; } - if(proc_used_fpu(rp)) { + if (proc_used_fpu(rp)) { /* save the FPU context before saving it to the sig context */ save_fpu(rp); memcpy(&sc.sc_fpu_state, rp->p_seg.fpu_state, FPU_XFP_SIZE); @@ -64,8 +63,9 @@ int do_sigsend(struct proc * caller, message * m_ptr) sc.sc_flags = rp->p_misc_flags & MF_FPU_INITIALIZED; /* Copy the sigcontext structure to the user's stack. */ - if((r=data_copy_vmcheck(caller, KERNEL, (vir_bytes) &sc, m_ptr->SYS_SIG_ENDPT, - (vir_bytes) scp, (vir_bytes) sizeof(struct sigcontext))) != OK) + if ((r = data_copy_vmcheck(caller, KERNEL, (vir_bytes)&sc, + m_ptr->m_sigcalls.endpt, (vir_bytes)scp, + (vir_bytes)sizeof(struct sigcontext))) != OK) return r; /* Initialize the sigframe structure. */ @@ -96,9 +96,9 @@ int do_sigsend(struct proc * caller, message * m_ptr) #endif /* Copy the sigframe structure to the user's stack. */ - if((r=data_copy_vmcheck(caller, KERNEL, (vir_bytes) &fr, - m_ptr->SYS_SIG_ENDPT, (vir_bytes) frp, - (vir_bytes) sizeof(struct sigframe))) != OK) + if ((r = data_copy_vmcheck(caller, KERNEL, (vir_bytes)&fr, + m_ptr->m_sigcalls.endpt, (vir_bytes)frp, + (vir_bytes)sizeof(struct sigframe))) != OK) return r; /* Reset user registers to execute the signal handler. */ @@ -114,7 +114,7 @@ int do_sigsend(struct proc * caller, message * m_ptr) proc_stacktrace(caller); } - return(OK); + return OK; } #endif /* USE_SIGSEND */ diff --git a/lib/libsys/sys_endsig.c b/lib/libsys/sys_endsig.c index a93fe0c04..aa789febd 100644 --- a/lib/libsys/sys_endsig.c +++ b/lib/libsys/sys_endsig.c @@ -9,7 +9,7 @@ endpoint_t proc_ep; /* process number */ message m; int result; - m.SYS_SIG_ENDPT = proc_ep; + m.m_sigcalls.endpt = proc_ep; result = _kernel_call(SYS_ENDKSIG, &m); return(result); } diff --git a/lib/libsys/sys_getsig.c b/lib/libsys/sys_getsig.c index 30e335a33..cef42ced4 100644 --- a/lib/libsys/sys_getsig.c +++ b/lib/libsys/sys_getsig.c @@ -11,8 +11,8 @@ sigset_t *k_sig_map; /* return signal map here */ int result; result = _kernel_call(SYS_GETKSIG, &m); - *proc_ep = m.SYS_SIG_ENDPT; - *k_sig_map = m.SYS_SIG_MAP; + *proc_ep = m.m_sigcalls.endpt; + *k_sig_map = m.m_sigcalls.map; return(result); } diff --git a/lib/libsys/sys_kill.c b/lib/libsys/sys_kill.c index 7886c47ef..72a7f0b65 100644 --- a/lib/libsys/sys_kill.c +++ b/lib/libsys/sys_kill.c @@ -7,8 +7,8 @@ int signr; /* signal number: 1 - 16 */ /* A proc_ep has to be signaled via PM. Tell the kernel. */ message m; - m.SYS_SIG_ENDPT = proc_ep; - m.SYS_SIG_NUMBER = signr; + m.m_sigcalls.endpt = proc_ep; + m.m_sigcalls.sig = signr; return(_kernel_call(SYS_KILL, &m)); } diff --git a/lib/libsys/sys_sigreturn.c b/lib/libsys/sys_sigreturn.c index 15ed38a4c..aa15786f6 100644 --- a/lib/libsys/sys_sigreturn.c +++ b/lib/libsys/sys_sigreturn.c @@ -10,8 +10,8 @@ struct sigmsg *sig_ctxt; /* POSIX style handling */ message m; int result; - m.SYS_SIG_ENDPT = proc_ep; - m.SYS_SIG_CTXT_PTR = (char *) sig_ctxt; + m.m_sigcalls.endpt = proc_ep; + m.m_sigcalls.sigctx = sig_ctxt; result = _kernel_call(SYS_SIGRETURN, &m); return(result); } diff --git a/lib/libsys/sys_sigsend.c b/lib/libsys/sys_sigsend.c index 2d0eae933..47efc2fb1 100644 --- a/lib/libsys/sys_sigsend.c +++ b/lib/libsys/sys_sigsend.c @@ -10,8 +10,8 @@ struct sigmsg *sig_ctxt; /* POSIX style handling */ message m; int result; - m.SYS_SIG_ENDPT = proc_ep; - m.SYS_SIG_CTXT_PTR = (char *) sig_ctxt; + m.m_sigcalls.endpt = proc_ep; + m.m_sigcalls.sigctx = sig_ctxt; result = _kernel_call(SYS_SIGSEND, &m); return(result); } -- 2.44.0