From d3874a7917357e023788d00b6ff293e9ab983c8b Mon Sep 17 00:00:00 2001 From: Jorrit Herder Date: Fri, 29 Jul 2005 15:00:49 +0000 Subject: [PATCH] Updated servers according to syslib interface changes. --- servers/fs/main.c | 2 +- servers/fs/timers.c | 6 ++-- servers/inet/clock.c | 2 +- servers/inet/sr.c | 4 +-- servers/is/dmp_kernel.c | 62 ++++++++++++++++++++++++++++++----------- servers/pm/forkexit.c | 2 +- servers/pm/main.c | 4 +-- servers/pm/signal.c | 2 +- servers/pm/timers.c | 6 ++-- 9 files changed, 60 insertions(+), 30 deletions(-) diff --git a/servers/fs/main.c b/servers/fs/main.c index bad8f1027..ada88206c 100644 --- a/servers/fs/main.c +++ b/servers/fs/main.c @@ -76,7 +76,7 @@ PUBLIC void main() } else if (call_nr == DEV_SELECTED) { printf("Old select device callback received - ignored\n"); } else if ((call_nr & NOTIFY_MESSAGE)) { - /* Device notifies (alert()s) us of an event. */ + /* Device notifies us of an event. */ dev_status(&m_in); } else { /* Call the internal function that does the work. */ diff --git a/servers/fs/timers.c b/servers/fs/timers.c index b0253c61d..910f4708c 100644 --- a/servers/fs/timers.c +++ b/servers/fs/timers.c @@ -25,7 +25,7 @@ PUBLIC void fs_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg) /* reschedule our synchronous alarm if necessary */ if(!old_head || old_head > new_head) { - if(sys_syncalrm(SELF, new_head, 1) != OK) + if(sys_setalarm(new_head, 1) != OK) panic(__FILE__, "FS set timer couldn't set synchronous alarm.", NO_NUM); #if VERBOSE else @@ -41,7 +41,7 @@ PUBLIC void fs_expire_timers(clock_t now) clock_t new_head; tmrs_exptimers(&fs_timers, now, &new_head); if(new_head > 0) { - if(sys_syncalrm(SELF, new_head, 1) != OK) + if(sys_setalarm(new_head, 1) != OK) panic(__FILE__, "FS expire timer couldn't set synchronous alarm.", NO_NUM); #if VERBOSE else @@ -69,7 +69,7 @@ PUBLIC void fs_cancel_timer(timer_t *tp) * will be 0 then). */ if(old_head < new_head || !new_head) { - if(sys_syncalrm(SELF, new_head, 1) != OK) + if(sys_setalarm(new_head, 1) != OK) panic(__FILE__, "FS expire timer couldn't set synchronous alarm.", NO_NUM); #if VERBOSE printf("timers: after cancelling, set synalarm to %d -> %d\n", old_head, new_head); diff --git a/servers/inet/clock.c b/servers/inet/clock.c index 5e07c6d77..24a85982d 100644 --- a/servers/inet/clock.c +++ b/servers/inet/clock.c @@ -191,7 +191,7 @@ PRIVATE void set_timer() next_timeout= new_time; new_time -= curr_time; - if (sys_syncalrm(SELF, new_time, 0) != OK) + if (sys_setalarm(new_time, 0) != OK) ip_panic(("can't set timer")); #endif } diff --git a/servers/inet/sr.c b/servers/inet/sr.c index 3902ad1d4..c25457d81 100644 --- a/servers/inet/sr.c +++ b/servers/inet/sr.c @@ -752,7 +752,7 @@ int is_revive; #endif if (is_revive) { - alert(mq->mq_mess.m_source); + notify(mq->mq_mess.m_source); result= ELOCKED; } else @@ -912,7 +912,7 @@ unsigned ops; if (ops & SR_SELECT_WRITE) sr_fd->srf_flags |= SFF_SELECT_W; if (ops & SR_SELECT_EXCEPTION) sr_fd->srf_flags |= SFF_SELECT_X; - alert(sr_fd->srf_select_proc); + notify(sr_fd->srf_select_proc); } #endif diff --git a/servers/is/dmp_kernel.c b/servers/is/dmp_kernel.c index 558631adc..a600dfdc9 100644 --- a/servers/is/dmp_kernel.c +++ b/servers/is/dmp_kernel.c @@ -8,12 +8,16 @@ #include "../../kernel/debug.h" #include "../../kernel/type.h" #include "../../kernel/proc.h" +#include "../../kernel/ipc.h" #define click_to_round_k(n) \ ((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024)) /* Declare some local dump procedures. */ FORWARD _PROTOTYPE( char *proc_name, (int proc_nr) ); +FORWARD _PROTOTYPE( char *s_traps_str, (int flags) ); +FORWARD _PROTOTYPE( char *s_flags_str, (int flags) ); +FORWARD _PROTOTYPE( char *p_rts_flags_str, (int flags) ); /* Some global data that is shared among several dumping procedures. @@ -22,7 +26,7 @@ FORWARD _PROTOTYPE( char *proc_name, (int proc_nr) ); */ PUBLIC struct proc proc[NR_TASKS + NR_PROCS]; PUBLIC struct priv priv[NR_SYS_PROCS]; -PUBLIC struct system_image image[NR_BOOT_PROCS]; +PUBLIC struct boot_image image[NR_BOOT_PROCS]; @@ -184,7 +188,7 @@ PUBLIC void irqtab_dmp() PUBLIC void image_dmp() { int m, i,j,r; - struct system_image *ip; + struct boot_image *ip; static char send_mask[BITCHUNK_BITS*2]; if ((r = sys_getimage(image)) != OK) { @@ -192,7 +196,7 @@ PUBLIC void image_dmp() return; } printf("Image table dump showing all processes included in system image.\n"); - printf("---name-- -nr- -flags- -q- ----pc- -stack- ----sendmask[0]-----\n"); + printf("---name-- -nr- -flags- -traps- -sq- ----pc- -stack- -sendmask[0]------\n"); for (m=0; mproc_name, ip->proc_nr, ip->flags, ip->priority, - (long)ip->initial_pc, ip->stksize, send_mask); + printf("%8s %4d %s %s %3d %7lu %7lu %s\n", + ip->proc_name, ip->proc_nr, + s_flags_str(ip->flags), s_traps_str(ip->call_mask), + ip->priority, (long)ip->initial_pc, ip->stksize, send_mask); } printf("\n"); } @@ -311,7 +316,21 @@ PRIVATE char *s_flags_str(int flags) str[1] = (flags & RDY_Q_HEAD) ? 'Q' : '-'; str[2] = (flags & BILLABLE) ? 'B' : '-'; str[3] = (flags & SYS_PROC) ? 'S' : '-'; - str[4] = '\0'; + str[4] = '-'; + str[5] = '\0'; + + return str; +} + +PRIVATE char *s_traps_str(int flags) +{ + static char str[10]; + str[0] = (flags & (1 << ECHO)) ? 'E' : '-'; + str[1] = (flags & (1 << SEND)) ? 'S' : '-'; + str[2] = (flags & (1 << RECEIVE)) ? 'R' : '-'; + str[3] = (flags & (1 << SENDREC)) ? 'B' : '-'; + str[4] = (flags & (1 << NOTIFY)) ? 'N' : '-'; + str[5] = '\0'; return str; } @@ -338,7 +357,7 @@ PUBLIC void privileges_dmp() return; } - printf("\n--nr-id-name---- -flags- -traps- -send mask-\n"); + printf("\n--nr-id-name---- -flags- -traps- -send mask------------------------- \n"); for (rp = oldrp; rp < END_PROC_ADDR; rp++) { if (isemptyp(rp)) continue; @@ -352,9 +371,9 @@ PUBLIC void privileges_dmp() if (r == -1 && ! (rp->p_rts_flags & SLOT_FREE)) { sp = &priv[USER_PRIV_ID]; } - printf("(%02u) %-7.7s %5s 0x%03.3x ", + printf("(%02u) %-7.7s %s %s ", sp->s_id, rp->p_name, - s_flags_str(sp->s_flags), sp->s_call_mask + s_flags_str(sp->s_flags), s_traps_str(sp->s_call_mask) ); for (i=j=0; i < NR_SYS_PROCS; i++, j++) { send_mask[j] = get_sys_bit(sp->s_send_mask, i) ? '1' : '0'; @@ -419,6 +438,20 @@ PUBLIC void sendmask_dmp() } +PRIVATE char *p_rts_flags_str(int flags) +{ + static char str[10]; + str[0] = (flags & NO_MAP) ? 'M' : '-'; + str[1] = (flags & SENDING) ? 'S' : '-'; + str[2] = (flags & RECEIVING) ? 'R' : '-'; + str[3] = (flags & SIGNALED) ? 'S' : '-'; + str[4] = (flags & SIG_PENDING) ? 'P' : '-'; + str[5] = (flags & P_STOP) ? 'T' : '-'; + str[6] = '\0'; + + return str; +} + /*===========================================================================* * proctab_dmp * @@ -451,7 +484,7 @@ PUBLIC void proctab_dmp() if (proc_nr(rp) == IDLE) printf("(%2d) ", proc_nr(rp)); else if (proc_nr(rp) < 0) printf("[%2d] ", proc_nr(rp)); else printf(" %2d ", proc_nr(rp)); - printf(" %-7.7s %02u/%02u %02d/%02d %02u %6lu%6lu %6uK%6uK%6uK %3x", + printf(" %-8.8s %02u/%02u %02d/%02d %02u %6lu%6lu %6uK%6uK%6uK %s", rp->p_name, rp->p_priority, rp->p_max_priority, rp->p_sched_ticks, rp->p_quantum_size, @@ -459,13 +492,10 @@ PUBLIC void proctab_dmp() rp->p_user_time, rp->p_sys_time, click_to_round_k(text), click_to_round_k(data), click_to_round_k(size), - rp->p_rts_flags); - if (rp->p_rts_flags & RECEIVING) { + p_rts_flags_str(rp->p_rts_flags)); + if (rp->p_rts_flags & (SENDING|RECEIVING)) { printf(" %-7.7s", proc_name(rp->p_getfrom)); } else - if (rp->p_rts_flags & SENDING) { - printf(" S:%-5.5s", proc_name(rp->p_sendto)); - } else if (rp->p_rts_flags == 0) { printf(" "); } diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index a8c9713a0..ea95e1e75 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -94,7 +94,7 @@ PUBLIC int do_fork() rmc->mp_pid = new_pid; /* assign pid to child */ /* Tell kernel and file system about the (now successful) FORK. */ - sys_fork(who, child_nr, rmc->mp_pid); + sys_fork(who, child_nr); tell_fs(FORK, who, child_nr, rmc->mp_pid); /* Report child's memory map to kernel. */ diff --git a/servers/pm/main.c b/servers/pm/main.c index 3b591488e..555f7dec7 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -140,8 +140,8 @@ PRIVATE void pm_init() { /* Initialize the process manager. */ int key, i, s; - static struct system_image image[NR_BOOT_PROCS]; - register struct system_image *ip; + static struct boot_image image[NR_BOOT_PROCS]; + register struct boot_image *ip; static char core_sigs[] = { SIGQUIT, SIGILL, SIGTRAP, SIGABRT, SIGEMT, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2 }; static char ign_sigs[] = { SIGCHLD }; diff --git a/servers/pm/signal.c b/servers/pm/signal.c index 502f4cde8..2ec7cd2f4 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -181,7 +181,7 @@ PUBLIC int do_sigreturn() mp->mp_sigmask = (sigset_t) m_in.sig_set; sigdelset(&mp->mp_sigmask, SIGKILL); - r = sys_sigreturn(who, (struct sigmsg *) m_in.sig_context, m_in.sig_flags); + r = sys_sigreturn(who, (struct sigmsg *) m_in.sig_context); check_pending(mp); return(r); } diff --git a/servers/pm/timers.c b/servers/pm/timers.c index 13815a10b..94fcf5a1f 100644 --- a/servers/pm/timers.c +++ b/servers/pm/timers.c @@ -26,7 +26,7 @@ PUBLIC void pm_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg) /* reschedule our synchronous alarm if necessary */ if(! prev_time || prev_time > next_time) { - if(sys_syncalrm(SELF, next_time, 1) != OK) + if(sys_setalarm(next_time, 1) != OK) panic(__FILE__, "PM set timer couldn't set synchronous alarm.", NO_NUM); #if VERBOSE else @@ -42,7 +42,7 @@ PUBLIC void pm_expire_timers(clock_t now) clock_t next_time; tmrs_exptimers(&pm_timers, now, &next_time); if(next_time > 0) { - if(sys_syncalrm(SELF, next_time, 1) != OK) + if(sys_setalarm(next_time, 1) != OK) panic(__FILE__, "PM expire timer couldn't set synchronous alarm.", NO_NUM); #if VERBOSE else @@ -65,7 +65,7 @@ PUBLIC void pm_cancel_timer(timer_t *tp) * will be 0 then). */ if(prev_time < next_time || ! next_time) { - if(sys_syncalrm(SELF, next_time, 1) != OK) + if(sys_setalarm(next_time, 1) != OK) panic(__FILE__, "PM expire timer couldn't set synchronous alarm.", NO_NUM); #if VERBOSE printf("timers: after cancelling, set synalarm to %d -> %d\n", prev_time, next_time);