Drop hurd specific dependency on libc0.3 (>= 2.3.2.ds1-12). It is

no longer needed according to Michael Bunk.  Patch from Michael
Biebl.
This commit is contained in:
Petter Reinholdtsen 2009-09-10 08:28:49 +00:00
commit 2fe47a3c9f
63 changed files with 13017 additions and 0 deletions

339
COPYING Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

26
COPYRIGHT Normal file
View File

@ -0,0 +1,26 @@
Sysvinit is Copyright (C) 1991-2004 Miquel van Smoorenburg
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Send patches to sysvinit@savannah.nognu.org
The of the start-stop-daemon
* A rewrite of the original Debian's start-stop-daemon Perl script
* in C (faster - it is executed many times during system startup).
*
* Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>,
* public domain.

7
README Normal file
View File

@ -0,0 +1,7 @@
contrib Unofficial stuff
doc Documentation, mostly obsolete
man Manual pages, not obsolete
obsolete Really obsolete stuff ;)
src Source code

16
contrib/TODO Normal file
View File

@ -0,0 +1,16 @@
There are several things on the wishlist. See also the "wishlist" bugs filed
against sysvinit in the debian bugs system (http://www.debian.org/Bugs/).
1. A special target for kbrequest, so that extra CHILDs are
created (each one needs its own utmp/wtmp bookkeeping)
2. Extend the initreq.h interface?
3. Add GNU last long options to last
4. Write all boot messages to a logfile
Problem: TIOCCONS ioctl redirects console output, it doesn't copy it.
I think this is not easily possible without kernel support.
I do not like the idea of booting with a pseudo tty as console and
a redirect process behind it writing to both the real console and a
logfile - too fragile.

29
contrib/alexander.viro Normal file
View File

@ -0,0 +1,29 @@
I proposed moving some stuff to a seperate file, such as the
re-exec routines. Alexander wrote:
According to Alexander Viro <viro@math.psu.edu>:
> As for the code separation - I think it's nice. Actually, read_inittab()
> with get_part() and newFamily are also pretty separatable. Another good
> set is any(), spawn(), startup(), spawn_emerg() and start_if_needed().
> BTW, fail_check();process_signals(); is equivalent to process_signal();
> fail_check();. I think that swapping them (in main loop) would be a good
> idea - then we can move fail_check() into start_if_needed(). And one more
> - I'ld propose to move start_if_needed to the beginning of the main loop,
> as in
> foo();
> while(1) { bar();foo();
> #if 0
> baz();
> #endif
> }
> to
> while(1) { foo();bar();
> #if 0
> baz();
> #endif
> }
>
>
> What do you think about it?

View File

@ -0,0 +1,45 @@
Start-stop-daemon is the program that is used by the DEBIAN style init
scripts to start and stop services. This program is part of the "dpkg"
package by Ian Jackson. However there is also a seperate C version (the
original is in perl) available written by Marek Michalkiewicz. I'm including
it for your convinience.
Note that the latest debian dpkg packages (4.0.18 and later) contain
a much improved update-rc.d. This code is almost a year old.
The original announcement follows:
From: Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>
Message-Id: <199606060324.FAA19493@i17linuxb.ists.pwr.wroc.pl>
Subject: Fast start-stop-daemon in C
To: debian-devel@lists.debian.org
Date: Thu, 6 Jun 1996 05:24:18 +0200 (MET DST)
Some time ago I wrote a faster C replacement for the start-stop-daemon
perl script. I use it for some time now (the most recent changes were
just a nicer help screen; the code is quite stable).
This makes the system boot faster (especially on low end machines),
and important system startup scripts no longer depend on another big
package (perl). Maybe in the future we can get to the point where
a minimal system will work without perl installed at all (packages
which need it in {pre,post}{inst,rm} scripts would depend on perl).
The only problem known so far to me is that I have to reinstall this
program after every dpkg upgrade which overwrites it with that nice
slooow perl script :-).
Just compile this program and drop the binary in /usr/sbin instead
of the original /usr/sbin/start-stop-daemon perl script (make a copy
of it first, just in case). See below for source code. I placed it
in the public domain, but if it has to be GPL-ed to be included in
dpkg, just tell me. Including it in dpkg would close Bug#1670.
I am posting it here so that it can be tested by more people than
just me. Bugs are unlikely though.
Have fun,
Marek

430
contrib/start-stop-daemon.c Normal file
View File

