Commit Graph

110 Commits

Author SHA1 Message Date
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
8cc9f34ca4 Merge branch '2.91' of git.sv.gnu.org:/srv/git/sysvinit into 2.91 2018-06-22 17:05:35 -03:00
Jesse Smith
4438de4e50 Added --version flag to init and updated manual page. 2018-06-22 17:04:47 -03:00
Jesse Smith
2a61e2b029 Adjusted order of compile flags to make it possible to select optimization
level by setting CFLAGS at compile file.
2018-06-21 20:22:44 -03:00
Jesse Smith
5f6d86d216 Adjusted order of compile flags to make it possible to select optimization
level by setting CFLAGS at compile file.
2018-06-21 19:34:25 -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
c229965b62 Fixed typo. Corrected by Radostin Stoyanov. 2018-06-11 13:06:04 -03:00
Jesse Smith
2d6d2bc0d3 Updated toplevel Makefile to avoid created unnecessary temporary
directories when they are not wanted/required.
2018-06-03 20:14:01 -03:00
Jesse Smith
108b31e284 Switched from using -fstack-protector to -fstack-protector-strong compile
flag. Tested with both GCC and Clang.
2018-06-02 16:50:35 -03:00
Jesse Smith
56e1041034 Updated Makefile and version information. 2018-05-20 17:21:18 -03:00
Jesse Smith
75d85cc876 Fixed typo in Changelog. 2018-05-20 16:19:26 -03:00
Jesse Smith
bed25016b1 Updated sulogin.c to pull in crypt.h as it is a new, undocumented
dependency on Fedora 28.
Confirmed we can still build on other/older platforms.
2018-05-09 17:55:35 -03:00
Jesse Smith
3f400a01a3 Updated install documentation, fixed typo. 2018-05-05 17:11:29 -03:00
Jesse Smith
828c2704a1 Removed old LSM file.
Added .gitignore files to avoid git tracking object files.
Removed old start-stop-daemon from contrib directory.
2018-05-04 22:08:38 -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
266671c968 Added documentation page for initctl (/run/initctl). 2018-04-08 22:03:07 -03:00
Jesse Smith
a4508479f5 Updated shutdown to check if time has lapsed when we did not
notice. For example if the computer was in sleep mode pending
a shutdown. The shutdown command now notices time has past
and adjusts its countdown clock to compensate. Accurate
to the nearest minute.
Closes Savannah bug #36279
2018-04-04 23:12:25 -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
e02e001f7a Updated changelog in preparation for release. 2018-03-27 20:47:49 -03:00
Jesse Smith
a436cdc993 Merge branch 'mountpoint' 2018-03-27 20:33:52 -03:00
Jesse Smith
8c8172349e Updated mountpoint to search for circular mount points when using
the -p parameter. This works around mountpoint not recognizing
circular mounts where /a/b/c/d and /a/b are the same location
(ie the same device and same inode).
Closes Savannah bug #37114.
2018-03-07 16:25:53 -04:00
Jesse Smith
a8ef2a24c5 Updated changelog. 2018-03-07 13:59:51 -04:00
Jesse Smith
a3f38afc34 Updated documentation and install instructions. Refreshed copyright notice. 2018-02-27 17:28:10 -04:00
Jesse Smith
2e1f87635e Removed extra sleep() calls from shutting down process since we use
sync() anyway to pause and make sure data is written out to disk.
2018-02-22 21:07:51 -04:00
Jesse Smith
2b651b469e Fixed Clang compiler warning when calling sprintf() with
variable number of data parameters.
2018-02-21 18:05:58 -04:00
Jesse Smith
8c00f756ec Imported changelog from Jesse's source repo. 2018-02-20 19:42:51 -04:00
Jesse Smith
87032d1937 Moved initscript.sample from source to doc directory and committed it. 2018-02-20 19:39:07 -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
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
da988bb28e Make it possible to specify the initctl path as a compile time define INIT_FIFO. 2014-02-07 23:27:39 +00:00
Petter Reinholdtsen
4811afc88b Remove obsolete/ directory from tarball. None of it have been useful for many years. 2014-02-07 19:16:41 +00:00
Petter Reinholdtsen
67710ce13b Drop dsf part from version number. It no longer make sense to keep. 2014-02-07 19:04:25 +00:00
Petter Reinholdtsen
303f3465f6 Port ifdown.c to FreeBSD. Patch from Guillem Jover and Debian. 2014-02-07 17:55:37 +00:00
Petter Reinholdtsen
58b3b75728 Fix typo in fstab-decode(8) font escape. Patch from Bjarni Ingi
Gislason and Debian.
2014-02-07 17: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
1b91c378b9 Adapt bootlogd TIOCCONS call to kfreebsd. Patch from Mats Erik
Andersson and Debian.
2014-02-07 17:03:04 +00:00
Petter Reinholdtsen
de1344feb8 Rewrite findtty() in bootlogd.c to not chance working directory, to
reduce the amount of failure that can happin in that function.
2014-02-07 11:06:57 +00:00
Petter Reinholdtsen
8478327498 Adjust makefile to make it easier to link all binaries statically.
Patch from Matias A. Fonzo and Dragora.
2014-01-28 22:11:34 +00:00
Petter Reinholdtsen
834bcebcaf Use sysconf(_SC_SYMLOOP_MAX) instead of MAXSYMLINKS. If sysconf
returns an error, fall back to MAXSYMLINKS on platforms that
define it.  Fixes build on Hurd.  Patch from Justus Winter and
Debian.
2014-01-28 10:13:10 +00:00
Petter Reinholdtsen
c26aaa4410 Define _XOPEN_SOURCE when building to get crypt() from <unistd.h> instead of using <crypt.h> in sulogin.c, to get the source building with the musl C library. 2014-01-27 22:05:54 +00:00
Petter Reinholdtsen
52b92185de Move dovoid() macro from #ifdef__GLIBC__ to #ifdef __linux__, to match the condutions of the place where it is used. Thanks to Matias A. Fonzo for noticing. 2014-01-27 21:55:57 +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
d2f82534cf Try harder to find libcrypt.*, even if there is no static library
available.  Also look in /usr/lib/*/ for the library, to handle
Debian multiarch systems.  Based on patch from Andrew Gregory.
2014-01-25 21:57:25 +00:00
Petter Reinholdtsen
45660f6ee6 Rename internal functions warn() and shutdown() in the shutdown
binary to avoid surprising dynamic library name resolution
conflict with NSS modules.  Patch from Richard Tollerton.
2014-01-25 21:50:09 +00:00
Petter Reinholdtsen
ffcb38faae Fix typo in changelog text. 2014-01-25 21:25:21 +00:00