System processes can be signaled; signals are transformed in SYS_EVENT message

that passes signal map along. This mechanisms is also used for nonuser signals
like SIGKMESS, SIGKSTOP, SIGKSIG.

Revised comments of many system call handlers. Renamed setpriority to nice.
This commit is contained in:
Jorrit Herder
2005-07-19 12:21:36 +00:00
parent f8c380c195
commit 198c976f7e
33 changed files with 289 additions and 395 deletions

View File

@@ -23,7 +23,7 @@ OBJECTS = \
$(SYSTEM)(do_newmap.o) \
$(SYSTEM)(do_exit.o) \
$(SYSTEM)(do_trace.o) \
$(SYSTEM)(do_schedctl.o) \
$(SYSTEM)(do_nice.o) \
$(SYSTEM)(do_times.o) \
$(SYSTEM)(do_alarm.o) \
$(SYSTEM)(do_irqctl.o) \
@@ -75,8 +75,8 @@ $(SYSTEM)(do_exit.o): do_exit.c
$(SYSTEM)(do_trace.o): do_trace.c
$(CC) do_trace.c
$(SYSTEM)(do_schedctl.o): do_schedctl.c
$(CC) do_schedctl.c
$(SYSTEM)(do_nice.o): do_nice.c
$(CC) do_nice.c
$(SYSTEM)(do_times.o): do_times.c
$(CC) do_times.c

View File

@@ -1,7 +1,3 @@
#include "../system.h"
#include <unistd.h>
/* The system call implemented in this file:
* m_type: SYS_ABORT
*
@@ -11,6 +7,10 @@
* m1_i3: ABRT_MON_LEN (length of monitor params)
* m1_p1: ABRT_MON_ADDR (virtual address of params)
*/
#include "../system.h"
#include <unistd.h>
#if USE_ABORT
/*===========================================================================*
@@ -24,7 +24,7 @@ message *m_ptr; /* pointer to request message */
* or ESC after debugging dumps).
*/
int how = m_ptr->ABRT_HOW;
if (how == RBT_MONITOR) {
/* The monitor is to run the specified instructions. */
int proc_nr = m_ptr->ABRT_MON_PROC;
@@ -33,8 +33,8 @@ message *m_ptr; /* pointer to request message */
phys_bytes src_phys = numap_local(proc_nr, src_vir, length);
/* Validate length and address of shutdown code before copying. */
if (length > kinfo.params_size || src_phys == 0)
phys_copy(vir2phys("delay;boot"), kinfo.params_base, 11);
if (length > kinfo.params_size || src_phys == 0)
phys_copy(vir2phys("delay;boot"), kinfo.params_base, 11);
else
phys_copy(src_phys, kinfo.params_base, (phys_bytes) length);
}

View File