@ -0,0 +1,430 @@
/*
* A rewrite of the original Debian's start-stop-daemon Perl script
* in C (faster - it is executed many times during system startup).
*
* Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>,
* public domain.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <signal.h>
#include <errno.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <getopt.h>
#include <pwd.h>
#define VERSION "version 0.3, 1996-06-05"
static int testmode = 0;
static int quietmode = 0;
static int exitnodo = 1;
static int start = 0;
static int stop = 0;
static int signal_nr = 15;
static int user_id = -1;
static const char *userspec = NULL;
static const char *cmdname = NULL;
static char *execname = NULL;
static char *startas = NULL;
static const char *pidfile = NULL;
static const char *progname = "";
static struct stat exec_stat;
struct pid_list {
struct pid_list *next;
int pid;
};
static struct pid_list *found = NULL;
static struct pid_list *killed = NULL;
static void *xmalloc(int size);
static void push(struct pid_list **list, int pid);
static void do_help(void);
static void parse_options(int argc, char * const *argv);
static int pid_is_exec(int pid, const struct stat *esb);
static int pid_is_user(int pid, int uid);
static int pid_is_cmd(int pid, const char *name);
static void check(int pid);
static void do_pidfile(const char *name);
static void do_procfs(void);
static void do_stop(void);
#ifdef __GNUC__
static void fatal(const char *format, ...)
__attribute__((noreturn, format(printf, 1, 2)));
static void badusage(const char *msg)
__attribute__((noreturn));
#else
static void fatal(const char *format, ...);
static void badusage(const char *msg);
#endif
static void
fatal(const char *format, ...)
{
va_list arglist;
fprintf(stderr, "%s: ", progname);
va_start(arglist, format);
vfprintf(stderr, format, arglist);
va_end(arglist);
putc('\n', stderr);
exit(2);
}
static void *
xmalloc(int size)
{
void *ptr;
ptr = malloc(size);
if (ptr)
return ptr;
fatal("malloc(%d) failed", size);
}
static void
push(struct pid_list **list, int pid)
{
struct pid_list *p;
p = xmalloc(sizeof(*p));
p->next = *list;
p->pid = pid;
*list = p;
}
static void
do_help(void)
{
printf("\
start-stop-daemon for Debian Linux - small and fast C version written by\n\
Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>, public domain.\n"
VERSION "\n\
\n\
Usage:
start-stop-daemon -S|--start options ... -- arguments ...\n\
start-stop-daemon -K|--stop options ...\n\
start-stop-daemon -H|--help\n\
start-stop-daemon -V|--version\n\
\n\
Options (at least one of --exec|--pidfile|--user is required):
-x|--exec <executable> program to start/check if it is running\n\
-p|--pidfile <pid-file> pid file to check\n\
-u|--user <username>|<uid> stop this user's processes\n\
-n|--name <process-name> stop processes with this name\n\
-s|--signal <signal> signal to send (default 15)\n\
-a|--startas <pathname> program to start (default <executable>)\n\
-t|--test test mode, don't do anything\n\
-o|--oknodo exit status 0 (not 1) if nothing done\n\
-q|--quiet | -v, --verbose\n\
\n\
Exit status: 0 = done 1 = nothing done (=> 0 if --oknodo) 2 = trouble\n");
}
static void
badusage(const char *msg)
{
if (msg && *msg)
fprintf(stderr, "%s: %s\n", progname, msg);
fprintf(stderr, "Try `%s --help' for more information.\n", progname);
exit(2);
}
static void
parse_options(int argc, char * const *argv)
{
static struct option longopts[] = {
{ "help", 0, NULL, 'H'},
{ "stop", 0, NULL, 'K'},
{ "start", 0, NULL, 'S'},
{ "version", 0, NULL, 'V'},
{ "startas", 1, NULL, 'a'},
{ "name", 1, NULL, 'n'},
{ "oknodo", 0, NULL, 'o'},
{ "pidfile", 1, NULL, 'p'},
{ "quiet", 0, NULL, 'q'},
{ "signal", 1, NULL, 's'},
{ "test", 0, NULL, 't'},
{ "user", 1, NULL, 'u'},
{ "verbose", 0, NULL, 'v'},
{ "exec", 1, NULL, 'x'},
{ NULL, 0, NULL, 0}
};
int c;
for (;;) {
c = getopt_long(argc, argv, "HKSVa:n:op:qs:tu:vx:",
longopts, (int *) 0);
if (c == -1)
break;
switch (c) {
case 'H': /* --help */
do_help();
exit(0);
case 'K': /* --stop */
stop = 1;
break;
case 'S': /* --start */
start = 1;
break;
case 'V': /* --version */
printf("start-stop-daemon " VERSION "\n");
exit(0);
case 'a': /* --startas <pathname> */
startas = optarg;
break;
case 'n': /* --name <process-name> */
cmdname = optarg;
break;
case 'o': /* --oknodo */
exitnodo = 0;
break;
case 'p': /* --pidfile <pid-file> */
pidfile = optarg;
break;
case 'q': /* --quiet */
quietmode = 1;
break;
case 's': /* --signal <signal> */
if (sscanf(optarg, "%d", &signal_nr) != 1)
badusage("--signal takes a numeric argument");
break;
case 't': /* --test */
testmode = 1;
break;
case 'u': /* --user <username>|<uid> */
userspec = optarg;
break;
case 'v': /* --verbose */
quietmode = -1;
break;
case 'x': /* --exec <executable> */
execname = optarg;
break;
default:
badusage(""); /* message printed by getopt */
}
}
if (start == stop)
badusage("need one of --start or --stop");
if (!execname && !pidfile && !userspec)
badusage("need at least one of --exec, --pidfile or --user");
if (!startas)
startas = execname;
if (start && !startas)
badusage("--start needs --exec or --startas");
}
static int
pid_is_exec(int pid, const struct stat *esb)
{
struct stat sb;
char buf[32];
sprintf(buf, "/proc/%d/exe", pid);
if (stat(buf, &sb) != 0)
return 0;
return (sb.st_dev == esb->st_dev && sb.st_ino == esb->st_ino);
}
static int
pid_is_user(int pid, int uid)
{
struct stat sb;
char buf[32];
sprintf(buf, "/proc/%d", pid);
if (stat(buf, &sb) != 0)
return 0;
return (sb.st_uid == uid);
}
static int
pid_is_cmd(int pid, const char *name)
{
char buf[32];
FILE *f;
int c;
sprintf(buf, "/proc/%d/stat", pid);
f = fopen(buf, "r");
if (!f)
return 0;
while ((c = getc(f)) != EOF && c != '(')
;
if (c != '(') {
fclose(f);
return 0;
}
/* this hopefully handles command names containing ')' */
while ((c = getc(f)) != EOF && c == *name)
name++;
fclose(f);
return (c == ')' && *name == '\0');
}
static void
check(int pid)
{
if (execname && !pid_is_exec(pid, &exec_stat))
return;
if (userspec && !pid_is_user(pid, user_id))
return;
if (cmdname && !pid_is_cmd(pid, cmdname))
return;
push(&found, pid);
}
static void
do_pidfile(const char *name)
{
FILE *f;
int pid;
f = fopen(name, "r");
if (f) {
if (fscanf(f, "%d", &pid) == 1)
check(pid);
fclose(f);
}
}
static void
do_procfs(void)
{
DIR *procdir;
struct dirent *entry;
int foundany, pid;
procdir = opendir("/proc");
if (!procdir)
fatal("opendir /proc: %s", strerror(errno));
foundany = 0;
while ((entry = readdir(procdir)) != NULL) {
if (sscanf(entry->d_name, "%d", &pid) != 1)
continue;
foundany++;
check(pid);
}
closedir(procdir);
if (!foundany)
fatal("nothing in /proc - not mounted?");
}
static void
do_stop(void)
{
char what[1024];
struct pid_list *p;
if (cmdname)
strcpy(what, cmdname);
else if (execname)
strcpy(what, execname);
else if (pidfile)
sprintf(what, "process in pidfile `%s'", pidfile);
else if (userspec)
sprintf(what, "process(es) owned by `%s'", userspec);
else
fatal("internal error, please report");
if (!found) {
if (quietmode <= 0)
printf("no %s found; none killed.\n", what);
exit(exitnodo);
}
for (p = found; p; p = p->next) {
if (testmode)
printf("would send signal %d to %d.\n",
signal_nr, p->pid);
else if (kill(p->pid, signal_nr) == 0)
push(&killed, p->pid);
else
printf("%s: warning: failed to kill %d: %s\n",
progname, p->pid, strerror(errno));
}
if (quietmode < 0 && killed) {
printf("stopped %s (pid", what);
for (p = killed; p; p = p->next)
printf(" %d", p->pid);
printf(").\n");
}
}
int
main(int argc, char **argv)
{
progname = argv[0];
parse_options(argc, argv);
argc -= optind;
argv += optind;
if (execname && stat(execname, &exec_stat))
fatal("stat %s: %s", execname, strerror(errno));
if (userspec && sscanf(userspec, "%d", &user_id) != 1) {
struct passwd *pw;
pw = getpwnam(userspec);
if (!pw)
fatal("user `%s' not found\n", userspec);
user_id = pw->pw_uid;
}
if (pidfile)
do_pidfile(pidfile);
else
do_procfs();
if (stop) {
do_stop();
exit(0);
}
if (found) {
if (quietmode <= 0)
printf("%s already running.\n", execname);
exit(exitnodo);
}
if (testmode) {
printf("would start %s ", startas);
while (argc-- > 0)
printf("%s ", *argv++);
printf(".\n");
exit(0);
}
if (quietmode < 0)
printf("starting %s ...\n", startas);
*--argv = startas;
execv(startas, argv);
fatal("unable to start %s: %s", startas, strerror(errno));
}

