Commit Graph

61 Commits

Author SHA1 Message Date
Jesse
644ee05aab Update manual pages with markup and spacing fixes.
Added ability to use "@" symbol in command named in the inittab file. This
treats commands as literal and does not launch a shell to interpret them.

Updated inittab manual page to include overview of symbols which trigger
a shell interpretor and how to disable them using the @ symbol.
2022-02-15 17:01:41 -04:00
Jesse
c2b811d105 Updated version information in init 2021-10-26 20:44:29 -03:00
Jesse Smith
ab53132154 Removed old original source file that was left behind by
patch action.

Fixed typos in source code, comments, manual pages, and
changelog. Corrections provided by Jens Schleusener of
FOSSIES (fossies.org).
2020-11-17 20:31:37 -04:00
Jesse Smith
d4cc79bcb9 Added patch from Didier Gaudin which allows init to load configuration
data from files stored in /etc/inittab.d/
2020-01-08 19:42:43 -04:00
Jesse Smith
fa124114ae Reformatted init code to make if/while logic more clear.
Cleaned up some output from readbootlog.

Added -e flg to bootlogd. When -e is used, data saved
to the boot log file does not have escape characters
removed. This means colour and cursor movement codes
stay in the log file. The may then look nicer when
read with "less -R', but may appear cluttered or
out of alignment when viewed with other, plain-text tools.
2019-08-11 22:10:45 -03:00
Jesse Smith
cc464b1189 Use millisecond delays in init so that shutdown
can happen without a near-full-second delay after
all processes have terminated. Replaced do_sleep()
with do_msleep(), provided by Serge Belyshev.

Replaced hardwired sleep constants in init.c with
defined constants for easy updating in the future.
2019-04-20 18:54:46 -03:00
Jesse Smith
9e8553cacb Updated copyright in init and removed unused Version variable from killall5.c 2018-12-27 15:31:14 -04:00
Jesse Smith
be8d584161 Added some defines and compile-time conditionals to make some
components of sysvinit compile on FreeBSD.
2018-12-09 19:32:04 -04:00
Jesse Smith
848ee05104 Updated init manual page to include GRUB in boot loader comment
as LILO is rarely used outside of the Slackware family these days.

Switched stty flags to use ECHOE instead of ECHOPRT. This should
give smoother, more natural backspac-erase behaviour on emergency
consoles. (Created in init -b mode.)
2018-11-05 23:15:11 -04:00
Jesse Smith
1b659c8ebe Applied patch from Daniel Povey which should allow killall5/pidof to
avoid locking up if it encounters stopped or zombie processes
due to broken NFS mount points.
This should allow Debian bug #719273 to be closed.
2018-10-27 20:26:15 -03:00
Jesse Smith
d27e34754a Unified shutdown and init to use 3 second wait between SIGTERM and
SIGKILL. Defined this value in init.h (WAIT_BETWEEN_SIGNALS) for
easy modification.
Updated documentation to address Debian bug #375274.
2018-10-22 21:44:39 -03:00
Jesse Smith
7b1d470949 Added check for kernel parameter init.autocon=1. If this exists, then
init will try to open its own console. If not, then any console=
parameters will be ignored. This avoids conflicts with native kernel
created consoles.
2018-09-29 17:12:12 -03:00
Jesse Smith
6e8323e9fb The init process now writes the current runlevel to /var/run/runlevel.
This information can be read by the "runlevel" command as well as "halt"
and "reboot". Having the information logged in /var/run/runlevel as
well as the utmp file means systems without utmp (like those running
the musl C library) can still check the current runlevel. This is
useful when running halt/reboot as these programs want to check the
runlevel.

Updated the changelog, and manual pages for halt and runlevel.
2018-07-07 20:19:03 -03:00
Jesse Smith
7656f9d5f9 Version information is now fetched and defined by the Makefile.
No more need to update the version manually in the init.c source.
2018-07-01 18:44:57 -03:00
Jesse Smith
4438de4e50 Added --version flag to init and updated manual page. 2018-06-22 17:04:47 -03:00
Jesse Smith
40f40a4166 Removed DATE define from init.c, not needed anymore.
Updated Changelog in prep for release.
2018-06-18 19:35:53 -03:00
Jesse Smith
56e1041034 Updated Makefile and version information. 2018-05-20 17:21:18 -03:00
Jesse Smith
e0cfd39728 Added "Fall through" comments to some switch statements where multiple
approaches are tried in order to prevent warnings from GCC 7 (and newer).

