From: Jorrit Herder Date: Tue, 23 Aug 2005 11:31:32 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v3.1.0~302 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/rndc.conf.html?a=commitdiff_plain;h=7bf400a709be0716bd30f97c29a62c4ec1ff75f6;p=minix.git *** empty log message *** --- diff --git a/kernel/proc.c b/kernel/proc.c index 1dac41ff3..3727d492a 100755 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -511,18 +511,11 @@ int *front; /* return: front or back */ prev_ptr = rp; /* store ptr for next */ } -#if 0 - if (priv(rp)->s_flags & BILLABLE) { /* user process */ - } - else { /* system process */ - } -#endif - /* Determine the new priority of this process. The bounds are determined * by IDLE's queue and the maximum priority of this process. Kernel task * and the idle process are never changed in priority. */ - if (! iskernelp(rp) && penalty != 0) { + if (penalty != 0 && ! iskernelp(rp)) { rp->p_priority += penalty; /* update with penalty */ if (rp->p_priority < rp->p_max_priority) /* check upper bound */ rp->p_priority=rp->p_max_priority; diff --git a/kernel/table.c b/kernel/table.c index 16b88bfa5..8696917b3 100755 --- a/kernel/table.c +++ b/kernel/table.c @@ -46,10 +46,10 @@ PUBLIC char *t_stack[TOT_STACK_SPACE / sizeof(char *)]; /* Define flags for the various process types. */ -#define IDL_F (SYS_PROC | PREEMPTIBLE | BILLABLE) /* idle task */ -#define TSK_F (SYS_PROC) /* kernel tasks */ -#define SRV_F (SYS_PROC | PREEMPTIBLE) /* system services */ -#define USR_F (BILLABLE | PREEMPTIBLE) /* user processes */ +#define IDL_F (SYS_PROC | PREEMPTIBLE | BILLABLE) /* idle task */ +#define TSK_F (SYS_PROC) /* kernel tasks */ +#define SRV_F (SYS_PROC | PREEMPTIBLE) /* system services */ +#define USR_F (BILLABLE | PREEMPTIBLE) /* user processes */ /* Define system call traps for the various process types. These call masks * determine what system call traps a process is allowed to make. diff --git a/servers/Makefile b/servers/Makefile index fadeba6a8..076a7d0d4 100644 --- a/servers/Makefile +++ b/servers/Makefile @@ -16,7 +16,7 @@ build: all all install depend clean: cd ./pm && $(MAKE) $@ cd ./fs && $(MAKE) $@ - cd ./sm && $(MAKE) $@ + cd ./rs && $(MAKE) $@ cd ./is && $(MAKE) $@ cd ./init && $(MAKE) $@ cd ./inet && $(MAKE) $@ diff --git a/servers/is/dmp.c b/servers/is/dmp.c index 2535979ce..7a46b4837 100644 --- a/servers/is/dmp.c +++ b/servers/is/dmp.c @@ -40,7 +40,6 @@ PUBLIC int do_fkey_pressed(message *m) if (pressed(F11)) timing_dmp(); if (pressed(F12)) sched_dmp(); -#if DEAD_CODE if (pressed(F9)) { printf("IS server going into infinite loop... hit 5x a function key\n"); printf("Five times a function key is fine as well ...\n"); @@ -52,7 +51,6 @@ PUBLIC int do_fkey_pressed(message *m) printf("IS server back to normal ... \n"); return(EDONTREPLY); } -#endif /* Also check Shift F1-F6 keys. */ if (pressed(SF1)) mproc_dmp(); diff --git a/servers/pm/main.c b/servers/pm/main.c index 1bb1939d6..163238f80 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -205,7 +205,7 @@ PRIVATE void pm_init() /* Set process details found in the image table. */ rmp = &mproc[ip->proc_nr]; strncpy(rmp->mp_name, ip->proc_name, PROC_NAME_LEN); - rmp->mp_parent = SM_PROC_NR; + rmp->mp_parent = RS_PROC_NR; rmp->mp_nice = get_nice_value(ip->priority); if (ip->proc_nr == INIT_PROC_NR) { /* user process */ rmp->mp_pid = INIT_PID; diff --git a/servers/rs/Makefile b/servers/rs/Makefile new file mode 100644 index 000000000..ae8b16734 --- /dev/null +++ b/servers/rs/Makefile @@ -0,0 +1,45 @@ +# Makefile for Reincarnation Server (RS) +SERVER = rs +UTIL = service + +# directories +u = /usr +i = $u/include +s = $i/sys +m = $i/minix +b = $i/ibm + +# programs, flags, etc. +CC = exec cc +CFLAGS = -I$i +LDFLAGS = -i +UTIL_LIBS = -lsys +LIBS = -lsys -lsysutil + +UTIL_OBJ = service.o +OBJ = rs.o manager.o + +# build local binary +all build: $(SERVER) $(UTIL) +$(UTIL): $(UTIL_OBJ) + $(CC) -o $@ $(LDFLAGS) $(UTIL_OBJ) $(UTIL_LIBS) +$(SERVER): $(OBJ) + $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS) + +# install with other servers +install: /bin/$(UTIL) /usr/sbin/$(SERVER) +/bin/$(UTIL): $(UTIL) + install -c $? $@ +/usr/sbin/$(SERVER): $(SERVER) + install -o root -c $? $@ + +# clean up local files +clean: + rm -f $(UTIL) $(SERVER) *.o *.bak + +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend + +# Include generated dependencies. +include .depend + diff --git a/servers/sm/manager.c b/servers/rs/manager.c similarity index 99% rename from servers/sm/manager.c rename to servers/rs/manager.c index 7f5b9f48d..2b5711969 100644 --- a/servers/sm/manager.c +++ b/servers/rs/manager.c @@ -9,7 +9,7 @@ * Jul 22, 2005: Created (Jorrit N. Herder) */ -#include "sm.h" +#include "rs.h" #include #include #include @@ -99,6 +99,7 @@ PUBLIC int do_start(message *m_ptr) return(OK); } + /*===========================================================================* * do_stop * *===========================================================================*/ @@ -139,3 +140,4 @@ PUBLIC int do_exit(message *m_ptr) return(OK); } + diff --git a/servers/sm/proto.h b/servers/rs/proto.h similarity index 99% rename from servers/sm/proto.h rename to servers/rs/proto.h index bee7deeb2..522078241 100644 --- a/servers/sm/proto.h +++ b/servers/rs/proto.h @@ -8,3 +8,4 @@ _PROTOTYPE( int do_exit, (message *m)); _PROTOTYPE( int do_start, (message *m)); _PROTOTYPE( int do_stop, (message *m)); + diff --git a/servers/sm/sm.c b/servers/rs/rs.c similarity index 85% rename from servers/sm/sm.c rename to servers/rs/rs.c index 09f64ff7b..e4be0d051 100644 --- a/servers/sm/sm.c +++ b/servers/rs/rs.c @@ -1,10 +1,11 @@ -/* System Process Manager. +/* Reincarnation Server. This servers starts new system services and detects + * they are exiting. In case of errors, system services can be restarted. * * Created: * Jul 22, 2005 by Jorrit N. Herder */ -#include "sm.h" +#include "rs.h" /* Set debugging level to 0, 1, or 2 to see no, some, all debug output. */ #define DEBUG_LEVEL 1 @@ -70,7 +71,7 @@ PUBLIC void main(void) result = do_stop(&m_in); break; default: - printf("Warning, SM got unexpected request %d from %d\n", + printf("Warning, RS got unexpected request %d from %d\n", m_in.m_type, m_in.m_source); result = EINVAL; } @@ -82,12 +83,13 @@ PUBLIC void main(void) } } + /*===========================================================================* * init_server * *===========================================================================*/ PRIVATE void init_server(void) { -/* Initialize the information service. */ +/* Initialize the reincarnation server. */ int i, s; struct sigaction sa; @@ -95,12 +97,13 @@ PRIVATE void init_server(void) sa.sa_handler = SIG_MESS; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; - if (sigaction(SIGCHLD, &sa, NULL)<0) panic("SM","sigaction failed", errno); - if (sigaction(SIGTERM, &sa, NULL)<0) panic("SM","sigaction failed", errno); - if (sigaction(SIGABRT, &sa, NULL)<0) panic("SM","sigaction failed", errno); - if (sigaction(SIGHUP, &sa, NULL)<0) panic("SM","sigaction failed", errno); + if (sigaction(SIGCHLD, &sa, NULL)<0) panic("RS","sigaction failed", errno); + if (sigaction(SIGTERM, &sa, NULL)<0) panic("RS","sigaction failed", errno); + if (sigaction(SIGABRT, &sa, NULL)<0) panic("RS","sigaction failed", errno); + if (sigaction(SIGHUP, &sa, NULL)<0) panic("RS","sigaction failed", errno); } + /*===========================================================================* * get_work * *===========================================================================*/ @@ -109,11 +112,12 @@ PRIVATE void get_work() int status = 0; status = receive(ANY, &m_in); /* this blocks until message arrives */ if (OK != status) - panic("SM","failed to receive message!", status); + panic("RS","failed to receive message!", status); who = m_in.m_source; /* message arrived! set sender */ callnr = m_in.m_type; /* set function call number */ } + /*===========================================================================* * reply * *===========================================================================*/ @@ -125,6 +129,8 @@ int result; /* report result to replyee */ m_out.m_type = result; /* build reply message */ send_status = send(who, &m_out); /* send the message */ if (OK != send_status) - panic("SM", "unable to send reply!", send_status); + panic("RS", "unable to send reply!", send_status); } + + diff --git a/servers/sm/sm.h b/servers/rs/rs.h similarity index 100% rename from servers/sm/sm.h rename to servers/rs/rs.h diff --git a/servers/sm/service.c b/servers/rs/service.c similarity index 95% rename from servers/sm/service.c rename to servers/rs/service.c index 17a9048ee..8719ca9de 100644 --- a/servers/sm/service.c +++ b/servers/rs/service.c @@ -1,3 +1,10 @@ +/* Utility to start or stop system services. Requests are sent to the + * reincarnation server that does the actual work. + * + * Changes: + * Jul 22, 2005: Created (Jorrit N. Herder) + */ + #include #include #include @@ -11,6 +18,7 @@ #include #include + /* This array defines all known requests. */ PRIVATE char *known_requests[] = { "up", @@ -68,6 +76,7 @@ PRIVATE void panic(char *app_name, char *mess, int num) exit(EGENERIC); } + /* Parse and verify correctness of arguments. Report problem and exit if an * error is found. Store needed parameters in global variables. */ @@ -139,6 +148,7 @@ PRIVATE int parse_arguments(int argc, char **argv) return(i); } + /* Main program. */ PUBLIC int main(int argc, char **argv) @@ -164,7 +174,7 @@ PUBLIC int main(int argc, char **argv) m.SRV_ARGS_ADDR = req_args; m.SRV_ARGS_LEN = strlen(req_args); m.SRV_DEV_MAJOR = req_major; - if (OK != (s=_taskcall(SM_PROC_NR, SRV_UP, &m))) + if (OK != (s=_taskcall(RS_PROC_NR, SRV_UP, &m))) panic(argv[ARG_NAME], "sendrec to manager server failed", s); result = m.m_type; break;