120
contrib/zefram-patches Normal file
View File

@ -0,0 +1,120 @@
Date: Mon, 14 Apr 1997 15:39:08 +0100 (BST)
From: Zefram <zefram@dcs.warwick.ac.uk>
Message-Id: <25042.199704141439@stone.dcs.warwick.ac.uk>
Subject: SysVinit patch
To: miquels@drinkel.cistron.nl
Hi. Enclosed is a patch for SysVinit that I am finding tiresome to
keep updating; you might like to fold it into your official releases.
It does the following:
* shutdown: use /etc/shutdown.allow if an option -s is given instead
of testing for a controlling tty. The tty check was inflexible and
unreliable.
* sulogin(8): refer to inittab(5) instead of inittab(4).
* sulogin: use libc passwd/shadow functions instead of home-grown ones
(there's just no point in using the special version).
* shutdown/sulogin: don't rely on the username "root" -- it's the UID
that counts.
-zefram
begin 644 initdiffs.gz
M'XL(``IG43,"`^T[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ME5$5XW*FDE*)!`]GVSRU%D)8'E'J+]=DO;\BZ97W5G</S47"D[E$980&D9-*
MQE$0[GK17A0=]4=9"H`E1+R?\"4?8[(X*QE$1C?X%Q/<NBU4`JL,RFP^?CN5
M\4H2H"YW<>/#0@#^6\9?]<Y\_961^$?YK3AL@1;T=XW&:_L;!WM6IYEW^PP5
M<`V4CX/"&6/$LV!W6Z'$>D8$TVKE[?F[,R113;:4.61S_?,WU):N9!?&*P!T
M`;`T6T`]>'O6[^.P3'51K^:U"ZL.S+;5WLG_Y\%W)+AHX_>1O0KS:.+7-F3V
M]ZW.P4XN_3Q,K76*0MA1]6RK6*UR<5NH*PJA.[^_5)!K8A8&+?CM-X;(OL[!
MPI=C<35:L*TC[,J`^BI`W;1J[FF7FN[3=':LSO9"94_D<HFQ<@C5+?B_G*__
)!9>7)7O2-```
`
end

635
doc/Changelog Normal file
View File

@ -0,0 +1,635 @@
sysvinit (2.87dsf) world; urgency=low
* Fix typos and do minor updates in the manual pages.
* Correct section of mountpoint(1).
* Document -e and -t options for telinit in init(8).
* Update address of FSF in the COPYRIGHT file.
* Document in halt(8) that -n might not disable all syncing.
Patch by Bill Nottingham and Fedora
* Adjust output from "last -x". In reboot lines, print endpoint
of uptime too. In shutdown lines print downtimes rather than
the time between downs. Fix typo in string compare in last.c.
Patch by Thomas Hood.
* Improve handling of IPv6 addresses in last. Patch from Fedora.
* Document last options in usage information, previously only
mentioned in the manual page.
* Add new option -F to last, to output full date string instead
of the short form provided by default. Patch from Olaf Dabrunz
and SuSe.
* Adjust build rules to make sure the installed binaries
are stripped.
* Increase the compiler warning level when building.
* Fix utmp/wtmp updating on 64-bit platforms. Patch by Bill
Nottingham and Fedora.
* Avoid unchecked return value from malloc() in utmpdump.
Patch from Christian 'Dr. Disk' Hechelmann and Fedora.
* Make sure to use execle and no execl when passing environment to
the new process. Patch from RedHat.
* Correct init to make sure the waiting status is preserved across
re-exec. Patch from RedHat.
* Correct init to avoid race condition when starting programs during
boot. Patch from SuSe.
* Allow 'telinit u' in runlevels 0 and 6. Patch from Thomas Hood.
* Change install rules to make pidof an absolute symlink. Patch from
Thomas Hood.
* Improve error message from init if fork() fail. Patch found in Suse.
* Add support for SE Linux capability handling. Patch from Manoj
Srivastava, adjusted to avoid aborting if SE policy was loaded in
the initrd with patch from Bill Nottingham and Fedora.
* Add -c option to pidof for only matching processes with the same
process root. Ignore -c when not running as root. Patch from
Thomas Woerner and Fedora.
* Adjust init to terminate argv0 with one 0 rather than two so that
process name can be one character longer. Patch by Kir Kolyshkin.
* Make sure bootlogd exit with non-error exit code when forking of
the child successfully.
* Add bootlogd option -s to make it possible to control the use of
fdatasync(). Patch from Thomas Hood.
* Add bootlogd option -c to tell it to create the log file if it does
not exist. Patch from Thomas Hood.
* Let bootlogd also look at ttyB* devices to work on HPPA. Patch
from Thomas Hood.
* Change init to use setenv() instead of putenv, make sure the PATH
value is usable on re-exec. Patch from Thomas Hood.
* Add usleep in killall5 after killing processes, to force the kernel
to reschedule. Patch from SuSe.
* Modify pidof to not print empty line if no pid was found.
* Modify init and sulogin to fix emergency mode's tty, making sure ^C
and ^Z work when booting with 'emergency' kernel option. Patch from
Samuel Thibault.
* Modify init to allow some time for failed opens to resolve themselves.
Patch from Bill Nottingham and Fedora.
* Modify init to shut down IDE, SCSI and SATA disks properly. Patches
from Sebastian Reichelt, Werner Fink and SuSe.
* Modify wall to use UT_LINESIZE from <utmp.h> instead of hardcoded
string lengths. Patch from SuSe.
* Change wall to make halt include hostname in output.
* Change killall to avoid killing init by mistake. Patch from SuSe.
* Change killall5 to use the exit value to report if it found any
processes to kill. Patch from Debian.
* Add option -o opmitpid to killall5, to make it possible to skip
some pids during shutdown. Based on patch from Colin Watson and
Ubuntu.
* Add references between killall5 and pidof manual pages. Patch from Debian.
* Modify killall to work better with user space file system, by
changing cwd to /proc when stopping and killing processes, and
avoiding stat() when the value isn't used. Also, lock process
pages in memory to avoid paging when user processes are stopped.
Patch from Debian and Goswin von Brederlow with changes by Kel
Modderman.
* Change shutdown to only accept flags -H and -P with the -h flag,
and document this requirement in the manual page.
* Change reboot/halt to work properly when used as a login shell.
Patch by Dale R. Worley and Fedora.
* Let sulogin fall back to the staticly linked /bin/sash if both roots
shell and /bin/sh fail to execute.
-- Petter Reinholdtsen <pere@hungry.com> Sun, 12 Jul 2009 19:58:10 +0200
sysvinit (2.86) cistron; urgency=low
* Fixed up bootlogd to read /proc/cmdline. Also keep an internal
linebuffer to process \r, \t and ^H. It is becoming useable.
* Applied trivial OWL patches
* Block signals in syslog(), since syslog() is not re-entrant
(James Olin Oden <joden@malachi.lee.k12.nc.us>, redhat bug #97534)
* Minor adjustements so that sysvinit compiles on the Hurd
* killall5 now skips kernel threads
* Inittab entries with both 'S' and other runlevels were broken.
Fix by Bryan Kadzban <bryan@kadzban.is-a-geek.net>
* Changed initreq.h to be more flexible and forwards-compatible.
* You can now through /dev/initctl set environment variables in
init that will be inherited by its children. For now, only
variables prefixed with INIT_ can be set and the maximum is
16 variables. There's also a length limit due to the size
of struct init_request, so it should be safe from abuse.
* Option -P and -H to shutdown set INIT_HALT=POWERDOWN and
INIT_HALT=HALT as environment variables as described above
* Add "mountpoint" utility.
* Slightly better algorithm in killall5.c:pidof()
* Added some patches from fedora-core (halt-usage, last -t,
sulogin-message, user-console)
-- Miquel van Smoorenburg <miquels@cistron.nl> Fri, 30 Jul 2004 14:14:58 +0200
sysvinit (2.85) cistron; urgency=low
* Add IPv6 support in last(1)
* Sulogin: even if the root password is empty, ask for a password-
otherwise there is no way to set a timeout.
* Removed support for ioctl.save.
* Turned of support for /etc/initrunlvl and /var/run/initrunlvl
* Fixed warts in dowall.c ("Dmitry V. Levin" <ldv@altlinux.org>)
* Fix init.c::spawn(). The "f" variable was used both as file descriptor
and waitpid(2) return code. In certain circumstances, this leads to
TIOCSCTTY with wrong file descriptor (Vladimir N. Oleynik).
* Fix fd leak in sulogin (Dmitry V. Levin).
* More error checking in all wait() calling code (Dmitry V. Levin).
* Fix argv[] initialization in spawn() (Dmitry V. Levin).
* Change strncpy to strncat in most places (Dmitry V. Levin).
-- Miquel van Smoorenburg <miquels@cistron.nl> Tue, 15 Apr 2003 16:37:57 +0200
sysvinit (2.84) cistron; urgency=low
* Don't use /etc/initlvl interface for telinit; only use /dev/initctl,
and give a clear error when that fails.
* Add -i/--init command line flag to init - this tells init
'behave as system init even if you're not PID#1'. Useful for
testing in chroot/jail type environments.
-- Miquel van Smoorenburg <miquels@cistron.nl> Tue, 27 Nov 2001 13:10:08 +0100
sysvinit (2.83) cistron; urgency=low
* Fix bug in shutdown where it didn't check correctly for a
virtual console when checking /etc/shutdown.allow
* Fix race condition in waitpid() [Andrea Arcangeli]
* Call closelog() after openlog()/syslog() since recent libc's
keep the logging fd open and that is fd#0 aka stdin.
-- Miquel van Smoorenburg <miquels@cistron.nl> Tue, 2 Oct 2001 23:27:06 +0200
sysvinit (2.82) cistron; urgency=low
* Print out correct version number at startup.
* Fix spelling of initttab in init(8)
-- Miquel van Smoorenburg <miquels@cistron.nl> Thu, 23 Aug 2001 17:50:44 +0200
sysvinit (2.81) cistron; urgency=low
* Fix typo/bug in killall5/pidof, -o option failed to work since 2.79.
Reformatted source code to prevent this from happening again.
* shutdown.8: applied redhat manpage update
* sulogin: applied redhat sysvinit-2.78-sulogin-nologin.patch
* sulogin: applied redhat sysvinit-2.78-notty.patch
* sulogin: applied redhat sysvinit-2.78-sigint.patch
sysvinit (2.80) cistron; urgency=low
* Grammar/spelling fixes in shutdown.c (Christian Steinrueck)
* Don't set controlling tty for non-(sysinit,boot,single) runlevels
-- Miquel van Smoorenburg <miquels@cistron.nl> Thu, 26 Jul 2001 13:26:56 +0200
sysvinit (2.79) cistron; urgency=low
* New upstream version
* several fixes to wall by Tim Robbins <fyre@box3n.gumbynet.org>
* Several extra boundary checks by Solar Designer
* Make /dev/console controlling tty
* Stricter checks on ownership of tty by mesg(1)
* Documented and restricted -n option to wall(1)
* Make it compile with glibc 2.2.2
* Document IO redirection in wall manpage (closes: #79491)
* Update README (closes: #85650)
* Fix init.8 manpage (closes: #75268)
* Fix typo in halt(8) manpage (closes: #67875)
* Check time argument of shutdown(8) for correctness (closes: #67825)
* Check for stale sessions in last(1) (Chris Wolf <cwolf@starclass.com>)
-- Miquel van Smoorenburg <miquels@cistron.nl> Wed, 4 Jul 2001 15:04:36 +0200
sysvinit (2.78-2) frozen unstable; urgency=high
* Change "booting" to "reloading" message at reload
* Add "-z xxx" dummy command line argument (closes: #54717)
-- Miquel van Smoorenburg <miquels@cistron.nl> Fri, 11 Feb 2000 12:17:54 +0100
sysvinit (2.78-1) unstable; urgency=low
* 2.78 will be the new upstream version, I'm skipping 2.77
* Shutdown now calls sync before switching the runlevel to 0 or 6,
or before unmounting filesystems if -n was used (closes: #46461)
* Some cosmetic changes to init.c (closes: #32079)
-- Miquel van Smoorenburg <miquels@cistron.nl> Thu, 30 Dec 1999 20:40:23 +0100
sysvinit (2.77-2) unstable; urgency=low
* Fix last -i option
-- Miquel van Smoorenburg <miquels@cistron.nl> Tue, 5 Oct 1999 21:51:50 +0200
sysvinit (2.77-1) unstable; urgency=low
* Write reboot record into utmp file as well to make rms happy
* Fork and dump core in / if SIGSEGV is received for debugging purposes
* Patch by Craig Sanders <cas@vicnet.net.au> for "last" -i option
-- Miquel van Smoorenburg <miquels@cistron.nl> Wed, 4 Aug 1999 11:16:23 +0200
sysvinit (2.76-4) unstable; urgency=low
* Change dowall.c to handle Unix98 ptys correctly
* Add comment in rcS about usage of setup.sh and unconfigured.sh
* Shutdown now removes nologin file just before calling telinit
* SEGV handler now tries to continue after sleep of 30 seconds.
On a 386-class processor it also prints out the value of EIP.
* Fix for racecondition in check_init_fifo() by Richard Gooch
-- Miquel van Smoorenburg <miquels@cistron.nl> Sat, 8 May 1999 17:22:57 +0200
sysvinit (2.76-3) frozen unstable; urgency=high
* Small bugfix to last.c courtesy of Danek Duvall <duvall@emufarm.ml.org>
-- Miquel van Smoorenburg <miquels@cistron.nl> Tue, 12 Jan 1999 12:12:44 +0100
sysvinit (2.76-1) frozen unstable; urgency=high
* Fix bug in check_pipe() which crashes init on the Alpha.
-- Miquel van Smoorenburg <miquels@cistron.nl> Tue, 3 Nov 1998 11:09:13 +0100
sysvinit (2.75-4) unstable; urgency=low
* Change sulogin password buffer to 128 characters.
* Don't print control characters in dowall.c
* Try to open getenv ("CONSOLE"), /dev/console and /dev/tty0 in order.
For backwards compatibility when you try to boot a 2.0.x kernel
with a linux > 2.1.70 /dev/console device.
* Change src/Makefile for non-debian systems (mainly, RedHat)
* Try to create /dev/initctl if not present; check every time to see
if the dev/ino of /dev/initctl has changed and re-open it. This should
help devfs a bit.
* Send SIGUSR1 to init at bootup to let it re-open /dev/initctl;
again in support of devfs.
* Moved pidof to /bin (it's only a link to killall5 anyway)
-- Miquel van Smoorenburg <miquels@cistron.nl> Mon, 5 Oct 1998 14:03:14 +0200
sysvinit (2.75-2) frozen unstable; urgency=medium
* Fix last.c again.
* Add check to see if /dev/initctl is really a FIFO
* In ifdown.c first down all shaper devices then the real devices
-- Miquel van Smoorenburg <miquels@cistron.nl> Tue, 2 Jun 1998 22:43:01 +0200
sysvinit (2.75-1) frozen unstable; urgency=low
* Rewrote last.c to be much more memory friendly and correct,
thanks to Nick Andrew <nick@zeta.org.au> and
David Parrish <dparrish@zeta.org.au>
* Fixes bugs:
#21616: sysvinit: sulogin thinks md5 root password is bad
#21765: sysvinit: Typo in `killall5.c'
#21775: sysvinit: sysvinit does not support MD5 hashed passwords
#21990: /usr/bin/last: unnecessary memset and off-by-one bug
#22084: sysvinit 2.74-4: SIGPWR missing on sparc
#21900: init, powerfail events, and shutdown.allow
#21702: init 0 does not work as expected...
#21728: sysvinit: Typo in `init.c'
#22363: sysvinit: discrepance btw. manpage and /sbin/init
-- Miquel van Smoorenburg <miquels@cistron.nl> Tue, 19 May 1998 11:02:29 +0200
sysvinit (2.74-4) frozen unstable; urgency=medium
* Add -o option to last to process libc5 utmp files.
* Buffer overflow fixed in init.c (not very serious; only exploitable
by root). Thanks to Chris Evans <chris@ferret.lmh.ox.ac.uk>
-- Miquel van Smoorenburg <miquels@cistron.nl> Wed, 15 Apr 1998 17:04:33 +0200
sysvinit (2.74-1) unstable; urgency=low
* Should compile with glibc 1.99 :)
* Change behaviour of reboot(1) and halt(1) so that the default when
the runlevel can't be determined is to call shutdown.
* Added re-exec patch from Al Viro (21 Feb 1998):
'U' flag added to telinit. It forces init to re-exec itself
(passing its state through exec, certainly).
May be useful for smoother (heh) upgrades.
24 Feb 1998, AV:
did_boot made global and added to state - thanks, Miquel.
Yet another file descriptors leak - close state pipe if
re_exec fails.
-- Miquel van Smoorenburg <miquels@cistron.nl> Thu, 12 Mar 1998 17:42:46 +0100
sysvinit (2.73-2) unstable; urgency=low
* Change _NSIG to NSIG for 2.1.x kernel includes.
-- Miquel van Smoorenburg <miquels@cistron.nl> Thu, 8 Jan 1998 16:01:02 +0100
sysvinit (2.73-1) unstable; urgency=low
* Use siginterrupt, now that system calls are restarted by default.
Main symptom was that the sulogin timeout didn't work but there
might have been more hidden problems.
* Kill process immidiately if turned off in inittab
* Fixed sulogin check on tty arg.
* Use strerror() instead of sys_errlist
* wall now supports a '-n' option to suppress [most of] the banner.
Debian doesn't use sysvinit's wall, but apparently Redhat does.
* Add '-F' (forcefsck) option to shutdown
* Close and reopen /dev/initctl on SIGUSR1 (mainly for a /dev in ram)
-- Miquel van Smoorenburg <miquels@cistron.nl> Sat, 3 Jan 1998 16:32:39 +0100
sysvinit (2.72-3) unstable; urgency=low
* Add extra fork() in dowall.c to avoid hanging in rare cases
-- Miquel van Smoorenburg <miquels@cistron.nl> Wed, 22 Oct 1997 14:44:00 +0200
sysvinit (2.72) unstable; urgency=low
* Applied manual page patches by Bill Hawes <whawes@star.net>. Thanks Bill!
* Applied patches to the sample Slackware scripts by
"Jonathan I. Kamens" <jik@kamens.brookline.ma.us>
* Fix halt and reboot runlevels 0 & 6 check.
* Only say "no more processes left in runlevel x" once
* Fix race condition with SIGCHLD in spawn()
(thanks to Alon Ziv <alonz@CS.Technion.AC.IL>)
* Compress all manpages (missed 2)
* Compiled for libc6
* Added poweroff patch by Roderich Schupp <rsch@ExperTeam.de>
-- Miquel van Smoorenburg <miquels@cistron.nl> Sun, 12 Oct 1997 17:20:17 +0200
sysvinit (2.71-2) frozen unstable; urgency=low
* Print 2.71 instead of 2.70 on startup :)
-- Miquel van Smoorenburg <miquels@cistron.nl> Mon, 5 May 1997 12:45:25 +0200
sysvinit (2.71-1) frozen unstable; urgency=high
* Added code for updwtmp() in utmp.c for glibc (2.0.3)
* Fixed all programs to use functions from utmp.c and getutent()
* Do not try to clean up utmp in init itself (Bug#9022)
* Removed sync() from main loop.
* Hopefully fixes bug #8657 (shutdown signal handling)
-- Miquel van Smoorenburg <miquels@cistron.nl> Sat, 26 Apr 1997 19:57:27 +0200
sysvinit (2.70-1) unstable; urgency=low
* Respawn fix
* Removed StUdLy CaPs from source code
* Moved files in source archive around
* Fixes for glibc (utmp handling, signal handling).
* Fixed '-d' option to last (now also works without '-a').
* Added extra checking in last.c to prevent showing dead entries
-- Miquel van Smoorenburg <miquels@cistron.nl> Fri, 7 Feb 1997 15:31:30 +0100
sysvinit (2.69-1) frozen unstable; urgency=medium
* Fixed bug that can throw X in a loop (or any other app that reads from
/dev/tty0)
-- Miquel van Smoorenburg <miquels@cistron.nl> Sun, 1 Dec 1996 15:32:24 +0100
sysvinit (2.67-1) frozen unstable; urgency=high
* Fixes problem with /dev/console being controlling terminal of some
daemons
* Puts copyright file in the right place
-- Miquel van Smoorenburg <miquels@cistron.nl> Fri, 15 Nov 1996 12:23:33 +0100
sysvinit (2.66-1) unstable; urgency=medium
* Skipped 2.65. A development 2.65 got out by accident and is apparently
being used..
* Also compiles and runs with GNU libc (and on the Alpha)
* Fixed dowall.c not to exit when getpwuid() fails and uid == 0.
* Fixed init panic'ing on empty lines in /etc/inittab
* Changed default PATH to include /usr/local/sbin
* Set /dev/console as controlling terminal for sysinit,bootwait,wait,powerwait
This allows using ^C to interrupt some parts of eg the boot process.
* Remove old symlink in /var/log/initlvl; let init check both
/var/log and /etc itself.
-- Miquel van Smoorenburg <miquels@cistron.nl> Tue, 29 Oct 1996 13:46:54 +0100
2.66 29-Oct-1996
- Skipped 2.65. A development 2.65 got out by accident and is apparently
being used..
- Fixed dowall.c not to exit when getpwuid() fails and uid == 0.
- Fixed init panic'ing on empty lines in /etc/inittab
- Changed default PATH to include /usr/local/sbin
- Ported to Linux/Alpha and GNU libc.
- Set /dev/console as controlling terminal for sysinit,bootwait,wait,powerwait.
This allows using ^C to interrupt some parts of eg the boot process.
- Remove old symlink in /var/log/initlvl; let init check both
/var/log and /etc itself.
2.64 28-Jun-1996
- Init checks CONSOLE environment variable on startup (overrides /dev/console)
- Init sets CONSOLE variable for all its children.
- Wtmp(): when zeroing out old utmp entries, keep ut_id field
- Wtmp(): try to re-use ut_id field if possible.
- SetTerm(): only read from /etc/ioctl.save if written once.
- Included start-stop-daemon, C version (source only).
- Fixed wait() for the emergency shell.
- killall5: ignore signal before doing kill(-1, pid).
2.63 14-Jun-1996
- Fixed preinst script for Debian
- Fixed init.c to become init daemon if name is init.new
- Fixed pidof to not return PIDs of shell scripts
2.62-2 09-Jun-1996
- Changed debian /etc/init.d/boot script to create a nologin file
at boot and to remove it just before going multiuser.
2.62 31-May-1996
- Decided to release a 2.62 version with a BIG WARNING about upgrading
init in it. Will send a patch to Linus for the linux/Documentation/Changes
file so that 2.62 or later is mentioned as the version to upgrade to.
- Added docs for Slackware
2.61-3 29-May-1996
- Fixed debian/etc/init.d/network for the lo device.
- Added "-xdev" to the cd /tmp && find in debian/etc/init.d/boot
- Made remove time for files in /tmp configurable.
2.61 29-Apr-1996
- Changed /etc/init.d/boot script again
- Fixed problem in init.c with trailing whitespace after entries in inittab
- Fixed killall5 problems
- Added manpage for lastb
- Added SHELL= environment variable to sulogin
- Fixed sulogin & shadow problems
- Added timeout option to sulogin
2.60-2 16-Apr-1996
- Fixed sulogin (didn't work if root wasn't first entry in shadow file)
- Fixed mesg for systems with "tty" group (such as Debian)
- Fixed nsyslog() in killall5.c
2.60 01-Apr-1996
- Fixed race condition in init.c, resulting in hanging shutdowns.
Courtesy of Max Neunhoeffer <Max.Neunhoeffer@urz.uni-heidelberg.de>.
- Fixed debian/etc/init.d/boot for swapon and mdadd
- Added architecture to debian.control
- Added manpages for rc.boot and rc.local
- Updated inittab manpage for 4-character runlevel field
- Added debian replaces for bsdutils < version_without_mesg
- Fixed init.c so that it also works with kernels 1.3.81 and up
2.59 10-Mar-1996
- Init logs less to syslog (suspected to hang in syslog() or openlog() )
- removed closelog() from init.c
- removed time check of runlevel record in halt.
- Added options to last to get hostname from ut_addr field
- Added last and mesg to installation targets
- rewrote /etc/init.d/boot a bit.
2.58-2 04-Jan-1996
- Changed etc/init.d/rc to do a stty onlcr
- Added /var/log/initrunlvl symlink
2.58-1 31-Dec-1995
- Added the latest debian files.
- Added support for 4-character id fields (if you have libc5).
- Fixed pidof (in killall5) parsing of /proc/.../stat
- Save restore GMT setting in /etc/init.d/boot
2.57d 03-Dec-1995
- Added sulogin
- Added "-b" flag to init, gives a shell before
anything else (in case the startup scripts are screwed)
- Moved fastboot to /fastboot
- Folded in Debian patches.
- Removed old scripts
- Added debian /etc/directory.
2.57c 08-Oct-1995
- Changed over to init_request (with initreq.h)
- Processes no longer killed when "process" field
changes, change takes effect after next respawn.
2.57b xx-Aug-1995
- Bugfix release for Debian and Slackware 3.0
2.57a 10-Jul-1995
- Fixed race condition init init.c wrt got_chld
- Fixed one-off for malloc in killall5.c
- Changed dowall.c
- Console code: no relink to /dev/systty on CTRL-ALT-DEL)
2.57 22-May-1995
- Changed a few things here and there, didn't
really document it :)
2.55 17-Jan-1995
- Added option to shutdown to run standalone.
2.54 12-Jan-1995
- Added GNU copyrigh to all *.[ch] files.
- added /etc/initscript
- reboot and halt now call shutdown in runlevels 1-5
- Can run from read-only root (CDROM)
2.53 10-Oct-1994
- Renamed pidof to killall5, updated all scripts to
use killall5 instead of kill -1 ....
- Rewrote scripts to use this, and some general changes.
- Added SysV command line compatibility to shutdown.
2.52 30-Aug-1994
- Added `powerfailnow' keyword, for when UPS battery is low.
- Updated `last'.
- Fixed utmp handling (wrt. CLEAN_UTMP)
TODO:
* Make last compatible with GNU/BSD (long options?)
* update powerd
* remote SIGPWR broadcast? in powerd? (with priv. port)
* remote shutdown
2.50 14-Feb-1994
- Ignores unknown command line arguments.
- Modelled more after the "real" sysVinit
- Lots of changes all over the place.
(like showing runlevel in "ps" listing, logging
runlevel into utmp file etc)
- now using "reliable" signals instead of V7 style.
- Updated all scripts. Examples are in two directories:
etc (normal) and etc-sysv (sysv style scripts).
- runlevel 0 = halt, 1 = single user, 6 = reboot.
- added support for serial console.
- updated Propaganda, manpages.
- added shutdown access control.
2.4 24-May-93
- Send out the official version into the world as
SysVinit-2.4.tar.z.
2.4g 15-May-93
- Changed init to really catch SIGPWR 'cause we
hooked up an UPS to the Linux machine. The
keyword for catching the TreeFingerSalute is
now "ctrlaltdel" instead of "power{wait,fail}".
2.4a 22-Apr-93
- Fixed last to reckognize BSD style wtmp logging.
- Changed init to write wtmp records that are
SysV compliant but are also reckognized by the
BSD last. Added a '+' option to the 'process'
field of inittab, for getties that want to do
their own utmp/wtmp housekeeping (kludge!).
- Now accepts a runlevel on the command line,
and reckognizes the 'auto' argument. (Sets the
environment variable AUTOBOOT to YES)
2.2.3 24-Mar-93
- Ripped out the 'leave' action. To difficult, and
unneeded.
- Going single user now kills _all_ processes.
- Added '-t secs' option to all commands.
- This version is stable enough to post.
2.2 02-Mar-93
- Made wait()'s asynchronous
- Changed whole thing to one big state machine
- Now using 'pseudo levels' # & * for SYSINIT & BOOT
- Added a new type of 'action', called leave. This
process will be executed when the system goes from a
runlevel specified in it's runlevel field to a
level that's not. Nice to bring down NFS and the like.
2.1 28-Jan-93
- Fixed a bug with 'boot' and 'once'.
- Check 'initdefault' for validity.
- Reckognizes "single" as command line argument.
- Retries execvp with 'sh -c exec ..' if command
is a shell script. (shouldn't execvp do this?)
- Added patches to use syslog if defined.
2.0 08-Dec-92
- Rewrote the code totally, so started with a new
version number.
- Dropped Minix support, this code now is Linux - specific.
- With TEST switch on, this init & telinit can
run standalone for test purposes.
1.3, 05-Jul-92
- Got a 386, so installed Linux. Added 'soft' reboot
to be default under linux. Fixed some typos.
1.2, 16-Jun-92
- Bugreport from Michael Haardt ; removed deadlock
and added 'waitpid' instead of 'wait' for SYSV.
1.1, 30-Apr-92
- Read manual wrong: there is no 'action' field called
process, but all entries are of type process. Every
'process' get exec'ed by /bin/sh -c 'exec command'.
- Rapidly respawning processes are caught in the act.
- _SYSV support is really Linux support,
done by poe@daimi.aau.dk on 25-Mar-92.
1.0, 01-Feb-92
- Initial version, very primitive for the Minix
operating system. Required some mods. to the
kernel.

56
doc/Install Normal file
View File

@ -0,0 +1,56 @@
README for the System V style init, version 2.86
init, shutdown, halt, reboot, wall, last, mesg, runlevel,
killall5, pidof, sulogin.
All programs, files and scripts in this package are covered by
the Gnu Public License, and copyrighted by me.
If you are not using Debian and the debianized package,
you will have to install the new init by hand. You should
be able to drop the binaries into a Slackware or Redhat
system, I think.
Here is a list of preferred directories to install the progs & manpages:
wall.1, last.1, mesg.1 /usr/man/man1
inittab.5, initscript.5 /usr/man/man5
init.8, halt.8, reboot.8,
shutdown.8, powerd.8,
killall5.8, pidof.8,
runlevel.8, sulogin.8 /usr/man/man8
init /sbin/init
inittab /etc/inittab
initscript.sample /etc/initscript.sample
telinit a link (with ln(1) ) to init, either
in /bin or in /sbin.
halt /sbin/halt
reboot a link to /sbin/halt in the same directory
killall5 /sbin/killall5
pidof a link to /sbin/killall5 in the same directory.
runlevel /sbin/runlevel
shutdown /sbin/shutdown.
wall /usr/bin/wall
mesg /usr/bin/mesg
last /usr/bin/last
sulogin /sbin/sulogin
<