From 4ca68d42a0b94c4d6f22a2463a725f6762cfe59a Mon Sep 17 00:00:00 2001 From: Arun Thomas Date: Fri, 2 Sep 2011 16:57:22 +0200 Subject: [PATCH] Add MKLIVEUPDATE and MKSTATECTL --- common/include/minix/sef.h | 5 +++++ kernel/Makefile | 8 ++++++++ kernel/config.h | 2 -- lib/libdriver/Makefile | 5 +++++ lib/libdriver/driver.c | 2 ++ lib/libsys/Makefile | 4 ++++ lib/libsys/sef.c | 2 ++ servers/rs/main.c | 2 ++ share/mk/bsd.own.mk | 8 ++++++-- 9 files changed, 34 insertions(+), 4 deletions(-) diff --git a/common/include/minix/sef.h b/common/include/minix/sef.h index bd9e8fadd..d78b39553 100644 --- a/common/include/minix/sef.h +++ b/common/include/minix/sef.h @@ -231,5 +231,10 @@ _PROTOTYPE( void sef_cb_signal_handler_posix_default, (int signo) ); #define sef_signal_debug_begin sef_debug_begin #define sef_signal_debug_end sef_debug_end +#if !defined(USE_LIVEUPDATE) +#undef INTERCEPT_SEF_LU_REQUESTS +#undef SEF_LU_DEBUG +#endif + #endif /* _SEF_H */ diff --git a/kernel/Makefile b/kernel/Makefile index 7c7f7916c..5703a6211 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -73,6 +73,14 @@ SRCS+= debug.c CPPFLAGS+= -DUSE_SYSDEBUG .endif +.if ${USE_LIVEUPDATE} != "no" +CPPFLAGS+= -DUSE_UPDATE +.endif + +.if ${USE_STATECTL} != "no" +CPPFLAGS+= -DUSE_STATECTL +.endif + # These come last, so the profiling buffer is at the end of the data segment SRCS+= profile.c do_sprofile.c diff --git a/kernel/config.h b/kernel/config.h index b688f4769..3fff2d3d4 100644 --- a/kernel/config.h +++ b/kernel/config.h @@ -42,8 +42,6 @@ #define USE_PHYSCOPY 1 /* copy using physical addressing */ #define USE_MEMSET 1 /* write char to a given memory area */ #define USE_RUNCTL 1 /* control stop flags of a process */ -#define USE_UPDATE 1 /* update a process into another */ -#define USE_STATECTL 1 /* let a process control its state */ /* Length of program names stored in the process table. This is only used * for the debugging dumps that can be generated with the IS server. The PM diff --git a/lib/libdriver/Makefile b/lib/libdriver/Makefile index 3f2a1c7cb..4d74e0cc7 100644 --- a/lib/libdriver/Makefile +++ b/lib/libdriver/Makefile @@ -1,7 +1,12 @@ # Makefile for libdriver +.include LIB= driver SRCS= driver.c drvlib.c mq.c +.if ${USE_STATECTL} != "no" +CPPFLAGS+= -DUSE_STATECTL +.endif + .include diff --git a/lib/libdriver/driver.c b/lib/libdriver/driver.c index e90054ce6..3fe6d05b8 100644 --- a/lib/libdriver/driver.c +++ b/lib/libdriver/driver.c @@ -230,10 +230,12 @@ PUBLIC void driver_announce() * For this reason, there may blocked callers when a driver restarts. * Ask the kernel to unblock them (if any). */ +#if USE_STATECTL r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS); if (r != OK) { panic("driver_announce: sys_statectl failed: %d\n", r); } +#endif /* Publish a driver up event. */ r = ds_retrieve_label_name(label, getprocnr()); diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile index 1ba8c4f29..a67c57a91 100644 --- a/lib/libsys/Makefile +++ b/lib/libsys/Makefile @@ -132,6 +132,10 @@ SRCS+= gcov.c \ CPPFLAGS+= -DUSE_COVERAGE .endif +.if ${USE_LIVEUPDATE} != "no" +CPPFLAGS+= -DUSE_LIVEUPDATE +.endif + CPPFLAGS.sched_start.c+= -I${MINIXSRCDIR} .if (${CC} == "gcc") || (${CC} == "clang") diff --git a/lib/libsys/sef.c b/lib/libsys/sef.c index d5066a89e..cbe31344b 100644 --- a/lib/libsys/sef.c +++ b/lib/libsys/sef.c @@ -60,6 +60,7 @@ PUBLIC void sef_startup() sef_self_priv_flags = priv_flags; old_endpoint = NONE; +#if USE_LIVEUPDATE /* RS may wake up with the wrong endpoint, perfom the update in that case. */ if((sef_self_priv_flags & ROOT_SYS_PROC) && sef_self_endpoint != RS_PROC_NR) { r = vm_update(RS_PROC_NR, sef_self_endpoint); @@ -70,6 +71,7 @@ PUBLIC void sef_startup() old_endpoint = sef_self_endpoint; sef_self_endpoint = RS_PROC_NR; } +#endif /* USE_LIVEUPDATE */ #if INTERCEPT_SEF_INIT_REQUESTS /* Intercept SEF Init requests. */ diff --git a/servers/rs/main.c b/servers/rs/main.c index de1561699..cd287241c 100644 --- a/servers/rs/main.c +++ b/servers/rs/main.c @@ -430,6 +430,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) if (OK != (s=sys_setalarm(RS_DELTA_T, 0))) panic("couldn't set alarm: %d", s); +#if USE_LIVEUPDATE /* Now create a new RS instance with a private page table and let the current * instance live update into the replica. Clone RS' own slot first. */ @@ -489,6 +490,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) } NOT_REACHABLE; } +#endif /* USE_LIVEUPDATE */ return(OK); } diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index c4192bfd3..570172e97 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -759,7 +759,8 @@ _MKVARS.yes= \ MKYP #MINIX-specific vars _MKVARS.yes+= \ - MKWATCHDOG MKACPI MKAPIC MKMCONTEXT MKDEBUGREG MKSYSDEBUG + MKWATCHDOG MKACPI MKAPIC MKMCONTEXT MKDEBUGREG MKSYSDEBUG \ + MKLIVEUPDATE MKSTATECTL .for var in ${_MKVARS.yes} ${var}?= yes .endfor @@ -826,6 +827,8 @@ MKMCONTEXT:= no MKCOVERAGE:= no MKDEBUGREG:= no MKSYSDEBUG:= no +MKLIVEUPDATE:= no +MKSTATECTL:= no .endif # @@ -887,7 +890,8 @@ ${var}?= no # variable is set to "no". # .for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP \ -USE_WATCHDOG USE_ACPI USE_APIC USE_MCONTEXT USE_DEBUGREG USE_SYSDEBUG +USE_WATCHDOG USE_ACPI USE_APIC USE_MCONTEXT USE_DEBUGREG USE_SYSDEBUG \ +USE_LIVEUPDATE USE_STATECTL .if (${${var:S/USE_/MK/}} == "no") ${var}:= no .else -- 2.44.0