Added includes on Linux for sys/sysmacros.h as the old defines in
the sys/types.h file will be removed in the future.
2018-05-04 14:51:40 -03:00
Jesse Smith
cfb39b573f Updated init.c to remove some old notes and answer questions
that were flagged in comments or FIXME labels.
2018-04-23 00:09:49 -03:00
Jesse Smith
272f112c98 Added new signal handler for SIGUSR2. When init receives SIGUSR2
it closes (and leaves closed) the named pipe /run/initctl. This
can be used to make sure init does not have any files open. However,
it also means we cannot switch run levels or bring down the system.
The pipe can be re-opened by sending init the SIGUSR1 signal.

Updated the man pages for initctl and init to include this information.
2018-04-17 19:44:50 -03:00
Jesse Smith
f09da9cb55 Add check to make sure /run/initctl is open before we try to close
it when receiving SIGUSR1. Avoids crashing upon receiving signal.
2018-04-15 14:09:33 -03:00
Jesse Smith
d9b6475d85 Removed unneeded "count" variable in utmpdump.c.
Fixed typo in accidental wrote_wtmp_rlevel == 0 || wrote_wtmp_rlevel
comparison so the latter is wrote_utmp_rlevel.

Simplified logic in mountpoint.c when testing for same device or same inode.

Thanks to David Binderman for pointing out the above three issues.
2018-03-30 22:15:04 -03:00
Jesse Smith
1d24d576f1 Add fscanf checks to init.c to warn us if calls fail.
Mostly to clean up compiler warnings.
2018-02-20 19:38:40 -04:00
Jesse Smith
f52d703c8e Updated bootlogd and init to better compile and run on GNU/kFreeBSD. 2018-02-20 19:30:46 -04:00
Jesse Smith
80dbcf3de3 Moved the named communication pipe from /dev/initctl to /run/initctl. This
patch was supplied by Robert Millan from Debian. FreeBSD apparently does not
like named piped in /dev, so we move it to /run for better cross-platform
compatibility.
2018-02-20 19:29:08 -04:00
Jesse Smith
6e3e87bf32 Patch to automatically spawn agetty on kernel consoles
The feature is useful for developers and admins that occasionally need
to boot with e.g. console=ttyS0.
The built in default can be overridden via inittab for each device. An
entry like "S0::off:" turns off the getty on ttyS0.
2018-02-20 19:18:58 -04:00
Petter Reinholdtsen
ca4561271e Check exit code from dup() in spawn() and log error if it fail.
Patch from Michał Kulling.
2014-02-10 22:47:27 +00:00
Petter Reinholdtsen
d53cccb542 Use narrowly scoped file descriptor for handling opened TTY in
spawn().  Patch from Michał Kulling.
2014-02-10 22:44:15 +00:00
Petter Reinholdtsen
a05987e281 Document length limit for the process field in the inittab. Patch
from Johannes Truschnigg and Debian.
2014-02-07 17:41:58 +00:00
Petter Reinholdtsen
3f08c42b06 Make sure to report an error if chdir(/) fail. 2014-02-07 13:45:06 +00:00
Petter Reinholdtsen
cc3a4e2f9e Avoid reusing open file descriptor to make it easier to pinpoint Coverity CID 1164479 resource leak. 2014-02-07 09:50:14 +00:00
Petter Reinholdtsen
992c7a70d7 No use checkinf if env is true in the branch where it is false (Coverity CID 1164462). 2014-01-28 22:29:30 +00:00
Petter Reinholdtsen
f11cdf9554 Adjust included headers to be compatible with the musl C library. Patch from Matias A. Fonzo and Dragora. 2014-01-26 22:00:42 +00:00
Petter Reinholdtsen
1c9808ec42 Close open file descriptor if the version is wrong (Coverity CID 1164481). 2014-01-26 09:58:04 +00:00
Petter Reinholdtsen
568c01bbb5 Document a fall through case block (Coverity CID 1164467). 2014-01-26 09:41:51 +00:00
Petter Reinholdtsen
571c45f3e6 Improve message printed when signaling processes to stop. Patch from Matias A. Fonzo at the dragora project. 2014-01-25 21:20:22 +00:00
Werner Fink
ec06765756 * Do not forget room for last NULL of new environment (was local bug 35866) 2012-03-19 12:50:36 +00:00
Werner Fink
d1a0609ab0 * Allow init to delte extra environment variables (was local bug
#35858)
* Avoid that init double environment variables for its childs
  (was local bug #35855)
2012-03-16 15:58:21 +00:00
Werner Fink
2f904f7848 fix minor typo 2011-11-14 08:53:05 +00:00
Werner Fink
d9122565a0 * Fix counting message lines in wall. Patch from Petr Lautrbach.
* Fix bad printf conversion specifier in wall. Patch from Sébastien Luttringer.
* Add patches from Openwall project. Thanks goes to Solar Designer.
2011-03-15 13:16:55 +00:00
Werner Fink
5114500187 Add fix for Debian bug #580272 2010-05-17 09:44:34 +00:00
Petter Reinholdtsen
cdb70c3a56 Only set the VSWTC field for termios in init if it is available, to get the source building on FreeBSD. 2010-04-27 19:51:01 +00:00
Petter Reinholdtsen
9abf8cc828 The next release will be 2.89. 2010-04-27 14:33:32 +00:00
Werner Fink
d886c94c9f * Correct fix for Debian bug #547073: use IUTF8 flag if defined
and if already set to make sure the utf-8 flag is not cleared
  from the tty. Patch from Samuel Thibault.
2010-04-27 12:32:52 +00:00
Werner Fink
080abb9f99 * Set version in init.c : 2.88 2010-04-12 08:34:38 +00:00
Petter Reinholdtsen
b6ecd1eadc Incude definition for MNT_DETACH which is missing in older GNU libc headers. 2010-04-11 07:42:27 +00:00
Petter Reinholdtsen
66299c783d Add compatibility code to handle old path /etc/powerstatus for a while. 2010-04-11 07:41:25 +00:00
Werner Fink
8d4557c16b * Remove PAM session start part from init as sulogin do not use
and will not use a PAM conv() function.  The current sulogin
   is able to handle DES as well as MD5, SHA, and Blowfish encrypted
   passwords due using getpwnam(3).
 * Enable the sulogin fallback password check to handle  MD5, SHA, and
   Blowfish encrypted passwords in case of getpwnam(3) fails.
2010-04-01 08:34:05 +00:00
Werner Fink
b2fec03199 * Test out PAM support, extend PAM support by providing environment
is specified by /etc/pam.d/init
 * Move utmp/wtmp before the execvp() in spawn() to be sure to
   use the correct pid even on a controlling tty
 * Remaining problem is that the pid of the second fork() for
   getting a controlling tty isn't that reported by spawn()
 * Re-enable writting utmp/wtmp for boot scripts
 * Provide a simply /etc/pam.d/init as without it will not work (sigh!)
2010-03-26 16:31:05 +00:00
Werner Fink
f69ea1f550 * Add fix for Debian bug #536574 -- Can be enabled by -DACCTON_OFF
* Add helper program fstab-decode to make it easier to handle
   /etc/mtab content. Patch by Miloslav Trmac and Fedora.
 * Add fix for Debian bug #335023 - Make sure TERM is set on FreeBSD.
 * Add fix for Debian bug #374038 - Make it clear that shutdown -c can
   only cancel a waiting shutdown, not an active one.
 * Add not to pidof manual page about the use of readlink(2). Patch by
   Bill Nottingham and Fedora.
 * Add changes for Debian bug #68621 - Add PAM support for programs spawned
   by init on the console like sulogin. Based on patch by Topi Miettinen.
2010-03-23 14:37:01 +00:00