From f30a16b15917cb39a04eb4f13ff1b63b788a3025 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Sun, 27 Oct 2013 01:54:37 +0200 Subject: [PATCH] Remove support for MKTRACE, MKMCONTEXT, MKSTATECTL Change-Id: Ib5fa53913ecb7b46d30d391dbdd3e8ef21eb2254 --- kernel/Makefile | 13 ------------- kernel/config.h | 3 +++ kernel/system/Makefile.inc | 1 + lib/libblockdriver/Makefile | 4 ---- lib/libblockdriver/driver.c | 2 -- lib/libchardriver/Makefile | 4 ---- lib/libchardriver/chardriver.c | 2 -- lib/libi2cdriver/i2cdriver.c | 2 -- servers/pm/Makefile | 14 ++------------ servers/pm/exec.c | 2 -- servers/pm/forkexit.c | 14 -------------- servers/pm/proto.h | 8 -------- servers/pm/signal.c | 6 ------ share/mk/bsd.own.mk | 9 +++------ 14 files changed, 9 insertions(+), 75 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 0cebcdd6e..69a95d1c7 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -53,11 +53,6 @@ SRCS+= watchdog.c CPPFLAGS+= -DUSE_WATCHDOG .endif -.if ${USE_MCONTEXT} != "no" -SRCS+= do_mcontext.c -CPPFLAGS+= -DUSE_MCONTEXT -.endif - # Extra debugging routines .if ${USE_SYSDEBUG} != "no" SRCS+= debug.c @@ -71,14 +66,6 @@ SRCS+= profile.c do_sprofile.c CPPFLAGS+= -DUSE_UPDATE .endif -.if ${USE_STATECTL} != "no" -CPPFLAGS+= -DUSE_STATECTL -.endif - -.if ${USE_TRACE} != "no" -CPPFLAGS+= -DUSE_TRACE -.endif - CLEANFILES+=extracted-errno.h extracted-mfield.h extracted-mtype.h procoffsets.h debug.o debug.d: extracted-errno.h extracted-mfield.h extracted-mtype.h diff --git a/kernel/config.h b/kernel/config.h index 56cfb7463..a99b2990a 100644 --- a/kernel/config.h +++ b/kernel/config.h @@ -20,6 +20,7 @@ #define USE_EXEC 1 /* update process after execute */ #define USE_CLEAR 1 /* clean up after process exit */ #define USE_EXIT 1 /* a system process wants to exit */ +#define USE_TRACE 1 /* process information and tracing */ #define USE_GETKSIG 1 /* retrieve pending kernel signals */ #define USE_ENDKSIG 1 /* finish pending kernel signals */ #define USE_KILL 1 /* send a signal to a process */ @@ -42,6 +43,8 @@ #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_STATECTL 1 /* let a process control its state */ +#define USE_MCONTEXT 1 /* enable getting/setting of machine context */ #if defined(__arm__) #define USE_PADCONF 1 /* configure pinmux */ diff --git a/kernel/system/Makefile.inc b/kernel/system/Makefile.inc index 431bbe584..ef8cf2e3c 100644 --- a/kernel/system/Makefile.inc +++ b/kernel/system/Makefile.inc @@ -36,6 +36,7 @@ SRCS+= \ do_cprofile.c \ do_profbuf.c \ do_vmctl.c \ + do_mcontext.c \ do_schedule.c \ do_schedctl.c \ do_statectl.c diff --git a/lib/libblockdriver/Makefile b/lib/libblockdriver/Makefile index dc00508fe..273201a0d 100644 --- a/lib/libblockdriver/Makefile +++ b/lib/libblockdriver/Makefile @@ -5,8 +5,4 @@ LIB= blockdriver SRCS= driver.c drvlib.c driver_st.c driver_mt.c mq.c trace.c -.if ${USE_STATECTL} != "no" -CPPFLAGS+= -DUSE_STATECTL -.endif - .include diff --git a/lib/libblockdriver/driver.c b/lib/libblockdriver/driver.c index 932aa576d..780abe0bd 100644 --- a/lib/libblockdriver/driver.c +++ b/lib/libblockdriver/driver.c @@ -106,10 +106,8 @@ void blockdriver_announce(int type) * will not restart statefully, and thus will skip this code. */ if (type == SEF_INIT_RESTART) { -#if USE_STATECTL if ((r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS)) != OK) panic("blockdriver_init: sys_statectl failed: %d", r); -#endif } /* Publish a driver up event. */ diff --git a/lib/libchardriver/Makefile b/lib/libchardriver/Makefile index f3f0aa56e..e38eb0ba4 100644 --- a/lib/libchardriver/Makefile +++ b/lib/libchardriver/Makefile @@ -5,8 +5,4 @@ LIB= chardriver SRCS= chardriver.c -.if ${USE_STATECTL} != "no" -CPPFLAGS+= -DUSE_STATECTL -.endif - .include diff --git a/lib/libchardriver/chardriver.c b/lib/libchardriver/chardriver.c index 28fbacaac..21f065df1 100644 --- a/lib/libchardriver/chardriver.c +++ b/lib/libchardriver/chardriver.c @@ -106,10 +106,8 @@ void chardriver_announce(void) * For this reason, there may blocked callers when a driver restarts. * Ask the kernel to unblock them (if any). */ -#if USE_STATECTL if ((r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS)) != OK) panic("chardriver_announce: sys_statectl failed: %d", r); -#endif /* Publish a driver up event. */ if ((r = ds_retrieve_label_name(label, getprocnr())) != OK) diff --git a/lib/libi2cdriver/i2cdriver.c b/lib/libi2cdriver/i2cdriver.c index 1d16db095..9d5a6df20 100644 --- a/lib/libi2cdriver/i2cdriver.c +++ b/lib/libi2cdriver/i2cdriver.c @@ -21,11 +21,9 @@ i2cdriver_announce(uint32_t bus) * For this reason, there may blocked callers when a driver restarts. * Ask the kernel to unblock them (if any). */ -#if USE_STATECTL if ((r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS)) != OK) { panic("chardriver_init: sys_statectl failed: %d", r); } -#endif /* Publish a driver up event. */ r = ds_retrieve_label_name(label, getprocnr()); diff --git a/servers/pm/Makefile b/servers/pm/Makefile index 5a64169c0..282c89f8c 100644 --- a/servers/pm/Makefile +++ b/servers/pm/Makefile @@ -3,18 +3,8 @@ # Makefile for Process Manager (PM) PROG= pm SRCS= main.c forkexit.c break.c exec.c time.c alarm.c \ - signal.c utility.c table.c getset.c misc.c \ - profile.c schedule.c - -.if ${USE_MCONTEXT} != "no" -SRCS+= mcontext.c -CPPFLAGS+= -DUSE_MCONTEXT -.endif - -.if ${USE_TRACE} != "no" -SRCS+= trace.c -CPPFLAGS+= -DUSE_TRACE -.endif + signal.c utility.c table.c trace.c getset.c misc.c \ + profile.c mcontext.c schedule.c DPADD+= ${LIBSYS} ${LIBTIMERS} LDADD+= -lsys -ltimers diff --git a/servers/pm/exec.c b/servers/pm/exec.c index 89285920b..f44a4940e 100644 --- a/servers/pm/exec.c +++ b/servers/pm/exec.c @@ -188,14 +188,12 @@ void exec_restart(struct mproc *rmp, int result, vir_bytes pc, vir_bytes sp, /* Cause a signal if this process is traced. * Do this before making the process runnable again! */ -#if USE_TRACE if (rmp->mp_tracer != NO_TRACER && !(rmp->mp_trace_flags & TO_NOEXEC)) { sn = (rmp->mp_trace_flags & TO_ALTEXEC) ? SIGSTOP : SIGTRAP; check_sig(rmp->mp_pid, sn, FALSE /* ksig */); } -#endif /* USE_TRACE */ /* Call kernel to exec with SP and PC set by VFS. */ r = sys_exec(rmp->mp_endpoint, (char *) sp, rmp->mp_name, pc, ps_str); diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index 8cc065af5..eafd37b6c 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -122,11 +122,9 @@ int do_fork() tell_vfs(rmc, &m); -#if USE_TRACE /* Tell the tracer, if any, about the new child */ if (rmc->mp_tracer != NO_TRACER) sig_proc(rmc, SIGSTOP, TRUE /*trace*/, FALSE /* ksig */); -#endif /* USE_TRACE */ /* Do not reply until VFS is ready to process the fork * request @@ -215,11 +213,9 @@ int do_srv_fork() tell_vfs(rmc, &m); -#if USE_TRACE /* Tell the tracer, if any, about the new child */ if (rmc->mp_tracer != NO_TRACER) sig_proc(rmc, SIGSTOP, TRUE /*trace*/, FALSE /* ksig */); -#endif /* USE_TRACE */ /* Wakeup the newly created process */ setreply(rmc-mproc, OK); @@ -357,12 +353,10 @@ int dump_core; /* flag indicating whether to dump core */ /* If the process has children, disinherit them. INIT is the new parent. */ for (rmp = &mproc[0]; rmp < &mproc[NR_PROCS]; rmp++) { if (!(rmp->mp_flags & IN_USE)) continue; -#if USE_TRACE if (rmp->mp_tracer == proc_nr) { /* This child's tracer died. Do something sensible. */ tracer_died(rmp); } -#endif /* USE_TRACE */ if (rmp->mp_parent == proc_nr) { /* 'rmp' now points to a child to be disinherited. */ rmp->mp_parent = INIT_PROC_NR; @@ -423,14 +417,12 @@ int dump_core; /* flag indicating whether to dump core */ panic("exit_restart: vm_exit failed: %d", r); } -#if USE_TRACE if (rmp->mp_flags & TRACE_EXIT) { /* Wake up the tracer, completing the ptrace(T_EXIT) call */ mproc[rmp->mp_tracer].mp_reply.reply_trace = 0; setreply(rmp->mp_tracer, OK); } -#endif /* USE_TRACE */ /* Clean up if the parent has collected the exit status */ if (rmp->mp_flags & TOLD_PARENT) @@ -476,7 +468,6 @@ int do_waitpid() children++; /* this child is acceptable */ -#if USE_TRACE if (rp->mp_tracer == who_p) { if (rp->mp_flags & TRACE_ZOMBIE) { /* Traced child meets the pid test and has exited. */ @@ -499,7 +490,6 @@ int do_waitpid() } } } -#endif /* USE_TRACE */ if (rp->mp_parent == who_p) { if (rp->mp_flags & ZOMBIE) { @@ -567,7 +557,6 @@ struct mproc *rmp; /* See if we have to notify a tracer process first. */ if (rmp->mp_tracer != NO_TRACER && rmp->mp_tracer != rmp->mp_parent) { -#if USE_TRACE rmp->mp_flags |= TRACE_ZOMBIE; t_mp = &mproc[rmp->mp_tracer]; @@ -577,7 +566,6 @@ struct mproc *rmp; return; tell_tracer(rmp); -#endif /* USE_TRACE */ } else { rmp->mp_flags |= ZOMBIE; @@ -652,7 +640,6 @@ register struct mproc *child; /* tells which process is exiting */ child->mp_flags |= TOLD_PARENT; /* avoid informing parent twice */ } -#if USE_TRACE /*===========================================================================* * tell_tracer * *===========================================================================*/ @@ -710,7 +697,6 @@ struct mproc *child; /* process being traced */ check_parent(child, TRUE /*try_cleanup*/); } } -#endif /* USE_TRACE */ /*===========================================================================* * cleanup * diff --git a/servers/pm/proto.h b/servers/pm/proto.h index 9789a9cd6..b46cae0cf 100644 --- a/servers/pm/proto.h +++ b/servers/pm/proto.h @@ -43,10 +43,6 @@ void setreply(int proc_nr, int result); /* mcontext.c */ int do_getmcontext(void); int do_setmcontext(void); -#if ! USE_MCONTEXT -#define do_getmcontext no_sys -#define do_setmcontext no_sys -#endif /* misc.c */ int do_reboot(void); @@ -95,10 +91,6 @@ int do_settime(void); /* trace.c */ int do_trace(void); void stop_proc(struct mproc *rmp, int sig_nr); -#if ! USE_TRACE -#define do_trace no_sys -#define stop_proc no_sys -#endif /* utility.c */ pid_t get_free_pid(void); diff --git a/servers/pm/signal.c b/servers/pm/signal.c index fd35304c7..47661368e 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -330,7 +330,6 @@ int ksig; /* non-zero means signal comes from kernel */ panic("PM: signal %d sent to exiting process %d\n", signo, slot); } -#if USE_TRACE if (trace == TRUE && rmp->mp_tracer != NO_TRACER && signo != SIGKILL) { /* Signal should be passed to the debugger first. * This happens before any checks on block/ignore masks; otherwise, @@ -344,7 +343,6 @@ int ksig; /* non-zero means signal comes from kernel */ return; } -#endif if (rmp->mp_flags & VFS_CALL) { sigaddset(&rmp->mp_sigpending, signo); @@ -414,7 +412,6 @@ int ksig; /* non-zero means signal comes from kernel */ return; } -#if USE_TRACE if ((rmp->mp_flags & STOPPED) && signo != SIGKILL) { /* If the process is stopped for a debugger, do not deliver any signals * (except SIGKILL) in order not to confuse the debugger. The signals @@ -425,7 +422,6 @@ int ksig; /* non-zero means signal comes from kernel */ sigaddset(&rmp->mp_ksigpending, signo); return; } -#endif /* USE_TRACE */ if (!badignore && sigismember(&rmp->mp_catch, signo)) { /* Signal is caught. First interrupt the process's current call, if * applicable. This may involve a roundtrip to VFS, in which case we'll @@ -611,10 +607,8 @@ struct mproc *rmp; if (rmp->mp_flags & (VFS_CALL | EXITING)) return; if (rmp->mp_flags & TRACE_EXIT) { -#if USE_TRACE /* Tracer requested exit with specific exit value */ exit_proc(rmp, rmp->mp_exitstatus, FALSE /*dump_core*/); -#endif /* USE_TRACE */ } else if (rmp->mp_flags & PM_SIG_PENDING) { /* We saved signal(s) for after finishing a VFS call. Deal with this. diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 681a715db..5a05c215b 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -1007,7 +1007,7 @@ _MKVARS.yes= \ #MINIX-specific vars _MKVARS.yes+= \ - MKMCONTEXT MKSYSDEBUG MKLIVEUPDATE MKSTATECTL MKTRACE MKLWIP + MKSYSDEBUG MKLIVEUPDATE MKLWIP .if (${MACHINE_ARCH} == "i386") _MKVARS.yes+= \ MKWATCHDOG MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI @@ -1126,12 +1126,9 @@ MKNLS:= no MKWATCHDOG:= no MKACPI:= no MKAPIC:= no -MKMCONTEXT:= no MKDEBUGREG:= no MKSYSDEBUG:= no MKLIVEUPDATE:= no -MKSTATECTL:= no -MKTRACE:= no .endif # @@ -1199,8 +1196,8 @@ ${var}?= yes #MINIX-specific vars .for var in \ - USE_WATCHDOG USE_ACPI USE_APIC USE_MCONTEXT USE_DEBUGREG USE_SYSDEBUG \ - USE_LIVEUPDATE USE_STATECTL USE_TRACE USE_PCI USE_BITCODE + USE_WATCHDOG USE_ACPI USE_APIC USE_DEBUGREG USE_SYSDEBUG \ + USE_LIVEUPDATE USE_PCI USE_BITCODE .if (${${var:S/USE_/MK/}} == "no") ${var}:= no .else