Renamed system library functionality.
Updated debug dumps of IS server.
This commit is contained in:
parent
279250889f
commit
570eac1f53
23 changed files with 168 additions and 93 deletions
|
@ -61,14 +61,17 @@ PUBLIC void main()
|
||||||
super_user = (fp->fp_effuid == SU_UID ? TRUE : FALSE); /* su? */
|
super_user = (fp->fp_effuid == SU_UID ? TRUE : FALSE); /* su? */
|
||||||
|
|
||||||
/* Check for special control messages first. */
|
/* Check for special control messages first. */
|
||||||
|
#if DEAD_CODE
|
||||||
if (call_nr == HARD_STOP) {
|
if (call_nr == HARD_STOP) {
|
||||||
do_sync();
|
do_sync();
|
||||||
sys_exit(0); /* never returns */
|
sys_exit(0); /* never returns */
|
||||||
} else if(call_nr == SYN_ALARM) {
|
} else
|
||||||
|
#endif
|
||||||
|
if(call_nr == SYN_ALARM) {
|
||||||
/* Not a user request; system has expired one of our timers,
|
/* Not a user request; system has expired one of our timers,
|
||||||
* currently only in use for select(). Check it.
|
* currently only in use for select(). Check it.
|
||||||
*/
|
*/
|
||||||
fs_expire_timers(m_in.NOTIFY_ARG);
|
fs_expire_timers(m_in.NOTIFY_TIMESTAMP);
|
||||||
} else if(call_nr == DEV_SELECTED) {
|
} else if(call_nr == DEV_SELECTED) {
|
||||||
/* Device notify()s us of fd that has become usable. */
|
/* Device notify()s us of fd that has become usable. */
|
||||||
select_notified(&m_in);
|
select_notified(&m_in);
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
* 6 june 2005 Created (Ben Gras)
|
* 6 june 2005 Created (Ben Gras)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* TODO: check if close (pipe?) / exit works;
|
/* TODO: check if close (pipe?) / exit works;
|
||||||
* some printf()s are serious errors;
|
* some printf()s are serious errors;
|
||||||
* check combinations of cases listen in open group select
|
* check combinations of cases listen in open group select
|
||||||
|
@ -21,11 +20,10 @@
|
||||||
#define DEBUG_SELECT 0
|
#define DEBUG_SELECT 0
|
||||||
|
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
#include "dmap.h"
|
||||||
#include "select.h"
|
#include "select.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "inode.h"
|
#include "inode.h"
|
||||||
#include "fs_timers.h"
|
|
||||||
#include "dmap.h"
|
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#include "fs_timers.h"
|
|
||||||
|
|
||||||
#define VERBOSE 1
|
#define VERBOSE 0
|
||||||
|
|
||||||
#include <timers.h>
|
#include <timers.h>
|
||||||
#include <minix/syslib.h>
|
#include <minix/syslib.h>
|
||||||
|
@ -17,7 +16,7 @@ PUBLIC void fs_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
||||||
int r;
|
int r;
|
||||||
clock_t now, old_head = 0, new_head;
|
clock_t now, old_head = 0, new_head;
|
||||||
|
|
||||||
if((r = sys_getuptime(&now)) != OK)
|
if((r = getuptime(&now)) != OK)
|
||||||
panic(__FILE__, "FS couldn't get uptime from system task.", NO_NUM);
|
panic(__FILE__, "FS couldn't get uptime from system task.", NO_NUM);
|
||||||
|
|
||||||
tmr_inittimer(tp);
|
tmr_inittimer(tp);
|
||||||
|
@ -45,8 +44,8 @@ PUBLIC void fs_expire_timers(clock_t now)
|
||||||
if(new_head > 0) {
|
if(new_head > 0) {
|
||||||
if(sys_syncalrm(SELF, new_head, 1) != OK)
|
if(sys_syncalrm(SELF, new_head, 1) != OK)
|
||||||
panic(__FILE__, "FS expire timer couldn't set synchronous alarm.", NO_NUM);
|
panic(__FILE__, "FS expire timer couldn't set synchronous alarm.", NO_NUM);
|
||||||
else
|
|
||||||
#if VERBOSE
|
#if VERBOSE
|
||||||
|
else
|
||||||
printf("timers: after expiry, set synalarm to %d\n", new_head);
|
printf("timers: after expiry, set synalarm to %d\n", new_head);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ PUBLIC time_t clock_time()
|
||||||
register int k;
|
register int k;
|
||||||
clock_t uptime;
|
clock_t uptime;
|
||||||
|
|
||||||
if ( (k=sys_getuptime(&uptime)) != OK) panic(__FILE__,"clock_time err", k);
|
if ( (k=getuptime(&uptime)) != OK) panic(__FILE__,"clock_time err", k);
|
||||||
return( (time_t) (boottime + (uptime/HZ)));
|
return( (time_t) (boottime + (uptime/HZ)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ PUBLIC time_t get_time()
|
||||||
curr_time= mess.NEW_TIME;
|
curr_time= mess.NEW_TIME;
|
||||||
#else /* Minix 3 */
|
#else /* Minix 3 */
|
||||||
int s;
|
int s;
|
||||||
if ((s=sys_getuptime(&curr_time)) != OK)
|
if ((s=getuptime(&curr_time)) != OK)
|
||||||
ip_panic(("can't read clock"));
|
ip_panic(("can't read clock"));
|
||||||
#endif
|
#endif
|
||||||
assert(curr_time >= prev_time);
|
assert(curr_time >= prev_time);
|
||||||
|
|
|
@ -103,7 +103,6 @@ PUBLIC void main()
|
||||||
u8_t randbits[32];
|
u8_t randbits[32];
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
printf("Hello, in inet\n");
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
printf("Starting inet...\n");
|
printf("Starting inet...\n");
|
||||||
printf("%s\n", version);
|
printf("%s\n", version);
|
||||||
|
@ -247,18 +246,11 @@ PUBLIC void main()
|
||||||
mq_free(mq);
|
mq_free(mq);
|
||||||
}
|
}
|
||||||
#else /* Minix 3 */
|
#else /* Minix 3 */
|
||||||
else if (mq->mq_mess.m_type & NOTIFICATION)
|
else if (mq->mq_mess.m_type == SYN_ALARM)
|
||||||
{
|
|
||||||
if (mq->mq_mess.m_type == SYN_ALARM)
|
|
||||||
{
|
{
|
||||||
clck_tick(&mq->mq_mess);
|
clck_tick(&mq->mq_mess);
|
||||||
mq_free(mq);
|
mq_free(mq);
|
||||||
}
|
}
|
||||||
else if (mq->mq_mess.m_type == HARD_STOP)
|
|
||||||
{
|
|
||||||
sys_exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,7 @@ Copyright 1995 Philip Homburg
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <minix/type.h>
|
#include <minix/type.h>
|
||||||
|
#include <minix/utils.h>
|
||||||
#include <minix/syslib.h>
|
#include <minix/syslib.h>
|
||||||
#include "inet_config.h"
|
#include "inet_config.h"
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "is.h"
|
#include "is.h"
|
||||||
#include "../../kernel/const.h"
|
#include "../../kernel/const.h"
|
||||||
|
#include "../../kernel/config.h"
|
||||||
#include "../../kernel/type.h"
|
#include "../../kernel/type.h"
|
||||||
|
|
||||||
/*==========================================================================*
|
/*==========================================================================*
|
||||||
|
@ -20,8 +21,6 @@ PRIVATE void log_message(char *buf)
|
||||||
|
|
||||||
_sendrec(LOG_PROC_NR, &m);
|
_sendrec(LOG_PROC_NR, &m);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,9 +123,7 @@ PUBLIC int do_diagnostics(message *m)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i > 0) {
|
if(i > 0) {
|
||||||
/* This is safe; if i were too large,
|
/* This is safe; above code ensures i doesn't exceed upper bound. */
|
||||||
* this would have been done above.
|
|
||||||
*/
|
|
||||||
diagbuf[i] = '\0';
|
diagbuf[i] = '\0';
|
||||||
log_message(diagbuf);
|
log_message(diagbuf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ PUBLIC int do_fkey_pressed(message *m)
|
||||||
if (pressed(F1)) proctab_dmp();
|
if (pressed(F1)) proctab_dmp();
|
||||||
if (pressed(F2)) memmap_dmp();
|
if (pressed(F2)) memmap_dmp();
|
||||||
if (pressed(F3)) image_dmp();
|
if (pressed(F3)) image_dmp();
|
||||||
if (pressed(F4)) sendmask_dmp();
|
if (pressed(F4)) privileges_dmp();
|
||||||
if (pressed(F5)) monparams_dmp();
|
if (pressed(F5)) monparams_dmp();
|
||||||
if (pressed(F6)) irqtab_dmp();
|
if (pressed(F6)) irqtab_dmp();
|
||||||
if (pressed(F7)) kmessages_dmp();
|
if (pressed(F7)) kmessages_dmp();
|
||||||
|
@ -42,17 +42,15 @@ PUBLIC int do_fkey_pressed(message *m)
|
||||||
if (pressed(F12)) sched_dmp();
|
if (pressed(F12)) sched_dmp();
|
||||||
|
|
||||||
if (pressed(F9)) {
|
if (pressed(F9)) {
|
||||||
printf("IS server going into infinite loop, press F9 to break\n");
|
printf("IS server going into infinite loop... hit 5x a function key\n");
|
||||||
printf("Five times any key is fine as well ...\n");
|
printf("Five times a function key is fine as well ...\n");
|
||||||
s = 0;
|
|
||||||
while(TRUE) {
|
while(TRUE) {
|
||||||
if (OK == nb_receive(ANY, m)) {
|
if (OK == nb_receive(ANY, m)) {
|
||||||
s ++;
|
if (s++ >= 5 ) break;
|
||||||
if (pressed(F9) || s >= 5 ) break;
|
|
||||||
else printf("IS server in infinite loop, press F9 to break\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("IS server back to normal ... \n");
|
printf("IS server back to normal ... \n");
|
||||||
|
return(EDONTREPLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Also check Shift F1-F6 keys. */
|
/* Also check Shift F1-F6 keys. */
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
#include <timers.h>
|
#include <timers.h>
|
||||||
#include <ibm/interrupt.h>
|
#include <ibm/interrupt.h>
|
||||||
#include "../../kernel/const.h"
|
#include "../../kernel/const.h"
|
||||||
|
#include "../../kernel/config.h"
|
||||||
|
#include "../../kernel/debug.h"
|
||||||
#include "../../kernel/type.h"
|
#include "../../kernel/type.h"
|
||||||
#include "../../kernel/proc.h"
|
#include "../../kernel/proc.h"
|
||||||
#include "../../kernel/sendmask.h"
|
|
||||||
|
|
||||||
#define click_to_round_k(n) \
|
#define click_to_round_k(n) \
|
||||||
((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
|
((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
|
||||||
|
@ -20,7 +21,8 @@ FORWARD _PROTOTYPE( char *proc_name, (int proc_nr) );
|
||||||
* so that most macros and definitions from proc.h also apply here.
|
* so that most macros and definitions from proc.h also apply here.
|
||||||
*/
|
*/
|
||||||
PUBLIC struct proc proc[NR_TASKS + NR_PROCS];
|
PUBLIC struct proc proc[NR_TASKS + NR_PROCS];
|
||||||
PUBLIC struct system_image image[IMAGE_SIZE];
|
PUBLIC struct priv priv[NR_SYS_PROCS];
|
||||||
|
PUBLIC struct system_image image[NR_BOOT_PROCS];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,15 +31,15 @@ PUBLIC struct system_image image[IMAGE_SIZE];
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void timing_dmp()
|
PUBLIC void timing_dmp()
|
||||||
{
|
{
|
||||||
#if ! ENABLE_LOCK_TIMING
|
#if ! DEBUG_TIME_LOCKS
|
||||||
printf("Enable the ENABLE_LOCK_TIMING definition in <minix/config.h>\n");
|
printf("Enable the DEBUG_TIME_LOCKS definition in src/kernel/config.h\n");
|
||||||
#else
|
#else
|
||||||
static struct lock_timedata timingdata[TIMING_CATEGORIES];
|
static struct lock_timingdata timingdata[TIMING_CATEGORIES];
|
||||||
int r, c, f, skipped = 0, printed = 0, maxlines = 23, x = 0;
|
int r, c, f, skipped = 0, printed = 0, maxlines = 23, x = 0;
|
||||||
static int offsetlines = 0;
|
static int offsetlines = 0;
|
||||||
|
|
||||||
if ((r = sys_getlocktimings(timingdata)) != OK) {
|
if ((r = sys_getlocktimings(&timingdata[0])) != OK) {
|
||||||
report("warning: couldn't get copy of lock timings", r);
|
report("IS","warning: couldn't get copy of lock timings", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,10 +192,10 @@ PUBLIC void image_dmp()
|
||||||
}
|
}
|
||||||
printf("Image table dump showing all processes included in system image.\n");
|
printf("Image table dump showing all processes included in system image.\n");
|
||||||
printf("---name-- -nr- -flags- -q- ----pc- -stack- ------sendmask-------\n");
|
printf("---name-- -nr- -flags- -q- ----pc- -stack- ------sendmask-------\n");
|
||||||
for (i=0; i<IMAGE_SIZE; i++) {
|
for (i=0; i<NR_BOOT_PROCS; i++) {
|
||||||
ip = &image[i];
|
ip = &image[i];
|
||||||
for (j=-NR_TASKS; j<INIT_PROC_NR+2; j++)
|
for (j=-NR_TASKS; j<INIT_PROC_NR+2; j++)
|
||||||
maskstr[j+NR_TASKS] = (isallowed(ip->sendmask, j)) ? '1' : '0';
|
maskstr[j+NR_TASKS] = '0';
|
||||||
maskstr[j+NR_TASKS] = '\0';
|
maskstr[j+NR_TASKS] = '\0';
|
||||||
printf("%8s %4d 0x%02x %3d %7lu %7lu %s\n",
|
printf("%8s %4d 0x%02x %3d %7lu %7lu %s\n",
|
||||||
ip->proc_name, ip->proc_nr, ip->flags, ip->priority,
|
ip->proc_name, ip->proc_nr, ip->flags, ip->priority,
|
||||||
|
@ -293,13 +295,59 @@ PUBLIC void kenv_dmp()
|
||||||
printf("- nr_tasks: %3u\n", kinfo.nr_tasks);
|
printf("- nr_tasks: %3u\n", kinfo.nr_tasks);
|
||||||
printf("- release: %.6s\n", kinfo.release);
|
printf("- release: %.6s\n", kinfo.release);
|
||||||
printf("- version: %.6s\n", kinfo.version);
|
printf("- version: %.6s\n", kinfo.version);
|
||||||
#if ENABLE_K_LOCKCHECK
|
#if DEBUG_LOCK_CHECK
|
||||||
printf("- relocking: %d\n", kinfo.relocking);
|
printf("- relocking: %d\n", kinfo.relocking);
|
||||||
#endif
|
#endif
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*===========================================================================*
|
||||||
|
* privileges_dmp *
|
||||||
|
*===========================================================================*/
|
||||||
|
PUBLIC void privileges_dmp()
|
||||||
|
{
|
||||||
|
register struct proc *rp;
|
||||||
|
static struct proc *oldrp = BEG_PROC_ADDR;
|
||||||
|
register struct priv *sp;
|
||||||
|
int r, i,j, n = 0;
|
||||||
|
|
||||||
|
/* First obtain a fresh copy of the current process and system table. */
|
||||||
|
if ((r = sys_getprivtab(priv)) != OK) {
|
||||||
|
report("IS","warning: couldn't get copy of system privileges table", r);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((r = sys_getproctab(proc)) != OK) {
|
||||||
|
report("IS","warning: couldn't get copy of process table", r);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n--nr-id-name---- -sanity- -flags- -sc-\n");
|
||||||
|
|
||||||
|
for (rp = oldrp; rp < END_PROC_ADDR; rp++) {
|
||||||
|
if (isemptyp(rp)) continue;
|
||||||
|
if (++n > 23) break;
|
||||||
|
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));
|
||||||
|
r = -1;
|
||||||
|
for (sp = &priv[0]; sp < &priv[NR_SYS_PROCS]; sp++)
|
||||||
|
if (sp->s_proc_nr == rp->p_nr) { r ++; break; }
|
||||||
|
if (r == -1) {
|
||||||
|
printf("... warning, no privileges found!\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
printf("(%02u) %-7.7s %3x %02.2u",
|
||||||
|
sp->s_id,
|
||||||
|
rp->p_name,
|
||||||
|
sp->s_flags, sp->s_call_mask
|
||||||
|
);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
if (rp == END_PROC_ADDR) rp = BEG_PROC_ADDR; else printf("--more--\r");
|
||||||
|
oldrp = rp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sendmask_dmp *
|
* sendmask_dmp *
|
||||||
|
@ -322,6 +370,7 @@ PUBLIC void sendmask_dmp()
|
||||||
printf("The rows of bits indicate to which processes each process may send.");
|
printf("The rows of bits indicate to which processes each process may send.");
|
||||||
printf("\n\n");
|
printf("\n\n");
|
||||||
|
|
||||||
|
#if DEAD_CODE
|
||||||
printf(" ");
|
printf(" ");
|
||||||
for (j=proc_nr(BEG_PROC_ADDR); j< INIT_PROC_NR+1; j++) {
|
for (j=proc_nr(BEG_PROC_ADDR); j< INIT_PROC_NR+1; j++) {
|
||||||
printf("%3d", j);
|
printf("%3d", j);
|
||||||
|
@ -346,6 +395,7 @@ PUBLIC void sendmask_dmp()
|
||||||
if (rp == END_PROC_ADDR) { printf("\n"); rp = BEG_PROC_ADDR; }
|
if (rp == END_PROC_ADDR) { printf("\n"); rp = BEG_PROC_ADDR; }
|
||||||
else printf("--more--\r");
|
else printf("--more--\r");
|
||||||
oldrp = rp;
|
oldrp = rp;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -369,7 +419,7 @@ PUBLIC void proctab_dmp()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n--nr-name-flags-prior-quant-##-sc- -user---sys- -text---data---size- -rts flags-\n");
|
printf("\n--nr-name---- -prior-quant-##- -user---sys- -text---data---size- -rts flags-\n");
|
||||||
|
|
||||||
for (rp = oldrp; rp < END_PROC_ADDR; rp++) {
|
for (rp = oldrp; rp < END_PROC_ADDR; rp++) {
|
||||||
if (isemptyp(rp)) continue;
|
if (isemptyp(rp)) continue;
|
||||||
|
@ -381,13 +431,11 @@ PUBLIC void proctab_dmp()
|
||||||
if (proc_nr(rp) == IDLE) printf("(%2d) ", proc_nr(rp));
|
if (proc_nr(rp) == IDLE) printf("(%2d) ", proc_nr(rp));
|
||||||
else if (proc_nr(rp) < 0) printf("[%2d] ", proc_nr(rp));
|
else if (proc_nr(rp) < 0) printf("[%2d] ", proc_nr(rp));
|
||||||
else printf(" %2d ", proc_nr(rp));
|
else printf(" %2d ", proc_nr(rp));
|
||||||
printf("%-7.7s %2x %02u/%02u %02d/%02d %02u %02.2x %6lu%6lu %6uK%6uK%6uK %3x",
|
printf(" %-7.7s %02u/%02u %02d/%02d %02u %6lu%6lu %6uK%6uK%6uK %3x",
|
||||||
rp->p_name,
|
rp->p_name,
|
||||||
rp->p_flags,
|
|
||||||
rp->p_priority, rp->p_max_priority,
|
rp->p_priority, rp->p_max_priority,
|
||||||
rp->p_sched_ticks, rp->p_quantum_size,
|
rp->p_sched_ticks, rp->p_quantum_size,
|
||||||
rp->p_full_quantums,
|
rp->p_full_quantums,
|
||||||
(char) rp->p_call_mask,
|
|
||||||
rp->p_user_time, rp->p_sys_time,
|
rp->p_user_time, rp->p_sys_time,
|
||||||
click_to_round_k(text), click_to_round_k(data),
|
click_to_round_k(text), click_to_round_k(data),
|
||||||
click_to_round_k(size),
|
click_to_round_k(size),
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "is.h"
|
#include "is.h"
|
||||||
#include "../pm/mproc.h"
|
#include "../pm/mproc.h"
|
||||||
|
#include <timers.h>
|
||||||
|
|
||||||
|
|
||||||
PUBLIC struct mproc mproc[NR_PROCS];
|
PUBLIC struct mproc mproc[NR_PROCS];
|
||||||
|
|
|
@ -62,15 +62,12 @@ PUBLIC void main(void)
|
||||||
case FKEY_PRESSED:
|
case FKEY_PRESSED:
|
||||||
result = do_fkey_pressed(&m_in);
|
result = do_fkey_pressed(&m_in);
|
||||||
break;
|
break;
|
||||||
case HARD_STOP:
|
default: {
|
||||||
sys_exit(0);
|
|
||||||
/* never reached */
|
|
||||||
continue;
|
|
||||||
default:
|
|
||||||
printf("Warning, IS got unexpected request %d from %d\n",
|
printf("Warning, IS got unexpected request %d from %d\n",
|
||||||
m_in.m_type, m_in.m_source);
|
m_in.m_type, m_in.m_source);
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Finally send reply message, unless disabled. */
|
/* Finally send reply message, unless disabled. */
|
||||||
if (result != EDONTREPLY) {
|
if (result != EDONTREPLY) {
|
||||||
|
@ -88,10 +85,10 @@ int sig; /* signal number */
|
||||||
{
|
{
|
||||||
/* Expect a SIGTERM signal when this server must shutdown. */
|
/* Expect a SIGTERM signal when this server must shutdown. */
|
||||||
if (sig == SIGTERM) {
|
if (sig == SIGTERM) {
|
||||||
printf("Shutting down IS server.\n");
|
printf("Shutting down IS server due to SIGTERM.\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
printf("IS got unknown signal\n");
|
printf("IS got signal %d\n", sig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,15 +103,12 @@ PRIVATE void init_server()
|
||||||
int i, s;
|
int i, s;
|
||||||
struct sigaction sigact;
|
struct sigaction sigact;
|
||||||
|
|
||||||
#if DEAD_CODE
|
|
||||||
/* Install signal handler.*/
|
/* Install signal handler.*/
|
||||||
sigact.sa_handler = signal_handler;
|
sigact.sa_handler = signal_handler;
|
||||||
sigact.sa_mask = ~0; /* block all other signals */
|
sigact.sa_mask = ~0; /* block all other signals */
|
||||||
sigact.sa_flags = 0; /* default behaviour */
|
sigact.sa_flags = 0; /* default behaviour */
|
||||||
printf("IS calls sigaction()\n");
|
|
||||||
if (sigaction(SIGTERM, &sigact, NULL) != OK)
|
if (sigaction(SIGTERM, &sigact, NULL) != OK)
|
||||||
report("IS","warning, sigaction() failed", errno);
|
report("IS","warning, sigaction() failed", errno);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set key mappings. IS takes all of F1-F12 and Shift+F1-F6 . */
|
/* Set key mappings. IS takes all of F1-F12 and Shift+F1-F6 . */
|
||||||
fkeys = sfkeys = 0;
|
fkeys = sfkeys = 0;
|
||||||
|
@ -122,9 +116,6 @@ PRIVATE void init_server()
|
||||||
for (i=1; i<= 6; i++) bit_set(sfkeys, i);
|
for (i=1; i<= 6; i++) bit_set(sfkeys, i);
|
||||||
if ((s=fkey_map(&fkeys, &sfkeys)) != OK)
|
if ((s=fkey_map(&fkeys, &sfkeys)) != OK)
|
||||||
report("IS", "warning, sendrec failed:", s);
|
report("IS", "warning, sendrec failed:", s);
|
||||||
|
|
||||||
/* Display status message ... */
|
|
||||||
report("IS", "information service is alive and kicking", NO_NUM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
|
|
|
@ -18,6 +18,7 @@ _PROTOTYPE( int do_fkey_pressed, (message *m) );
|
||||||
/* dmp_kernel.c */
|
/* dmp_kernel.c */
|
||||||
_PROTOTYPE( void proctab_dmp, (void) );
|
_PROTOTYPE( void proctab_dmp, (void) );
|
||||||
_PROTOTYPE( void memmap_dmp, (void) );
|
_PROTOTYPE( void memmap_dmp, (void) );
|
||||||
|
_PROTOTYPE( void privileges_dmp, (void) );
|
||||||
_PROTOTYPE( void sendmask_dmp, (void) );
|
_PROTOTYPE( void sendmask_dmp, (void) );
|
||||||
_PROTOTYPE( void image_dmp, (void) );
|
_PROTOTYPE( void image_dmp, (void) );
|
||||||
_PROTOTYPE( void irqtab_dmp, (void) );
|
_PROTOTYPE( void irqtab_dmp, (void) );
|
||||||
|
|
|
@ -13,13 +13,13 @@ CC = exec cc
|
||||||
CFLAGS = -I$i
|
CFLAGS = -I$i
|
||||||
LDFLAGS = -i
|
LDFLAGS = -i
|
||||||
|
|
||||||
OBJ = main.o forkexit.o break.o exec.o time.o \
|
OBJ = main.o forkexit.o break.o exec.o time.o timers.o \
|
||||||
signal.o alloc.o utility.o table.o trace.o getset.o misc.o
|
signal.o alloc.o utility.o table.o trace.o getset.o misc.o
|
||||||
|
|
||||||
# build local binary
|
# build local binary
|
||||||
all build: $(SERVER)
|
all build: $(SERVER)
|
||||||
$(SERVER): $(OBJ)
|
$(SERVER): $(OBJ)
|
||||||
$(CC) -o $@ $(LDFLAGS) $(OBJ) -lsys -lutils
|
$(CC) -o $@ $(LDFLAGS) $(OBJ) -lsys -lutils -ltimers
|
||||||
install -S 256w $@
|
install -S 256w $@
|
||||||
|
|
||||||
# install with other servers
|
# install with other servers
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "mproc.h"
|
#include "mproc.h"
|
||||||
#include "../../kernel/const.h"
|
#include "../../kernel/const.h"
|
||||||
|
#include "../../kernel/config.h"
|
||||||
#include "../../kernel/type.h"
|
#include "../../kernel/type.h"
|
||||||
|
|
||||||
#define NR_HOLES (2*NR_PROCS) /* max # entries in hole table */
|
#define NR_HOLES (2*NR_PROCS) /* max # entries in hole table */
|
||||||
|
|
|
@ -371,7 +371,7 @@ phys_bytes tot_bytes; /* total memory to allocate, including gap */
|
||||||
base += bss_offset;
|
base += bss_offset;
|
||||||
bytes -= bss_offset;
|
bytes -= bss_offset;
|
||||||
|
|
||||||
if ((s=sys_physzero(base, bytes)) != OK) {
|
if ((s=sys_memset(0, base, bytes)) != OK) {
|
||||||
panic(__FILE__,"new_mem can't zero", s);
|
panic(__FILE__,"new_mem can't zero", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ int exit_status; /* the process' exit status (for parent) */
|
||||||
/* Tell the kernel and FS that the process is no longer runnable. */
|
/* Tell the kernel and FS that the process is no longer runnable. */
|
||||||
DEBUG(proc_nr == PRINTER, printf("PM: telling FS and kernel about xit...\n"));
|
DEBUG(proc_nr == PRINTER, printf("PM: telling FS and kernel about xit...\n"));
|
||||||
tell_fs(EXIT, proc_nr, 0, 0); /* file system can free the proc slot */
|
tell_fs(EXIT, proc_nr, 0, 0); /* file system can free the proc slot */
|
||||||
sys_xit(proc_nr);
|
sys_exit(proc_nr);
|
||||||
|
|
||||||
/* Pending reply messages for the dead process cannot be delivered. */
|
/* Pending reply messages for the dead process cannot be delivered. */
|
||||||
rmp->mp_flags &= ~REPLY;
|
rmp->mp_flags &= ~REPLY;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
|
|
||||||
#include "../../kernel/const.h"
|
#include "../../kernel/const.h"
|
||||||
|
#include "../../kernel/config.h"
|
||||||
#include "../../kernel/type.h"
|
#include "../../kernel/type.h"
|
||||||
|
|
||||||
FORWARD _PROTOTYPE( void get_work, (void) );
|
FORWARD _PROTOTYPE( void get_work, (void) );
|
||||||
|
@ -51,10 +52,9 @@ PUBLIC void main()
|
||||||
get_work(); /* wait for an PM system call */
|
get_work(); /* wait for an PM system call */
|
||||||
|
|
||||||
/* Check for system notifications first. Special cases. */
|
/* Check for system notifications first. Special cases. */
|
||||||
if (call_nr == HARD_STOP) { /* MINIX is shutting down */
|
if (call_nr == SYN_ALARM) {
|
||||||
check_sig(-1, SIGKILL); /* kill all processes */
|
pm_expire_timers(m_in.NOTIFY_TIMESTAMP);
|
||||||
sys_exit(0);
|
result = SUSPEND; /* don't reply */
|
||||||
/* never reached */
|
|
||||||
} else if (call_nr == KSIG_PENDING) { /* signals pending */
|
} else if (call_nr == KSIG_PENDING) { /* signals pending */
|
||||||
(void) ksig_pending();
|
(void) ksig_pending();
|
||||||
result = SUSPEND; /* don't reply */
|
result = SUSPEND; /* don't reply */
|
||||||
|
@ -137,7 +137,7 @@ PRIVATE void pm_init()
|
||||||
{
|
{
|
||||||
/* Initialize the process manager. */
|
/* Initialize the process manager. */
|
||||||
int key, i, s;
|
int key, i, s;
|
||||||
static struct system_image image[IMAGE_SIZE];
|
static struct system_image image[NR_BOOT_PROCS];
|
||||||
register struct system_image *ip;
|
register struct system_image *ip;
|
||||||
static char core_sigs[] = { SIGQUIT, SIGILL, SIGTRAP, SIGABRT,
|
static char core_sigs[] = { SIGQUIT, SIGILL, SIGTRAP, SIGABRT,
|
||||||
SIGEMT, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2 };
|
SIGEMT, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2 };
|
||||||
|
@ -150,6 +150,11 @@ PRIVATE void pm_init()
|
||||||
struct mem_map mem_map[NR_LOCAL_SEGS];
|
struct mem_map mem_map[NR_LOCAL_SEGS];
|
||||||
struct memory mem_chunks[NR_MEMS];
|
struct memory mem_chunks[NR_MEMS];
|
||||||
|
|
||||||
|
/* Initialize process table, including timers. */
|
||||||
|
for (rmp=&mproc[0]; rmp<&mproc[NR_PROCS]; rmp++) {
|
||||||
|
tmr_inittimer(&rmp->mp_timer);
|
||||||
|
}
|
||||||
|
|
||||||
/* Build the set of signals which cause core dumps, and the set of signals
|
/* Build the set of signals which cause core dumps, and the set of signals
|
||||||
* that are by default ignored.
|
* that are by default ignored.
|
||||||
*/
|
*/
|
||||||
|
@ -182,7 +187,7 @@ PRIVATE void pm_init()
|
||||||
if (OK != (s=sys_getimage(image)))
|
if (OK != (s=sys_getimage(image)))
|
||||||
panic(__FILE__,"PM: warning, couldn't get image table: %d\n", s);
|
panic(__FILE__,"PM: warning, couldn't get image table: %d\n", s);
|
||||||
procs_in_use = 0; /* start populating table */
|
procs_in_use = 0; /* start populating table */
|
||||||
for (ip = &image[0]; ip < &image[IMAGE_SIZE]; ip++) {
|
for (ip = &image[0]; ip < &image[NR_BOOT_PROCS]; ip++) {
|
||||||
if (ip->proc_nr >= 0) { /* task have negative nrs */
|
if (ip->proc_nr >= 0) { /* task have negative nrs */
|
||||||
procs_in_use += 1; /* found user process */
|
procs_in_use += 1; /* found user process */
|
||||||
|
|
||||||
|
@ -223,8 +228,6 @@ PRIVATE void pm_init()
|
||||||
|
|
||||||
mproc[PM_PROC_NR].mp_pid = PM_PID;
|
mproc[PM_PROC_NR].mp_pid = PM_PID;
|
||||||
mproc[PM_PROC_NR].mp_parent = PM_PROC_NR;
|
mproc[PM_PROC_NR].mp_parent = PM_PROC_NR;
|
||||||
sigfillset(&mproc[PM_PROC_NR].mp_ignore);
|
|
||||||
sigfillset(&mproc[PM_PROC_NR].mp_sigmask);
|
|
||||||
|
|
||||||
/* Tell FS that no more system processes follow and synchronize. */
|
/* Tell FS that no more system processes follow and synchronize. */
|
||||||
mess.PR_PROC_NR = NONE;
|
mess.PR_PROC_NR = NONE;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* systems have tables that are also indexed by process, with the contents
|
* systems have tables that are also indexed by process, with the contents
|
||||||
* of corresponding slots referring to the same process in all three.
|
* of corresponding slots referring to the same process in all three.
|
||||||
*/
|
*/
|
||||||
|
#include <timers.h>
|
||||||
|
|
||||||
EXTERN struct mproc {
|
EXTERN struct mproc {
|
||||||
struct mem_map mp_seg[NR_LOCAL_SEGS]; /* points to text, data, stack */
|
struct mem_map mp_seg[NR_LOCAL_SEGS]; /* points to text, data, stack */
|
||||||
|
@ -37,6 +38,7 @@ EXTERN struct mproc {
|
||||||
sigset_t mp_sigpending; /* pending signals to be handled */
|
sigset_t mp_sigpending; /* pending signals to be handled */
|
||||||
struct sigaction mp_sigact[_NSIG + 1]; /* as in sigaction(2) */
|
struct sigaction mp_sigact[_NSIG + 1]; /* as in sigaction(2) */
|
||||||
vir_bytes mp_sigreturn; /* address of C library __sigreturn function */
|
vir_bytes mp_sigreturn; /* address of C library __sigreturn function */
|
||||||
|
struct timer mp_timer; /* watchdog timer for alarm(2) */
|
||||||
|
|
||||||
/* Backwards compatibility for signals. */
|
/* Backwards compatibility for signals. */
|
||||||
sighandler_t mp_func; /* all sigs vectored to a single user fcn */
|
sighandler_t mp_func; /* all sigs vectored to a single user fcn */
|
||||||
|
|
|
@ -5,6 +5,8 @@ struct stat;
|
||||||
struct mem_map;
|
struct mem_map;
|
||||||
struct memory;
|
struct memory;
|
||||||
|
|
||||||
|
#include <timers.h>
|
||||||
|
|
||||||
/* alloc.c */
|
/* alloc.c */
|
||||||
_PROTOTYPE( phys_clicks alloc_mem, (phys_clicks clicks) );
|
_PROTOTYPE( phys_clicks alloc_mem, (phys_clicks clicks) );
|
||||||
_PROTOTYPE( void free_mem, (phys_clicks base, phys_clicks clicks) );
|
_PROTOTYPE( void free_mem, (phys_clicks base, phys_clicks clicks) );
|
||||||
|
@ -88,6 +90,12 @@ _PROTOTYPE( int do_time, (void) );
|
||||||
_PROTOTYPE( int do_times, (void) );
|
_PROTOTYPE( int do_times, (void) );
|
||||||
_PROTOTYPE( int do_gettimeofday, (void) );
|
_PROTOTYPE( int do_gettimeofday, (void) );
|
||||||
|
|
||||||
|
/* timers.c */
|
||||||
|
_PROTOTYPE( void pm_set_timer, (timer_t *tp, int delta,
|
||||||
|
tmr_func_t watchdog, int arg));
|
||||||
|
_PROTOTYPE( void pm_expire_timers, (clock_t now));
|
||||||
|
_PROTOTYPE( void pm_cancel_timer, (timer_t *tp));
|
||||||
|
|
||||||
/* trace.c */
|
/* trace.c */
|
||||||
_PROTOTYPE( int do_trace, (void) );
|
_PROTOTYPE( int do_trace, (void) );
|
||||||
_PROTOTYPE( void stop_proc, (struct mproc *rmp, int sig_nr) );
|
_PROTOTYPE( void stop_proc, (struct mproc *rmp, int sig_nr) );
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#define NEW_AL 1
|
||||||
/* This file handles signals, which are asynchronous events and are generally
|
/* This file handles signals, which are asynchronous events and are generally
|
||||||
* a messy and unpleasant business. Signals can be generated by the KILL
|
* a messy and unpleasant business. Signals can be generated by the KILL
|
||||||
* system call, or from the keyboard (SIGINT) or from the clock (SIGALRM).
|
* system call, or from the keyboard (SIGINT) or from the clock (SIGALRM).
|
||||||
|
@ -36,7 +37,8 @@
|
||||||
|
|
||||||
FORWARD _PROTOTYPE( void dump_core, (struct mproc *rmp) );
|
FORWARD _PROTOTYPE( void dump_core, (struct mproc *rmp) );
|
||||||
FORWARD _PROTOTYPE( void unpause, (int pro) );
|
FORWARD _PROTOTYPE( void unpause, (int pro) );
|
||||||
FORWARD _PROTOTYPE( void handle_ksig, (int proc_nr, sigset_t sig_map) );
|
FORWARD _PROTOTYPE( void handle_sig, (int proc_nr, sigset_t sig_map) );
|
||||||
|
FORWARD _PROTOTYPE( void cause_sigalrm, (struct timer *tp) );
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
|
@ -208,11 +210,12 @@ PUBLIC int ksig_pending()
|
||||||
sigset_t sig_map;
|
sigset_t sig_map;
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
sys_getsig(&proc_nr, &sig_map); /* get an arbitrary pending signal */
|
sys_getksig(&proc_nr, &sig_map); /* get an arbitrary pending signal */
|
||||||
if (NONE == proc_nr) { /* stop if no more pending signals */
|
if (NONE == proc_nr) { /* stop if no more pending signals */
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
handle_ksig(proc_nr, sig_map); /* handle the receive signal */
|
handle_sig(proc_nr, sig_map); /* handle the received signal */
|
||||||
|
sys_endksig(proc_nr); /* tell kernel it's done */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(SUSPEND); /* prevents sending reply */
|
return(SUSPEND); /* prevents sending reply */
|
||||||
|
@ -220,9 +223,9 @@ PUBLIC int ksig_pending()
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* handle_ksig *
|
* handle_sig *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void handle_ksig(proc_nr, sig_map)
|
PRIVATE void handle_sig(proc_nr, sig_map)
|
||||||
int proc_nr;
|
int proc_nr;
|
||||||
sigset_t sig_map;
|
sigset_t sig_map;
|
||||||
{
|
{
|
||||||
|
@ -233,7 +236,7 @@ sigset_t sig_map;
|
||||||
rmp = &mproc[proc_nr];
|
rmp = &mproc[proc_nr];
|
||||||
if ((rmp->mp_flags & (IN_USE | ZOMBIE)) != IN_USE) return;
|
if ((rmp->mp_flags & (IN_USE | ZOMBIE)) != IN_USE) return;
|
||||||
proc_id = rmp->mp_pid;
|
proc_id = rmp->mp_pid;
|
||||||
mp = &mproc[0]; /* pretend kernel signals are from PM */
|
mp = &mproc[0]; /* pretend signals are from PM */
|
||||||
mp->mp_procgrp = rmp->mp_procgrp; /* get process group right */
|
mp->mp_procgrp = rmp->mp_procgrp; /* get process group right */
|
||||||
|
|
||||||
/* Check each bit in turn to see if a signal is to be sent. Unlike
|
/* Check each bit in turn to see if a signal is to be sent. Unlike
|
||||||
|
@ -253,8 +256,7 @@ sigset_t sig_map;
|
||||||
id = -1; break; /* broadcast to all except INIT */
|
id = -1; break; /* broadcast to all except INIT */
|
||||||
case SIGALRM:
|
case SIGALRM:
|
||||||
/* Disregard SIGALRM when the target process has not
|
/* Disregard SIGALRM when the target process has not
|
||||||
* requested an alarm. This only applies for a KERNEL
|
* requested an alarm.
|
||||||
* generated signal.
|
|
||||||
*/
|
*/
|
||||||
if ((rmp->mp_flags & ALARM_ON) == 0) continue;
|
if ((rmp->mp_flags & ALARM_ON) == 0) continue;
|
||||||
rmp->mp_flags &= ~ALARM_ON;
|
rmp->mp_flags &= ~ALARM_ON;
|
||||||
|
@ -264,7 +266,6 @@ sigset_t sig_map;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
check_sig(id, i);
|
check_sig(id, i);
|
||||||
sys_endsig(proc_nr); /* tell kernel it's done */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,11 +291,21 @@ int sec; /* how many seconds delay before the signal */
|
||||||
* to turn the timer off when a process exits with the timer still on.
|
* to turn the timer off when a process exits with the timer still on.
|
||||||
*/
|
*/
|
||||||
clock_t ticks; /* number of ticks for alarm */
|
clock_t ticks; /* number of ticks for alarm */
|
||||||
|
clock_t exptime; /* needed for remaining time on previous alarm */
|
||||||
|
clock_t uptime; /* current system time */
|
||||||
int remaining; /* previous time left in seconds */
|
int remaining; /* previous time left in seconds */
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
if (sec != 0) mproc[proc_nr].mp_flags |= ALARM_ON;
|
/* First determine remaining time of previous alarm, if set. */
|
||||||
else mproc[proc_nr].mp_flags &= ~ALARM_ON;
|
if (mproc[proc_nr].mp_flags & ALARM_ON) {
|
||||||
|
if ( (s=getuptime(&uptime)) != OK)
|
||||||
|
panic(__FILE__,"set_alarm couldn't get uptime", s);
|
||||||
|
exptime = *tmr_exp_time(&mproc[proc_nr].mp_timer);
|
||||||
|
remaining = (int) ((exptime - uptime + (HZ-1))/HZ);
|
||||||
|
if (remaining < 0) remaining = 0;
|
||||||
|
} else {
|
||||||
|
remaining = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Tell the clock task to provide a signal message when the time comes.
|
/* Tell the clock task to provide a signal message when the time comes.
|
||||||
*
|
*
|
||||||
|
@ -316,15 +327,35 @@ int sec; /* how many seconds delay before the signal */
|
||||||
if ( (unsigned long) ticks / HZ != (unsigned) sec)
|
if ( (unsigned long) ticks / HZ != (unsigned) sec)
|
||||||
ticks = LONG_MAX; /* eternity (really TMR_NEVER) */
|
ticks = LONG_MAX; /* eternity (really TMR_NEVER) */
|
||||||
|
|
||||||
if ((s=sys_signalrm(proc_nr, &ticks)) != OK)
|
if (ticks != 0) {
|
||||||
panic(__FILE__,"couldn't set signal alarm", s);
|
pm_set_timer(&mproc[proc_nr].mp_timer, ticks, cause_sigalrm, proc_nr);
|
||||||
|
mproc[proc_nr].mp_flags |= ALARM_ON;
|
||||||
remaining = (int) ((ticks + (HZ-1))/HZ);
|
} else if (mproc[proc_nr].mp_flags & ALARM_ON) {
|
||||||
if (remaining < 0) remaining = INT_MAX; /* true value is too large */
|
pm_cancel_timer(&mproc[proc_nr].mp_timer);
|
||||||
|
mproc[proc_nr].mp_flags &= ~ALARM_ON;
|
||||||
|
}
|
||||||
return(remaining);
|
return(remaining);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*===========================================================================*
|
||||||
|
* cause_sigalrm *
|
||||||
|
*===========================================================================*/
|
||||||
|
PRIVATE void cause_sigalrm(tp)
|
||||||
|
struct timer *tp;
|
||||||
|
{
|
||||||
|
int proc_nr;
|
||||||
|
register struct mproc *rmp;
|
||||||
|
|
||||||
|
proc_nr = tmr_arg(tp)->ta_int; /* get process from timer */
|
||||||
|
rmp = &mproc[proc_nr];
|
||||||
|
if ((rmp->mp_flags & (IN_USE | ZOMBIE)) != IN_USE) return;
|
||||||
|
if ((rmp->mp_flags & ALARM_ON) == 0) return;
|
||||||
|
rmp->mp_flags &= ~ALARM_ON;
|
||||||
|
check_sig(rmp->mp_pid, SIGALRM);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* do_pause *
|
* do_pause *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
|
|
@ -29,7 +29,7 @@ PUBLIC int do_time()
|
||||||
clock_t uptime;
|
clock_t uptime;
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
if ( (s=sys_getuptime(&uptime)) != OK)
|
if ( (s=getuptime(&uptime)) != OK)
|
||||||
panic(__FILE__,"do_time couldn't get uptime", s);
|
panic(__FILE__,"do_time couldn't get uptime", s);
|
||||||
|
|
||||||
mp->mp_reply.reply_time = (time_t) (boottime + (uptime/HZ));
|
mp->mp_reply.reply_time = (time_t) (boottime + (uptime/HZ));
|
||||||
|
@ -52,7 +52,7 @@ PUBLIC int do_stime()
|
||||||
if (mp->mp_effuid != SUPER_USER) {
|
if (mp->mp_effuid != SUPER_USER) {
|
||||||
return(EPERM);
|
return(EPERM);
|
||||||
}
|
}
|
||||||
if ( (s=sys_getuptime(&uptime)) != OK)
|
if ( (s=getuptime(&uptime)) != OK)
|
||||||
panic(__FILE__,"do_stime couldn't get uptime", s);
|
panic(__FILE__,"do_stime couldn't get uptime", s);
|
||||||
boottime = (long) m_in.stime - (uptime/HZ);
|
boottime = (long) m_in.stime - (uptime/HZ);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ PUBLIC int do_gettimeofday(void)
|
||||||
clock_t uptime;
|
clock_t uptime;
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
if ( (s=sys_getuptime(&uptime)) != OK)
|
if ( (s=getuptime(&uptime)) != OK)
|
||||||
panic(__FILE__,"do_gettimeofday couldn't get uptime", s);
|
panic(__FILE__,"do_gettimeofday couldn't get uptime", s);
|
||||||
|
|
||||||
mp->mp_reply.m2_l1 = boottime + uptime/HZ;
|
mp->mp_reply.m2_l1 = boottime + uptime/HZ;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <timers.h>
|
#include <timers.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "../../kernel/const.h"
|
#include "../../kernel/const.h"
|
||||||
|
#include "../../kernel/config.h"
|
||||||
#include "../../kernel/type.h"
|
#include "../../kernel/type.h"
|
||||||
#include "../../kernel/proc.h"
|
#include "../../kernel/proc.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue