summaryrefslogtreecommitdiffstats
path: root/sbin/init
Commit message (Collapse)AuthorAgeFilesLines
* Fix resource leaks in error cases.trasz2015-11-111-8/+9
| | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
* Userspace part of reroot support. This makes it possible to changetrasz2015-11-083-19/+281
| | | | | | | | | | | | | the root filesystem without full reboot, using "reboot -r". This can be used to to eg. boot from a temporary md_image preloaded by loader(8), setup an iSCSI session, and continue booting from rootfs mounted over iSCSI. Reviewed by: kib@, bapt@ MFC after: 1 month Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3693
* Disable suspend when we're shutting down. This solves the "tell FreeBSDcperciva2015-10-011-0/+14
| | | | | | | | | | | | to shut down; close laptop lid" scenario which otherwise tended to end with a laptop overheating or the battery dying. The implementation uses a new sysctl, kern.suspend_blocked; init(8) sets this while rc.suspend runs, and the ACPI sleep code ignores requests while the sysctl is set. Discussed on: freebsd-acpi (35 emails) MFC after: 1 week
* Add missing SIGUSR1 description.trasz2015-07-241-1/+2
| | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* new dependssjg2015-06-161-0/+1
|
* Add META_MODE support.sjg2015-06-131-0/+19
|\ | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp
| * dirdeps.mk now sets DEP_RELDIRsjg2015-06-081-2/+0
| |
| * Merge sync of headsjg2015-05-271-2/+1
| |\ | |/ |/|
| * Merge from head@274682sjg2014-11-191-1/+1
| |\
| * | Updated dependenciessjg2014-05-101-0/+1
| | |
| * | Merge headsjg2014-04-281-16/+4
| |\ \
| * \ \ Merge from headsjg2013-09-051-1/+2
| |\ \ \
| * | | | Updated dependenciessjg2013-03-111-0/+1
| | | | |
| * | | | Updated dependenciessjg2013-02-161-2/+0
| | | | |
| * | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.marcel2012-08-221-0/+20
| | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net>
* | | | | Convert sbin/ to LIBADDbapt2014-11-251-2/+1
| |_|_|/ |/| | | | | | | | | | | Reduce overlinking
* | | | Remove LOG_ODELAY because it does nothing.neel2014-08-171-1/+1
| |_|/ |/| | | | | | | | | | | Reviewed by: jilles CR: https://reviews.freebsd.org/D611
* | | init: Remove code to track line numbers in /etc/ttys.jilles2014-02-081-16/+4
| |/ |/| | | | | | | | | | | The tracking generated warnings when the line number of an existing tty in /etc/ttys changed, which would corrupt utmp (as it was indexed by the line number). With utmpx, the line number no longer matters, so the tracking is no longer needed.
* | init: Set kernel login class and CPU mask on new processes.jilles2013-08-131-1/+2
|/ | | | | | | In particular, this makes the kernel login class on processes started from /etc/rc "daemon" instead of "default". Reviewed by: trasz
* init: Remove unnecessary 2-second delay before calling reboot(2).jilles2012-05-251-2/+0
|
* Properly clear the O_NONBLOCK flag after opening the TTY.ed2012-04-061-1/+5
| | | | | | | | | | Though we should open the TTY with O_NONBLOCK to prevent rc(8) execution from potentially stalling, we must not forget to clear the flag later on, to prevent read(2) calls from failing later on. This prevented the shell pathname prompt from working properly. Reported by: kib
* mdoc: terminate quoted strings.joel2012-03-261-1/+1
| | | | Reviewed by: brueffer
* Make init(8) slightly more robust when /dev/console is missing.ed2012-03-143-17/+34
| | | | | | | | | | | | | | | | | | | | | | If the environment doesn't offer a working /dev/console, the existing version of init(8) will simply refuse running rc(8) scripts. This means you'll only have a system running init(8) and nothing else. Change the code to do the following: - Open /dev/console like we used to do, but make it more robust to use O_NONBLOCK to prevent blocking on a carrier. - If this fails, use /dev/null as stdin and /var/log/init.log as stdout and stderr. - If even this fails, use /dev/null as stdin, stdout and stderr. So why us this useful? Well, if you remove the `getpid() == 1' check in main(), you can now use init(8) inside jails to properly execute rc(8). It still requires some polishing, as existing tools assume init(8) has PID 1. Also it is now possible to use use init(8) on `headless' devices that don't even have a serial boot console.
* Fix whitespace.ed2012-03-111-8/+8
| | | | MFC after: 1 week
* Handle NULL return from crypt(3). Mostly from DragonFlykevlo2012-02-221-1/+2
|
* Move utmpx handling out of init(8).ed2012-02-112-40/+2
| | | | | | | | | | | | | | | | | This has the following advantages: - During boot, the BOOT_TIME record is now written right after the file systems become writable, but before users are allowed to log in. This means that they can't cause `hidden logins' by logging in right before init(8) kicks in. - The pututxline(3) function may potentially block on file locking, though this is very rare to occur. By placing it in an rc script, the user can still kill it with ^C if needed. - Most importantly: jails don't use init(8). This means that a force reboot of a system running jails will leave stale entries in the accounting database of the jails individually.
* Add missing static keywords for global variables to tools in sbin/.ed2011-11-041-4/+4
| | | | | | These tools declare global variables without using the static keyword, even though their use is limited to a single C-file, or without placing an extern declaration of them in the proper header file.
* - change "is is" to "is" or "it is"eadler2011-10-161-1/+1
| | | | | | | | - change "the the" to "the" Approved by: lstewart Approved by: sahil (mentor) MFC after: 3 days
* init(8): Document that login(1) is now responsible for recording logouts.jilles2011-01-231-5/+5
| | | | init(8) only uses utmpx for recording reboots and shutdowns.
* init: Only run /etc/rc.shutdown if /etc/rc was run.jilles2011-01-231-10/+35
| | | | | | | | | | | | | | | | | It does not make sense to shut down daemons that were not started. In particular, this fixes loss of mixer settings when shutting down using shutdown(8), init(8) or ctrl+alt+del from single-user mode. If /etc/rc reboots, /etc/rc.shutdown is not run. Also fix segfaults and other erratic behaviour if init receives SIGHUP or SIGTSTP while in single-user mode. This commit does not attempt to fix any badness with signal handlers (assumption that pointers can be read and written atomically, EINTR race condition). I believe it does not make this badness any worse. Silence on: -arch@
* Remove stale inclusion of <ulog.h>.ed2010-01-271-1/+0
| | | | This tool doesn't require libulog anymore.
* Remove stale references to utmp(5) and its corresponding filenames.ed2010-01-211-15/+5
| | | | I removed utmp and its manpage, but not other manpages referring to it.
* Migrate init(8) towards utmpx.ed2010-01-132-5/+8
| | | | | | | | According to a comment, we cannot safely remove utmpx entries here anymore. This is because the libc routines may block on file locking. In an ideal world login(1) should just remove the entries, which is why I'm disabling this code for now. If it turns out we get lots of stale entries here, we should figure out a way to deal with that.
* Let init(8) and reboot(8) use utmpx to log wtmp entries.ed2009-12-052-7/+13
| | | | | | | | logwtmp() gets called with the raw strings that are written to disk. For regular user entries, this isn't too bad, but when booting/shutting down, the contents get rather cryptic. Just call the standardized pututxline().
* Switch the default WARNS level for sbin/ to 6.ru2009-10-191-1/+0
| | | | Submitted by: Ulrich Spörlein
* Remove redundant code from runshutdown() now tcsetsid(3) works reliably.ed2009-06-151-18/+1
| | | | | | We can now just call setctty() without any problems. This means the shell running the shutdown script is now the session leader, just like on startup.
* Fix the staircase issue properly this time.ed2009-06-141-0/+8
| | | | | | | | | | | Even though I thought this bug was somewhere in the TTY layer, it turns out init(8) doesn't make sure /dev/console is opened initially properly. I've added revoke() to two pieces of code: - death(): Apart from killing the gettys on shutdown, this doesn't guarantee the TTY to be closed immediately. - runshutdown(): Just like setctty(), we should revoke /dev/console. Applications like syslogd may have file descriptors to the console.
* Static-ify procedures in init(8).delphij2008-09-271-80/+80
|
* Addition style(9) change.obrien2007-11-201-3/+3
|
* style(9)obrien2007-11-201-95/+96
|
* I understood the MLINK part incorrectly, it should be the other way aroundremko2007-06-011-1/+0
| | | | | | also remove the init mlink to securelevel. Discussed with and sharing pointyhat with: brueffer
* Patches to allow one to allow one to specify a directory to chroot to.imp2007-02-041-63/+139
| | | | | | | | | | This includes support for running a script to setup that directory. The kenv variables init_chroot and init_script control this behavior, and are documented in loader(8) that's about to be committed (along with the other variables like init_path...). Submitted by: Oliver Fromme Reviewed by: myself, jhb (earlier versions)
* Fix typo: effected -> affectedrse2007-01-021-1/+1
| | | | Submitted by: Gordon Stratton <tsr2600 (at) gmail (dot) com>
* Reparent the process that executes the window= command from the ttyskib2006-06-081-1/+13
| | | | | | | | | to the init. This prevents zombies from being accumulated. PR: bin/64198 Tested by: Eugene Grosbein <eugen at www svzserv kemerovo su> Approved by: kan (mentor) MFC after: 1 month
* use standard mode instead of 500 for /sbin/init.luigi2006-02-281-1/+0
| | | | | | | | | | | | | | | As discussed on -current, there is no sensitive info in /sbin/init to prevent reading it from non-privileged users, nor any reason to remove the 'x' bit as the first thing the program does is check the uid and exit if it is not run by root. Instead (and this is why i make the change), mode 500 prevents operation when exporting the partition without -maproot=0 to diskless clients. All previuos releases are affected by the same problem, so a merge to RELENG_6 at least would be appropriate (after proper re@ approval of course).
* -mdoc sweep.ru2005-11-181-2/+3
|
* Fix system shutdown timeout handling by again supporting longer runningrse2005-09-152-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | shutdown procedures (which have a duration of more than 120 seconds). We have two user-space affecting shutdown timeouts: a "soft" one in /etc/rc.shutdown and a "hard" one in init(8). The first one can be configured via /etc/rc.conf variable "rcshutdown_timeout" and defaults to 30 seconds. The second one was originally (in 1998) intended to be configured via sysctl(8) variable "kern.shutdown_timeout" and defaults to 120 seconds. Unfortunately, the "kern.shutdown_timeout" was declared "unused" in 1999 (as it obviously is actually not used within the kernel itself) and hence was intentionally but misleadingly removed in revision 1.107 from init_main.c. Kernel sysctl(8) variables are certainly a wrong way to control user-space processes in general, but in this particular case the sysctl(8) variable should have remained as it supports init(8), which isn't passed command line flags (which in turn could have been set via /etc/rc.conf), etc. As there is already a similar "kern.init_path" sysctl(8) variable which directly affects init(8), resurrect the init(8) shutdown timeout under sysctl(8) variable "kern.init_shutdown_timeout". But this time document it as being intentionally unused within the kernel and used by init(8). Also document it in the manpages init(8) and rc.conf(5). Reviewed by: phk MFC after: 2 weeks
* Moved descriptions of securelevels from init(7) to security(7).garys2005-09-031-62/+5
| | | | | | | | | | Files used both "securelevel" and either "secure level" or "security level"; all are now "security level". PR: docs/84266 Submitted by: garys Approved by: keramida MFC after: 3 days
* Sort sections.ru2005-01-181-17/+17
|
* Make WARNS=6 happy with our init(8):delphij2005-01-112-25/+40
| | | | | | | | | - Use more ``const''s where suitable. - Define strk() as a static function in global scope. This avoids the "nested extern declaration" warnings. - Use static initialization of strings, rather than referring string constants through char *. - Bump WARNS from 0 to 6.
OpenPOWER on IntegriCloud