From c107dbe1d04b218697f86b1c999489e4c560e917 Mon Sep 17 00:00:00 2001 From: Erik van der Kouwe Date: Tue, 2 Feb 2010 15:10:00 +0000 Subject: [PATCH] Man-pages on mkdep, cdprobe, loadramdisk and newroot; thanks to Antoine Leca --- commands/scripts/packman.sh | 3 ++ man/man1/mkdep.1 | 85 +++++++++++++++++++++++++++++++++++++ man/man2/sigaction.2 | 4 +- man/man8/cdprobe.8 | 40 +++++++++++++++++ man/man8/loadramdisk.8 | 25 +++++++++++ man/man8/newroot.8 | 40 +++++++++++++++++ servers/pm/alarm.c | 2 +- servers/pm/exec.c | 2 +- servers/pm/forkexit.c | 10 ++--- servers/pm/misc.c | 4 +- servers/pm/proto.h | 5 ++- servers/pm/signal.c | 16 ++++--- servers/pm/trace.c | 10 +++-- test/test5.c | 8 ++-- 14 files changed, 226 insertions(+), 28 deletions(-) create mode 100755 man/man1/mkdep.1 create mode 100755 man/man8/cdprobe.8 create mode 100755 man/man8/loadramdisk.8 create mode 100755 man/man8/newroot.8 diff --git a/commands/scripts/packman.sh b/commands/scripts/packman.sh index 773d3a598..2d641b6b1 100644 --- a/commands/scripts/packman.sh +++ b/commands/scripts/packman.sh @@ -240,6 +240,9 @@ do cd $TMPDIR fi done # Iterate package range done # Iterate package range list + + # Do not repeat after installing all packages if -y is specified + [ "$YESMODE" ] && cont=n done rm -f $TMPDIR/.* # Remove any remaining .postinstall script or .list* diff --git a/man/man1/mkdep.1 b/man/man1/mkdep.1 new file mode 100755 index 000000000..73bbb508d --- /dev/null +++ b/man/man1/mkdep.1 @@ -0,0 +1,85 @@ +.TH MKDEP 1 "February 1st, 2010" +.SH NAME +mkdep \- print depencies in the Right Way for make(1) +.SH SYNOPSIS +.B mkdep +.I path +.br +.B mkdep +.I pp_command +.IR sourcefile " ... " +.SH DESCRIPTION +.B Mkdep +does what +.B cpp -M +should do, but no compiler gets it right, they all +strip the leading path of the \fI*.o\fP files. +.PP +The first synopsis form just creates the needed +.I .depend +files in all the subdirectories of +.IR path . +.PP +The second synopsis form does the hard work of emitting the +dependencies instructions for +.IR sourcefile +in the right format expected by +.IR make (1), +including the path information. +.PP +.B Mkdep +expects +.I pp_command +to be the correct invocation for the preprocessor +.\" FIXME: there are no cpp(1x) manpage presently... +.\" .IR cpp (1x) +command adequate for +.IR sourcefile , +and also expects this command to emit lines of the form +.nf +.ta +1i +\w'# lineno "filename"'u+2m + # \fIlineno\fP "\fIfilename\fP" +.fi +for each files which is included by the named +.IR sourcefile . +.PP +For C, the typical idiom is to add in all your +.IR Makefile s: +.PP +.nf +.ta +0.2i +\w'depend:'u+1m +\w'mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend'u+2m + depend: + cd sub1 && $(MAKE) -$(MAKEFLAGS) $@ + cd sub2 && $(MAKE) -$(MAKEFLAGS) $@ + # repeat for each subdirectory + mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend +.PP + # Include generated dependencies. + include .depend +.PP +.fi +.SH "SEE ALSO" +.BR cc (1), +.BR make (1). +.SH BUGS +Since +.I Makefile +is read in full before any command is executed, +there is no way to prevent +.IR make (1) +to report an error if the +.I .depend +file was not created beforehand; hence the first form of +.IR mkdep +should be used \fBbefore\fP any attempt is done to use this feature in any +.IR Makefile . +.PP +The current version hardcodes the \fI.o\fP suffix, so it cannot be used for e.g. +.IR flex (1) +or +.IR yacc (1) +source files. +.SH AUTHOR +.I Mkdep.c +was written by Kees J. Bot and Jorrit N. Herder. +.\" This manual page by A. Leca, last revised 2010-02-01. diff --git a/man/man2/sigaction.2 b/man/man2/sigaction.2 index 91ee36df4..b95ade540 100644 --- a/man/man2/sigaction.2 +++ b/man/man2/sigaction.2 @@ -163,8 +163,8 @@ The process is killed if the signal is not caught. .TP .B K The process is killed if the signal is not caught. If the signal is received -while ignored or masked, the process is killed even if a handler is defined to -catch the signal. +due to an exception while ignored or masked, the process is killed even if a +handler is defined to catch the signal. .TP .B c The signal causes a core dump. diff --git a/man/man8/cdprobe.8 b/man/man8/cdprobe.8 new file mode 100755 index 000000000..b5db64db7 --- /dev/null +++ b/man/man8/cdprobe.8 @@ -0,0 +1,40 @@ +.TH CDPROBE 8 "February 1st, 2010" +.SH NAME +cdprobe \- guess where the Minix CD is +.SH SYNOPSIS +.B cdprobe +.SH DESCRIPTION +.B Cdprobe +prints on standard output the name of the device (in +.BI /dev/c X d Y +form) of a device containing a CD with the proper layout to install Minix from it. +.br +Such a CD should have a MINIX cd label, +an IBM-format partition table at the beginning (like any hardisk), +and the file systems pointed to at positions +.IR p1 +and +.IR p2 +of that partition table, should be valid (mountable) Minix file systems. +.SH DIAGNOSTICS +The return code is +.B 0 +after successfully printing the device, or +.B 1 +if some error or unexpected condition occured. +Appropriate diagnostic messages are printed on standard error. +.SH NOTES +.B Cdprobe +probes all the possible drives on the system, so can try for a long time, +particularly when there are no readable CD, or when the controller cannot be +successfully addressed at hardware level. +.SH BUGS +There is some nasty hard-codery (like MINIX cd label) that can be improved on. +.SH "SEE ALSO" +.BR at (4), +.BR /etc/rc +on the initial ramdisk. +.SH AUTHOR +.I Cdprobe.c +was written by Ben Gras and Philip Homburg. +.\" This manual page by A. Leca, last revised 2010-02-01. diff --git a/man/man8/loadramdisk.8 b/man/man8/loadramdisk.8 new file mode 100755 index 000000000..a3748e8c9 --- /dev/null +++ b/man/man8/loadramdisk.8 @@ -0,0 +1,25 @@ +.TH LOADRAMDISK 8 "February 1st, 2010" +.SH NAME +loadramdisk \- copy an image of a file system to /dev/ram +.SH SYNOPSIS +.B loadramdisk +.IR file +.SH DESCRIPTION +.B Loadramdisk +copies the content of a device or a file containing an image of a file system, +specified by the +.I file +argument, to \fB/dev/ram\fP. This way the source is preserved +untouched, and can resides on a read-only media like a CD, while the copied-to +version may be mounted as read-write file system and used as root device. +.SH NOTES +A ramdisk can be initialized only once. +.SH "SEE ALSO" +.BR dev (4), +.BR init (8), +.BR mount (2), +.BR newroot (8). +.SH AUTHOR +.I Loadramdisk.c +was written by Philip Homburg. +.\" This manual page by A. Leca, last revised 2010-02-01. diff --git a/man/man8/newroot.8 b/man/man8/newroot.8 new file mode 100755 index 000000000..5598faf50 --- /dev/null +++ b/man/man8/newroot.8 @@ -0,0 +1,40 @@ +.TH NEWROOT 8 "February 1st, 2010" +.SH NAME +newroot \- replace the current root with a new one +.SH SYNOPSIS +.B newroot +.RB [ \-i ] +.I block-special +.SH OPTIONS +.BR "\-i" " Copy mfs binary from boot image to memory" +.SH DESCRIPTION +.B Newroot +causes the present \fB/\fP file system to be discarded and +replaced by the one stored in the device indicated by +.IR block-special . +.PP +The +.B \-i +option may be used to prevent loading the file system +service for the new file system from disk. This is useful when +for some reason the \fImfs\fP binary on disk malfunctions, +rendering Minix unable to boot. +.PP +This command is normally used to replace the initial ramdisk +loaded as part of the operating system, with the operational +version stored on disk. As such, it should be invoked from the +.B /etc/rc +stored in the initial-ramdisk image. +.SH NOTES +.B Newroot +should be used before any "real" use of the +.IR mount (1) +command. +.SH "SEE ALSO" +.BR init (8), +.BR mount (1), +.BR mount (2). +.SH AUTHOR +.I Newroot.c +was written by Philip Homburg. +.\" This manual page by A. Leca, last revised 2010-02-01. diff --git a/servers/pm/alarm.c b/servers/pm/alarm.c index 82f4172cb..8033eebb3 100644 --- a/servers/pm/alarm.c +++ b/servers/pm/alarm.c @@ -374,5 +374,5 @@ struct timer *tp; set_alarm(rmp, rmp->mp_interval[ITIMER_REAL]); else rmp->mp_flags &= ~ALARM_ON; - check_sig(rmp->mp_pid, SIGALRM); + check_sig(rmp->mp_pid, SIGALRM, FALSE /* ksig */); } diff --git a/servers/pm/exec.c b/servers/pm/exec.c index aca0dfad3..e1c8e7f75 100644 --- a/servers/pm/exec.c +++ b/servers/pm/exec.c @@ -185,7 +185,7 @@ int result; { sn = (rmp->mp_trace_flags & TO_ALTEXEC) ? SIGSTOP : SIGTRAP; - check_sig(rmp->mp_pid, sn); + check_sig(rmp->mp_pid, sn, FALSE /* ksig */); } new_sp= (char *)rmp->mp_procargs; diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index 72b3d91a1..f2796f2c9 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -114,7 +114,7 @@ PUBLIC int do_fork() /* Tell the tracer, if any, about the new child */ if (rmc->mp_tracer != NO_TRACER) - sig_proc(rmc, SIGSTOP, TRUE /*trace*/); + sig_proc(rmc, SIGSTOP, TRUE /*trace*/, FALSE /* ksig */); /* Do not reply until FS is ready to process the fork * request @@ -201,7 +201,7 @@ PUBLIC int do_fork_nb() /* Tell the tracer, if any, about the new child */ if (rmc->mp_tracer != NO_TRACER) - sig_proc(rmc, SIGSTOP, TRUE /*trace*/); + sig_proc(rmc, SIGSTOP, TRUE /*trace*/, FALSE /* ksig */); /* Wakeup the newly created process */ setreply(rmc-mproc, OK); @@ -341,7 +341,7 @@ int dump_core; /* flag indicating whether to dump core */ } /* Send a hangup to the process' process group if it was a session leader. */ - if (procgrp != 0) check_sig(-procgrp, SIGHUP); + if (procgrp != 0) check_sig(-procgrp, SIGHUP, FALSE /* ksig */); } /*===========================================================================* @@ -564,7 +564,7 @@ int try_cleanup; /* clean up the child when done? */ } else { /* Parent is not waiting. */ - sig_proc(p_mp, SIGCHLD, TRUE /*trace*/); + sig_proc(p_mp, SIGCHLD, TRUE /*trace*/, FALSE /* ksig */); } } @@ -637,7 +637,7 @@ struct mproc *child; /* process being traced */ * Note that this may cause cascading exits. */ if (!(child->mp_flags & EXITING)) { - sig_proc(child, SIGKILL, TRUE /*trace*/); + sig_proc(child, SIGKILL, TRUE /*trace*/, FALSE /* ksig */); return; } diff --git a/servers/pm/misc.c b/servers/pm/misc.c index bd046ad13..e5330ac89 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -392,8 +392,8 @@ PUBLIC int do_reboot() * SIGKILL. So first kill, then reboot. */ - check_sig(-1, SIGKILL); /* kill all users except init */ - sys_stop(INIT_PROC_NR); /* stop init, but keep it around */ + check_sig(-1, SIGKILL, FALSE /* ksig*/); /* kill all users except init */ + sys_stop(INIT_PROC_NR); /* stop init, but keep it around */ /* Tell FS to reboot */ m.m_type = PM_REBOOT; diff --git a/servers/pm/proto.h b/servers/pm/proto.h index 34cca0ae5..cb979aacc 100644 --- a/servers/pm/proto.h +++ b/servers/pm/proto.h @@ -64,8 +64,9 @@ _PROTOTYPE( int do_cprofile, (void) ); _PROTOTYPE( int do_kill, (void) ); _PROTOTYPE( int ksig_pending, (void) ); _PROTOTYPE( int do_pause, (void) ); -_PROTOTYPE( int check_sig, (pid_t proc_id, int signo) ); -_PROTOTYPE( void sig_proc, (struct mproc *rmp, int signo, int trace) ); +_PROTOTYPE( int check_sig, (pid_t proc_id, int signo, int ksig) ); +_PROTOTYPE( void sig_proc, (struct mproc *rmp, int signo, int trace, + int ksig) ); _PROTOTYPE( int do_sigaction, (void) ); _PROTOTYPE( int do_sigpending, (void) ); _PROTOTYPE( int do_sigprocmask, (void) ); diff --git a/servers/pm/signal.c b/servers/pm/signal.c index a13756857..7394bb1c7 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -196,7 +196,7 @@ PUBLIC int do_kill() { /* Perform the kill(pid, signo) system call. */ - return check_sig(m_in.pid, m_in.sig_nr); + return check_sig(m_in.pid, m_in.sig_nr, FALSE /* ksig */); } /*===========================================================================* @@ -295,7 +295,7 @@ sigset_t sig_map; id = proc_id; break; } - check_sig(id, i); + check_sig(id, i, TRUE /* ksig */); } /* If SIGNDELAY is set, an earlier sys_stop() failed because the process was @@ -333,10 +333,11 @@ PUBLIC int do_pause() /*===========================================================================* * sig_proc * *===========================================================================*/ -PUBLIC void sig_proc(rmp, signo, trace) +PUBLIC void sig_proc(rmp, signo, trace, ksig) register struct mproc *rmp; /* pointer to the process to be signaled */ int signo; /* signal to send to process (1 to _NSIG-1) */ int trace; /* pass signal to tracer first? */ +int ksig; /* non-zero means signal comes from kernel */ { /* Send a signal to a process. Check to see if the signal is to be caught, * ignored, tranformed into a message (for system processes) or blocked. @@ -388,7 +389,7 @@ int trace; /* pass signal to tracer first? */ } /* some signals cannot be safely ignored */ - badignore = sigismember(&noign_sset, signo) && ( + badignore = ksig && sigismember(&noign_sset, signo) && ( sigismember(&rmp->mp_ignore, signo) || sigismember(&rmp->mp_sigmask, signo) || sigismember(&rmp->mp_sig2mess, signo)); @@ -462,9 +463,10 @@ int trace; /* pass signal to tracer first? */ /*===========================================================================* * check_sig * *===========================================================================*/ -PUBLIC int check_sig(proc_id, signo) +PUBLIC int check_sig(proc_id, signo, ksig) pid_t proc_id; /* pid of proc to sig, or 0 or -1, or -pgrp */ int signo; /* signal to send to process (0 to _NSIG-1) */ +int ksig; /* non-zero means signal comes from kernel */ { /* Check to see if it is possible to send a signal. The signal may have to be * sent to a group of processes. This routine is invoked by the KILL system @@ -515,7 +517,7 @@ int signo; /* signal to send to process (0 to _NSIG-1) */ * signal may be caught, blocked, ignored, or cause process * termination, possibly with core dump. */ - sig_proc(rmp, signo, TRUE /*trace*/); + sig_proc(rmp, signo, TRUE /*trace*/, ksig); if (proc_id > 0) break; /* only one process being signaled */ } @@ -545,7 +547,7 @@ register struct mproc *rmp; if (sigismember(&rmp->mp_sigpending, i) && !sigismember(&rmp->mp_sigmask, i)) { sigdelset(&rmp->mp_sigpending, i); - sig_proc(rmp, i, FALSE /*trace*/); + sig_proc(rmp, i, FALSE /*trace*/, FALSE /* ksig */); if (rmp->mp_flags & FS_CALL) break; diff --git a/servers/pm/trace.c b/servers/pm/trace.c index 9b4a0783c..2d916daff 100644 --- a/servers/pm/trace.c +++ b/servers/pm/trace.c @@ -85,7 +85,7 @@ PUBLIC int do_trace() child->mp_tracer = who_p; child->mp_trace_flags = TO_NOEXEC; - sig_proc(child, SIGSTOP, TRUE /*trace*/); + sig_proc(child, SIGSTOP, TRUE /*trace*/, FALSE /* ksig */); mp->mp_reply.reply_trace = 0; return(OK); @@ -192,12 +192,13 @@ PUBLIC int do_trace() for (i = 1; i < _NSIG; i++) { if (sigismember(&child->mp_sigtrace, i)) { sigdelset(&child->mp_sigtrace, i); - check_sig(child->mp_pid, i); + check_sig(child->mp_pid, i, FALSE /* ksig */); } } if (m_in.data > 0) { /* issue signal */ - sig_proc(child, (int) m_in.data, TRUE /*trace*/); + sig_proc(child, (int) m_in.data, TRUE /*trace*/, + FALSE /* ksig */); } /* Resume the child as if nothing ever happened. */ @@ -214,7 +215,8 @@ PUBLIC int do_trace() if (m_in.data < 0 || m_in.data >= _NSIG) return(EINVAL); if (m_in.data > 0) { /* issue signal */ - sig_proc(child, (int) m_in.data, FALSE /*trace*/); + sig_proc(child, (int) m_in.data, FALSE /*trace*/, + FALSE /* ksig */); } /* If there are any other signals waiting to be delivered, diff --git a/test/test5.c b/test/test5.c index 9593584f6..284820813 100644 --- a/test/test5.c +++ b/test/test5.c @@ -279,11 +279,11 @@ void test5g() int n; subtest = 7; - Signal(SIGUSR1, func11); - Signal(SIGUSR1, SIG_IGN); + Signal(11, func11); + Signal(11, SIG_IGN); n = getpid(); - if (kill(n, SIGUSR1) != 0) e(1); - Signal(SIGUSR1, SIG_DFL); + if (kill(n, 11) != 0) e(1); + Signal(11, SIG_DFL); } void funcalrm(s) -- 2.44.0