@@ -5,10 +5,10 @@
* m2_i1: ALRM_PROC_NR (set alarm for this process)
* m2_l1: ALRM_EXP_TIME (alarm's expiration time)
* m2_i2: ALRM_ABS_TIME (expiration time is absolute?)
* m2_l1: ALRM_SEC_LEFT (return seconds left of previous)
* m2_l1: ALRM_TIME_LEFT (return seconds left of previous)
*
* Changes:
* Aug 25, 2004 fully rewritten to clean up code (Jorrit N. Herder)
* Aug 25, 2004 fully rewritten to clean up code (Jorrit N. Herder)
*/
#include "../system.h"
@@ -40,10 +40,10 @@ message *m_ptr; /* pointer to request message */
/* Get the timer structure and set the parameters for this alarm. */
tp = &(proc_addr(proc_nr)->p_priv->s_alarm_timer);
tmr_arg(tp)->ta_int = proc_nr;
tp->tmr_func = cause_alarm;
tp->tmr_func = cause_alarm;
/* Return the ticks left on the previous alarm. */
uptime = get_uptime();
uptime = get_uptime();
if ((tp->tmr_exp_time == TMR_NEVER) || (tp->tmr_exp_time < uptime) ) {
m_ptr->ALRM_TIME_LEFT = 0;
} else {
@@ -69,7 +69,7 @@ timer_t *tp;
{
/* Routine called if a timer goes off and the process requested a synchronous
* alarm. The process number is stored in timer argument 'ta_int'. Notify that
* process given with a SYN_ALARM message.
* process with a notification message from CLOCK.
*/
lock_alert(CLOCK, tmr_arg(tp)->ta_int);
}

View File

@@ -45,10 +45,8 @@ register message *m_ptr; /* pointer to request message */
/* Check if process number was given implictly with SELF and is valid. */
if (vir_addr[i].proc_nr == SELF) vir_addr[i].proc_nr = m_ptr->m_source;
if (! isokprocn(vir_addr[i].proc_nr) && vir_addr[i].segment != PHYS_SEG) {
kprintf("do_vircopy: illegal proc nr, while not phys addr\n",NO_NUM);
if (! isokprocn(vir_addr[i].proc_nr) && vir_addr[i].segment != PHYS_SEG)
return(EINVAL);
}
/* Check if physical addressing is used without SYS_PHYSCOPY. */
if ((vir_addr[i].segment & PHYS_SEG) &&
@@ -58,10 +56,7 @@ register message *m_ptr; /* pointer to request message */
/* Check for overflow. This would happen for 64K segments and 16-bit
* vir_bytes. Especially copying by the PM on do_fork() is affected.
*/
if (bytes != (vir_bytes) bytes) {
kprintf("do_vircopy: overflow\n", NO_NUM);
return(E2BIG);
}
if (bytes != (vir_bytes) bytes) return(E2BIG);
/* Now try to make the actual virtual copy. */
return( virtual_copy(&vir_addr[_SRC_], &vir_addr[_DST_], bytes) );

View File

@@ -1,20 +1,8 @@
/* The system call that is implemented in this file:
* SYS_SIGCTL # signal handling functionality
* m_type: SYS_ENDKSIG
*
* The parameters and types for this system call are:
* SIG_REQUEST # request to perform (long)
* SIG_PROC # process to signal/ pending (int)
* SIG_CTXT_PTR # pointer to sigcontext structure (pointer)
* SIG_FLAGS # flags for S_SIGRETURN call (int)
* SIG_MAP # bit map with pending signals (long)
* SIG_NUMBER # signal number to send to process (int)
*
* Supported request types are in the parameter SIG_REQUEST:
* S_GETSIG # get a pending kernel signal
* S_ENDSIG # signal has been processed
* S_SENDSIG # deliver a POSIX-style signal
* S_SIGRETURN # return from a POSIX-style signal
* S_KILL # send a signal to a process
* The parameters for this system call are:
* m2_i1: SIG_PROC # process for which PM is done
*/
#include "../system.h"

View File

@@ -3,7 +3,9 @@
*
* The parameters for this system call are:
* m1_i1: PR_PROC_NR (process that did exec call)
#if DEAD_CODE
* m1_i3: PR_TRACING (flag to indicate tracing is on/ off)
#endif
* m1_p1: PR_STACK_PTR (new stack pointer)
* m1_p2: PR_NAME_PTR (pointer to program name)
* m1_p3: PR_IP_PTR (new instruction pointer)
@@ -20,14 +22,15 @@ PUBLIC int do_exec(m_ptr)
register message *m_ptr; /* pointer to request message */
{
/* Handle sys_exec(). A process has done a successful EXEC. Patch it up. */
register struct proc *rp;
reg_t sp; /* new sp */
phys_bytes phys_name;
char *np;
rp = proc_addr(m_ptr->PR_PROC_NR);
#if DEAD_CODE
if (m_ptr->PR_TRACING) cause_sig(m_ptr->PR_PROC_NR, SIGTRAP);
#endif
sp = (reg_t) m_ptr->PR_STACK_PTR;
rp->p_reg.sp = sp; /* set the stack pointer */
#if (CHIP == M68000)

View File

@@ -26,25 +26,26 @@ register message *m_ptr; /* pointer to request message */
#if (CHIP == INTEL)
reg_t old_ldt_sel;
#endif
register struct proc *rpc;
struct proc *rpp;
register struct proc *rpc; /* child process pointer */
struct proc *rpp; /* parent process pointer */
rpp = proc_addr(m_ptr->PR_PPROC_NR);
rpc = proc_addr(m_ptr->PR_PROC_NR);
if (! isemptyp(rpc)) return(EINVAL);
if (isemptyp(rpp) || ! isemptyp(rpc)) return(EINVAL);
/* Copy parent 'proc' struct to child. */
/* Copy parent 'proc' struct to child. And reinitialize some fields. */
#if (CHIP == INTEL)
old_ldt_sel = rpc->p_ldt_sel; /* stop this being obliterated by copy */
#endif
*rpc = *rpp; /* copy 'proc' struct */
#if (CHIP == INTEL)
rpc->p_ldt_sel = old_ldt_sel;
old_ldt_sel = rpc->p_ldt_sel; /* backup local descriptors */
*rpc = *rpp; /* copy 'proc' struct */
rpc->p_ldt_sel = old_ldt_sel; /* restore descriptors */
#else
*rpc = *rpp; /* copy 'proc' struct */
#endif
rpc->p_nr = m_ptr->PR_PROC_NR; /* this was obliterated by copy */
#if TEMP_CODE
rpc->p_ntf_q = NULL; /* remove pending notifications */
#endif
/* Only one in group should have SIGNALED, child doesn't inherit tracing. */
rpc->p_rts_flags |= NO_MAP; /* inhibit process from running */

View File

@@ -6,8 +6,8 @@
* m1_i4: I_PROC_NR (process to store value at)
* m1_p1: I_VAL_PTR (where to put it)
* m1_i1: I_VAL_LEN (maximum length expected, optional)
* m1_p2: I_KEY_PTR (environment variable key)
* m1_i2: I_KEY_LEN (lenght of environment variable key)
* m1_p2: I_VAL_PTR2 (second, optional pointer)
* m1_i2: I_VAL_LEN2 (second length or process nr)
*
* Author:
* Jorrit N. Herder <jnherder@cs.vu.nl>
@@ -29,26 +29,26 @@ register message *m_ptr; /* pointer to request message */
phys_bytes dst_phys;
int proc_nr, nr;
/* Set source address and length based on request type. */
/* Set source address and length based on request type. */
switch (m_ptr->I_REQUEST) {
case GET_MACHINE: {
length = sizeof(struct machine);
src_phys = vir2phys(&machine);
break;
length = sizeof(struct machine);
src_phys = vir2phys(&machine);
break;
}
case GET_KINFO: {
length = sizeof(struct kinfo);
src_phys = vir2phys(&kinfo);
break;
length = sizeof(struct kinfo);
src_phys = vir2phys(&kinfo);
break;
}
case GET_IMAGE: {
length = sizeof(struct system_image) * NR_BOOT_PROCS;
src_phys = vir2phys(image);
length = sizeof(struct system_image) * NR_BOOT_PROCS;
src_phys = vir2phys(image);
break;
}
case GET_IRQHOOKS: {
length = sizeof(struct irq_hook) * NR_IRQ_HOOKS;
src_phys = vir2phys(irq_hooks);
length = sizeof(struct irq_hook) * NR_IRQ_HOOKS;
src_phys = vir2phys(irq_hooks);
break;
}
case GET_SCHEDINFO: {
@@ -58,37 +58,36 @@ register message *m_ptr; /* pointer to request message */
*/
length = sizeof(struct proc *) * NR_SCHED_QUEUES;
src_phys = vir2phys(rdy_head);
dst_phys = numap_local(m_ptr->m_source, (vir_bytes) m_ptr->I_KEY_PTR,
length);
dst_phys = numap_local(m_ptr->m_source, (vir_bytes) m_ptr->I_VAL_PTR2,
length);
if (src_phys == 0 || dst_phys == 0) return(EFAULT);
phys_copy(src_phys, dst_phys, length);
/* fall through */
}
case GET_PROCTAB: {
length = sizeof(struct proc) * (NR_PROCS + NR_TASKS);
src_phys = vir2phys(proc);
length = sizeof(struct proc) * (NR_PROCS + NR_TASKS);
src_phys = vir2phys(proc);
break;
}
case GET_PRIVTAB: {
length = sizeof(struct priv) * (NR_SYS_PROCS);
src_phys = vir2phys(priv);
length = sizeof(struct priv) * (NR_SYS_PROCS);
src_phys = vir2phys(priv);
break;
}
case GET_PROC: {
nr = (m_ptr->I_KEY_LEN == SELF) ? m_ptr->m_source : m_ptr->I_KEY_LEN;
if (! isokprocn(nr)) return(EINVAL); /* validate request */
length = sizeof(struct proc);
src_phys = vir2phys(proc_addr(nr));
nr = (m_ptr->I_VAL_LEN2 == SELF) ? m_ptr->m_source : m_ptr->I_VAL_LEN2;
if (! isokprocn(nr)) return(EINVAL); /* validate request */
length = sizeof(struct proc);
src_phys = vir2phys(proc_addr(nr));
break;
}
case GET_MONPARAMS: {
src_phys = kinfo.params_base; /* already is a physical */
length = kinfo.params_size;
break;
src_phys = kinfo.params_base; /* already is a physical */
length = kinfo.params_size;
break;
}
case GET_RANDOMNESS: {
static struct randomness copy; /* copy to keep counters */
static struct randomness copy; /* copy to keep counters */
int i;
copy = krandom;
@@ -107,9 +106,9 @@ register message *m_ptr; /* pointer to request message */
}
#if DEBUG_TIME_LOCKS
case GET_LOCKTIMING: {
length = sizeof(timingdata);
src_phys = vir2phys(timingdata);
break;
length = sizeof(timingdata);
src_phys = vir2phys(timingdata);
break;
}
#endif
default:

View File

@@ -1,20 +1,10 @@
/* The system call that is implemented in this file:
* SYS_SIGCTL # signal handling functionality
* m_type: SYS_GETKSIG
*
* The parameters and types for this system call are:
* SIG_REQUEST # request to perform (long)
* SIG_PROC # process to signal/ pending (int)
* SIG_CTXT_PTR # pointer to sigcontext structure (pointer)
* SIG_FLAGS # flags for S_SIGRETURN call (int)
* SIG_MAP # bit map with pending signals (long)
* SIG_NUMBER # signal number to send to process (int)
* The parameters for this system call are:
* m2_i1: SIG_PROC # process with pending signals
* m2_l1: SIG_MAP # bit map with pending signals
*
* Supported request types are in the parameter SIG_REQUEST:
* S_GETSIG # get a pending kernel signal
* S_ENDSIG # signal has been processed
* S_SENDSIG # deliver a POSIX-style signal
* S_SIGRETURN # return from a POSIX-style signal
* S_KILL # send a signal to a process
*/
#include "../system.h"
@@ -32,16 +22,18 @@ message *m_ptr; /* pointer to request message */
/* PM is ready to accept signals and repeatedly does a system call to get
* one. Find a process with pending signals. If no signals are available,
* return NONE in the process number field.
* It is not sufficient to ready the process when PM is informed, because
* PM can block waiting for FS to do a core dump.
*/
register struct proc *rp;
/* Find the next process with pending signals. */
for (rp = BEG_USER_ADDR; rp < END_PROC_ADDR; rp++) {
if (rp->p_rts_flags & SIGNALED) {
m_ptr->SIG_PROC = rp->p_nr;
m_ptr->SIG_MAP = rp->p_pending;
sigemptyset(&rp->p_pending); /* ball is in PM's court */
rp->p_rts_flags &= ~SIGNALED; /* blocked by SIG_PENDING */
m_ptr->SIG_PROC = rp->p_nr; /* store signaled process */
m_ptr->SIG_MAP = rp->p_pending; /* pending signals map */
sigemptyset(&rp->p_pending); /* ball is in PM's court */
rp->p_rts_flags &= ~SIGNALED; /* blocked by SIG_PENDING */
return(OK);
}
}

View File

@@ -37,15 +37,15 @@ register message *m_ptr; /* pointer to request message */
/* Enable or disable IRQs. This is straightforward. */
case IRQ_ENABLE:
case IRQ_DISABLE:
if (irq_hook_id >= NR_IRQ_HOOKS ||
irq_hooks[irq_hook_id].proc_nr == NONE) return(EINVAL);
if (irq_hook_id >= NR_IRQ_HOOKS ||
irq_hooks[irq_hook_id].proc_nr == NONE) return(EINVAL);
if (irq_hooks[irq_hook_id].proc_nr != m_ptr->m_source) return(EPERM);
if (m_ptr->IRQ_REQUEST == IRQ_ENABLE)
enable_irq(&irq_hooks[irq_hook_id]);
else
disable_irq(&irq_hooks[irq_hook_id]);
break;
/* Control IRQ policies. Set a policy and needed details in the IRQ table.
* This policy is used by a generic function to handle hardware interrupts.
@@ -53,10 +53,7 @@ register message *m_ptr; /* pointer to request message */
case IRQ_SETPOLICY:
/* Check if IRQ line is acceptable. */
if (irq_vec < 0 || irq_vec >= NR_IRQ_VECTORS) {
kprintf("ST: irq line %d is not acceptable!\n", irq_vec);
return(EINVAL);
}
if (irq_vec < 0 || irq_vec >= NR_IRQ_VECTORS) return(EINVAL);
/* Find a free IRQ hook for this mapping. */
hook_ptr = NULL;
@@ -77,18 +74,16 @@ register message *m_ptr; /* pointer to request message */
m_ptr->IRQ_HOOK_ID = irq_hook_id + 1;
break;
case IRQ_RMPOLICY:
if (irq_hook_id >= NR_IRQ_HOOKS ||
irq_hooks[irq_hook_id].proc_nr == NONE) {
r = EINVAL;
} else {
if (m_ptr->m_source != irq_hooks[irq_hook_id].proc_nr) {
r = EPERM;
} else {
r = rm_irq_handler(irq_vec, irq_hooks[irq_hook_id].id);
}
}
break;
case IRQ_RMPOLICY:
if (irq_hook_id >= NR_IRQ_HOOKS ||
irq_hooks[irq_hook_id].proc_nr == NONE) {
return(EINVAL);
} else if (m_ptr->m_source != irq_hooks[irq_hook_id].proc_nr) {
return(EPERM);
} else {
r = rm_irq_handler(irq_vec, irq_hooks[irq_hook_id].id);
}
break;
default:
r = EINVAL; /* invalid IRQ_REQUEST */

View File

@@ -1,20 +1,9 @@
/* The system call that is implemented in this file:
* SYS_SIGCTL # signal handling functionality
* m_type: SYS_KILL
*
* The parameters and types for this system call are:
* SIG_REQUEST # request to perform (long)
* SIG_PROC # process to signal/ pending (int)
* SIG_CTXT_PTR # pointer to sigcontext structure (pointer)
* SIG_FLAGS # flags for S_SIGRETURN call (int)
* SIG_MAP # bit map with pending signals (long)
* SIG_NUMBER # signal number to send to process (int)
*
* Supported request types are in the parameter SIG_REQUEST:
* S_GETSIG # get a pending kernel signal
* S_ENDSIG # signal has been processed
* S_SENDSIG # deliver a POSIX-style signal
* S_SIGRETURN # return from a POSIX-style signal
* S_KILL # send a signal to a process
* The parameters for this system call are:
* m2_i1: SIG_PROC # process to signal/ pending
* m2_i2: SIG_NUMBER # signal number to send to process
*/
#include "../system.h"
@@ -29,11 +18,27 @@
PUBLIC int do_kill(m_ptr)
message *m_ptr; /* pointer to request message */
{
/* Handle sys_kill(). Cause a signal to be sent to a process via PM.
* Note that this has nothing to do with the kill (2) system call, this
* is how the FS (and possibly other servers) get access to cause_sig.
/* Handle sys_kill(). Cause a signal to be sent to a process. The PM is the
* central server where all signals are processed and handler policies can
* be registered. Any request, except for PM requests, is added to the map
* of pending signals and the PM is informed about the new signal.
* Since system servers cannot use normal POSIX signal handlers (because they
* are usually blocked on a RECEIVE), they can request the PM to transform
* signals into messages. This is done by the PM with a call to sys_kill().
*/
cause_sig(m_ptr->SIG_PROC, m_ptr->SIG_NUMBER);
proc_nr_t proc_nr = m_ptr->SIG_PROC;
int sig_nr = m_ptr->SIG_NUMBER;
if (! isokprocn(proc_nr) || sig_nr > _NSIG) return(EINVAL);
if (m_ptr->m_source == PM_PROC_NR) {
/* Directly send signal notification to a system process. */
if (! (priv(proc_addr(proc_nr))->s_flags & SYS_PROC)) return(EPERM);
send_sig(proc_nr, sig_nr);
} else {
/* Set pending signal to be processed by the PM. */
cause_sig(proc_nr, sig_nr);
}
return(OK);
}

View File

@@ -3,7 +3,7 @@
*
* The parameters for this system call are:
* m1_i1: PR_PROC_NR (install new map for this process)
* m1_p1: PR_MEM_PTR (pointer to memory map)
* m1_p1: PR_MEM_PTR (pointer to the new memory map)
*/
#include "../system.h"
@@ -16,24 +16,21 @@ PUBLIC int do_newmap(m_ptr)
message *m_ptr; /* pointer to request message */
{
/* Handle sys_newmap(). Fetch the memory map from PM. */
register struct proc *rp;
phys_bytes src_phys;
register struct proc *rp; /* process whose map is to be loaded */
int caller; /* whose space has the new map (usually PM) */
int k; /* process whose map is to be loaded */
int old_flags; /* value of flags before modification */
struct mem_map *map_ptr; /* virtual address of map inside caller (PM) */
phys_bytes src_phys; /* physical address of map at the PM */
int old_flags; /* value of flags before modification */
/* Extract message parameters and copy new memory map from PM. */
caller = m_ptr->m_source;
k = m_ptr->PR_PROC_NR;
map_ptr = (struct mem_map *) m_ptr->PR_MEM_PTR;
if (!isokprocn(k)) return(EINVAL);
rp = proc_addr(k); /* ptr to entry of user getting new map */
if (! isokprocn(m_ptr->PR_PROC_NR)) return(EINVAL);
rp = proc_addr(m_ptr->PR_PROC_NR);
/* Copy the map from PM. */
src_phys = umap_local(proc_addr(caller), D, (vir_bytes) map_ptr,
sizeof(rp->p_memmap));
sizeof(rp->p_memmap));
if (src_phys == 0) return(EFAULT);
phys_copy(src_phys,vir2phys(rp->p_memmap),(phys_bytes)sizeof(rp->p_memmap));

View File

@@ -44,8 +44,8 @@ register message *m_ptr; /* pointer to request message */
}
} else if (m_ptr->DIO_REQUEST == DIO_OUTPUT) {
switch (m_ptr->DIO_TYPE) {
case DIO_BYTE: phys_outsb(port, phys_buf, count); break;
case DIO_WORD: phys_outsw(port, phys_buf, count); break;
case DIO_BYTE: phys_outsb(port, phys_buf, count); break;
case DIO_WORD: phys_outsw(port, phys_buf, count); break;
default: return(EINVAL);
}
}

View File

@@ -37,13 +37,13 @@ register message *m_ptr; /* pointer to request message */
rp = proc_addr(m_ptr->m_source);
index = -1;
for (i=0; i < NR_REMOTE_SEGS; i++) {
if (! rp->p_priv->s_farmem[i].in_use) {
index = i;
rp->p_priv->s_farmem[i].in_use = TRUE;
rp->p_priv->s_farmem[i].mem_phys = phys;
rp->p_priv->s_farmem[i].mem_len = size;
break;
}
if (! rp->p_priv->s_farmem[i].in_use) {
index = i;
rp->p_priv->s_farmem[i].in_use = TRUE;
rp->p_priv->s_farmem[i].mem_phys = phys;
rp->p_priv->s_farmem[i].mem_len = size;
break;
}
}
if (index < 0) return(ENOSPC);
@@ -63,7 +63,7 @@ register message *m_ptr; /* pointer to request message */
USER_PRIVILEGE);
selector = ((EXTRA_LDT_INDEX+i)*0x08) | (1*0x04) | USER_PRIVILEGE;
offset = 0;
result = OK;
result = OK;
} else {
init_dataseg(&rp->p_ldt[EXTRA_LDT_INDEX+i], phys & ~0xFFFF, 0,
USER_PRIVILEGE);

View File

@@ -1,20 +1,10 @@
/* The system call that is implemented in this file:
* SYS_SIGCTL # signal handling functionality
* m_type: SYS_SIGRETURN
*
* The parameters and types for this system call are:
* SIG_REQUEST # request to perform (long)
* SIG_PROC # process to signal/ pending (int)
* SIG_CTXT_PTR # pointer to sigcontext structure (pointer)
* SIG_FLAGS # flags for S_SIGRETURN call (int)
* SIG_MAP # bit map with pending signals (long)
* SIG_NUMBER # signal number to send to process (int)
* The parameters for this system call are:
* m2_i1: SIG_PROC # process returning from handler
* m2_p1: SIG_CTXT_PTR # pointer to sigcontext structure
*
* Supported request types are in the parameter SIG_REQUEST:
* S_GETSIG # get a pending kernel signal
* S_ENDSIG # signal has been processed
* S_SENDSIG # deliver a POSIX-style signal
* S_SIGRETURN # return from a POSIX-style signal
* S_KILL # send a signal to a process
*/
#include "../system.h"

View File

@@ -1,20 +1,11 @@
/* The system call that is implemented in this file:
* SYS_SIGCTL # signal handling functionality
* m_type: SYS_SIGSEND
*
* The parameters and types for this system call are:
* SIG_REQUEST # request to perform (long)
* SIG_PROC # process to signal/ pending (int)
* SIG_CTXT_PTR # pointer to sigcontext structure (pointer)
* SIG_FLAGS # flags for S_SIGRETURN call (int)
* SIG_MAP # bit map with pending signals (long)
* SIG_NUMBER # signal number to send to process (int)
* The parameters for this system call are:
* m2_i1: SIG_PROC # process to call signal handler
* m2_p1: SIG_CTXT_PTR # pointer to sigcontext structure
* m2_i3: SIG_FLAGS # flags for S_SIGRETURN call
*
* Supported request types are in the parameter SIG_REQUEST:
* S_GETSIG # get a pending kernel signal
* S_ENDSIG # signal has been processed
* S_SENDSIG # deliver a POSIX-style signal
* S_SIGRETURN # return from a POSIX-style signal
* S_KILL # send a signal to a process
*/
#include "../system.h"

View File

@@ -48,24 +48,24 @@ register message *m_ptr; /* pointer to request message */
phys_bytes caller_phys; /* physical address at caller */
phys_bytes kernel_phys; /* physical address in kernel */
/* Check if nr of ports is ok and get size of (port,value) data. */
if (m_ptr->DIO_VEC_SIZE <= 0) return(EINVAL);
switch(m_ptr->DIO_TYPE) {
case DIO_BYTE:
if (m_ptr->DIO_VEC_SIZE > MAX_PVB_PAIRS) return(EINVAL);
bytes = (size_t) (m_ptr->DIO_VEC_SIZE * sizeof(pvb_pair_t));
break;
case DIO_WORD:
if (m_ptr->DIO_VEC_SIZE > MAX_PVW_PAIRS) return(EINVAL);
bytes = (size_t) (m_ptr->DIO_VEC_SIZE * sizeof(pvw_pair_t));
break;
case DIO_LONG:
if (m_ptr->DIO_VEC_SIZE > MAX_PVL_PAIRS) return(EINVAL);
bytes = (size_t) (m_ptr->DIO_VEC_SIZE * sizeof(pvl_pair_t));
break;
default: /* this once and for all checks for a correct type */
return(EINVAL);
case DIO_BYTE:
if (m_ptr->DIO_VEC_SIZE > MAX_PVB_PAIRS) return(EINVAL);
bytes = (size_t) (m_ptr->DIO_VEC_SIZE * sizeof(pvb_pair_t));
break;
case DIO_WORD:
if (m_ptr->DIO_VEC_SIZE > MAX_PVW_PAIRS) return(EINVAL);
bytes = (size_t) (m_ptr->DIO_VEC_SIZE * sizeof(pvw_pair_t));
break;
case DIO_LONG:
if (m_ptr->DIO_VEC_SIZE > MAX_PVL_PAIRS) return(EINVAL);
bytes = (size_t) (m_ptr->DIO_VEC_SIZE * sizeof(pvl_pair_t));
break;
default: /* this once and for all checks for a correct type */
return(EINVAL);
}
/* Calculate physical addresses and copy (port,value)-pairs from user. */