#
321907 |
|
02-Aug-2017 |
delphij |
MFC r320761:
- Use strlcat() instead of strncat(). - Use asprintf() and handle allocation errors.
|
#
308037 |
|
28-Oct-2016 |
kib |
MFC r306808: Add verbosity around failed reboot(2) call.
|
#
308036 |
|
28-Oct-2016 |
kib |
MFC r306807: When making a pause after detecting hard kill of the single-user shell, ensure that we do sleep for at least the specified time, in presence of signals.
|
#
293747 |
|
12-Jan-2016 |
trasz |
MFC r290689:
Fix resource leaks in error cases.
Sponsored by: The FreeBSD Foundation
|
#
293744 |
|
12-Jan-2016 |
trasz |
MFC r290548:
Userspace part of reroot support. This makes it possible to change 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.
Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3693
|
#
289032 |
|
08-Oct-2015 |
cperciva |
MFC r288446: Disable suspend during shutdown.
|
#
256281 |
|
10-Oct-2013 |
gjb |
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
254288 |
|
13-Aug-2013 |
jilles |
init: Set kernel login class and CPU mask on new processes.
In particular, this makes the kernel login class on processes started from /etc/rc "daemon" instead of "default".
Reviewed by: trasz
|
#
236020 |
|
25-May-2012 |
jilles |
init: Remove unnecessary 2-second delay before calling reboot(2).
|
#
233945 |
|
06-Apr-2012 |
ed |
Properly clear the O_NONBLOCK flag after opening the TTY.
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
|
#
232977 |
|
14-Mar-2012 |
ed |
Make init(8) slightly more robust when /dev/console is missing.
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.
|
#
232841 |
|
11-Mar-2012 |
ed |
Fix whitespace.
MFC after: 1 week
|
#
231994 |
|
22-Feb-2012 |
kevlo |
Handle NULL return from crypt(3). Mostly from DragonFly
|
#
231534 |
|
11-Feb-2012 |
ed |
Move utmpx handling out of init(8).
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.
|
#
227081 |
|
04-Nov-2011 |
ed |
Add missing static keywords for global variables to tools in sbin/.
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.
|
#
217750 |
|
23-Jan-2011 |
jilles |
init: Only run /etc/rc.shutdown if /etc/rc was run.
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@
|
#
203096 |
|
27-Jan-2010 |
ed |
Remove stale inclusion of <ulog.h>.
This tool doesn't require libulog anymore.
|
#
202194 |
|
13-Jan-2010 |
ed |
Migrate init(8) towards utmpx.
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.
|
#
200161 |
|
05-Dec-2009 |
ed |
Let init(8) and reboot(8) use utmpx to log wtmp entries.
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().
|
#
194257 |
|
15-Jun-2009 |
ed |
Remove redundant code from runshutdown() now tcsetsid(3) works reliably.
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.
|
#
194198 |
|
14-Jun-2009 |
ed |
Fix the staircase issue properly this time.
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.
|
#
183391 |
|
26-Sep-2008 |
delphij |
Static-ify procedures in init(8).
|
#
173787 |
|
20-Nov-2007 |
obrien |
Addition style(9) change.
|
#
173785 |
|
20-Nov-2007 |
obrien |
style(9)
|
#
166484 |
|
04-Feb-2007 |
imp |
Patches to allow one to allow one to specify a directory to chroot to. 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)
|
#
159402 |
|
08-Jun-2006 |
kib |
Reparent the process that executes the window= command from the ttys 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
|
#
150154 |
|
15-Sep-2005 |
rse |
Fix system shutdown timeout handling by again supporting longer running 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
|
#
140070 |
|
11-Jan-2005 |
delphij |
Make WARNS=6 happy with our init(8): - 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.
|
#
135868 |
|
28-Sep-2004 |
imp |
Turns out that revision 1.52 was a bad idea. It broke the long standing ability to list a non-existant device in /etc/ttys to keep it from dying. This is a documented feature of init(8): The init utility can also be used to keep arbitrary daemons running, automatically restarting them if they die. In this case, the first field in the ttys(5) file must not reference the path to a configured device node and will be passed to the daemon as the final argument on its com- mand line. This is similar to the facility offered in the AT&T System V UNIX /etc/inittab.
So rather than fix the man page to 'break' this feature, back out the change.
At the time this change was made, people felt that the spamage from getty was annoying on headless consoles. Andrew Gallatin noted: > Most of my machines are headless without video cards and use a serial > console. With devfs this means that /dev/ttyv[1-N] do not exist and > getty bitches like this: > > Sep 26 11:00:11 monet getty[543]: open /dev/ttyv1: No such file or directory
and we went off and applied this hack rather than fixing getty to sleep forever when it gets an unknown device, as was Andrew's other suggestion. Since it breaks things, I'm off to do that instead.
|
#
128073 |
|
09-Apr-2004 |
markm |
Remove advertising clause from University of California Regent's license, per letter dated July 22, 1999.
Approved by: core, imp
|
#
126836 |
|
11-Mar-2004 |
bde |
Fixed misspellings of 0 as NULL.
|
#
123157 |
|
05-Dec-2003 |
imp |
Fix the case where one goes from zero to more than zero items enabled in /etc/ttys. Before this fix, once the count of active services reaches 0, one could never restart any more without a reboot.
Steve Passe did the leg work on this patch. After he found the fix, we discovered that an identical fix had been made to NetBSD.
Approved by: re@ <scottl> Approval tool: peril sensitive sunglasses
|
#
108002 |
|
17-Dec-2002 |
green |
Back out the previous commit, since there could be dire consequences if /etc/rc were accidentally executed (as requested by other committeers).
|
#
107995 |
|
17-Dec-2002 |
green |
Make /etc/rc and /etc/rc.shutdown executable, and execute them directly instead of via /bin/sh. They already have the proper #! lines, and there is no new failure case (if execution fails, it still attempts to execute indirectly via /bin/sh). This is necessary for SEBSD to function properly.
|
#
107994 |
|
17-Dec-2002 |
green |
/home/green/tmp/cvsSFosXg
|
#
104034 |
|
27-Sep-2002 |
jhb |
Give up on a tty if opening it's special file returns ENOENT like we do for ENXIO.
Glanced at by: imp, gallatin
|
#
101271 |
|
03-Aug-2002 |
mux |
I should have committed this ages ago... Convert init(8) to use nmount() instead of mount() when it has to mount devfs. This doesn't happen normally, since the kernel is supposed to mount devfs itself.
|
#
92838 |
|
20-Mar-2002 |
imp |
o remove __P o Use ansi function definitions o unifdef -D__STDC__
|
#
92806 |
|
20-Mar-2002 |
obrien |
Remove 'register' keyword. It does not help modern compilers, and some may take some hit from it. (I also found several functions that listed *every* of its 10 local vars with "register" -- just how many free registers do people think machines have?)
|
#
85010 |
|
15-Oct-2001 |
des |
Allow reboot during runcom.
PR: bin/28116 Submitted by: Valentin Nechayev <netch@netch.kiev.ua> MFC in: 1 week
|
#
81911 |
|
19-Aug-2001 |
kris |
Silence non-constant format string warnings by marking functions as __printflike()/__printf0like(), adding const, or adding missing "%s" format strings, as appropriate.
MFC after: 2 weeks
|
#
80381 |
|
26-Jul-2001 |
sheldonh |
Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. The definitions are more readable, and it's possible that they're more portable to pathalogical platforms.
Submitted by: David Hill <david@phobia.ms>
|
#
78484 |
|
19-Jun-2001 |
mikeh |
Fix typo which could lead to memory leak.
PR: misc/28283 MFC after: 2 weeks
|
#
73373 |
|
03-Mar-2001 |
asmodai |
Fix typo present since 1997: single used mode -> single user mode.
|
#
72188 |
|
08-Feb-2001 |
phk |
Fix a cosmetic problem with some very defensive programming: The devfs mount would show up as "/dev/", loose that trailing slash.
|
#
69793 |
|
09-Dec-2000 |
obrien |
Add `_PATH_DEVZERO'. Use _PATH_* where where possible.
|
#
65114 |
|
26-Aug-2000 |
phk |
Mount DEVFS with no options.
|
#
59871 |
|
01-May-2000 |
asmodai |
Remove unused include.
|
#
59216 |
|
14-Apr-2000 |
imp |
Add include of errno.h where needed, remove extern int errno where not.
These commits were inspired by a similar commit to netbsd.
|
#
57344 |
|
19-Feb-2000 |
alfred |
detect deleted tty lines in /etc/ttys.
|
#
53550 |
|
22-Nov-1999 |
dillon |
Finish up umntall support. init now passed an argument to the rundown script 'reboot' or 'single'. ISO support (which never worked) has been removed from mount_nfs. mount_nfs and umount now use mounttab, which allows umntall to work properly. The rc scripts now call umntall as appropriate.
Submitted by: Martin Blapp <mb@imp.ch>
|
#
51008 |
|
06-Sep-1999 |
kato |
FreeBSD kernel doesn't allow any process to decrease securelevel. So, init(8) cannot decrease securelevel. The manual page explains this and single_user() doesn't try to downgrade kernel to insecure mode.
Reviewed by: bde (manual page)
|
#
50476 |
|
27-Aug-1999 |
peter |
$Id$ -> $FreeBSD$
|
#
49018 |
|
23-Jul-1999 |
ru |
Fix a non-critical memory leak.
PR: 12769 Submitted by: Peter Jeremy <peter.jeremy@alcatel.com.au>
|
#
47998 |
|
18-Jun-1999 |
ru |
Bring in System V run-level patches (turned off by default). While I'm here, fix some typos in the manpage.
Requested by: des
|
#
47962 |
|
16-Jun-1999 |
ru |
Init(8) will halt the system if sent USR1 signal, or halt and turn the power off if sent SIGUSR2.
PR: 5451 Submitted by: Leif Neland <leifn@image.dk> Reworked by: ru Reviewed by: -hackers
|
#
37814 |
|
22-Jul-1998 |
phk |
Memory management error in init.
PR: 7320 Reviewed by: phk Submitted by: Anders Thulin <Anders.X.Thulin@telia.se>
|
#
37417 |
|
06-Jul-1998 |
charnier |
Correct .Nm use. Add rcsid. Use min for minutes instead of mn.
|
#
34001 |
|
02-Mar-1998 |
jraynard |
Don't assume sigset_t and int are equivalent.
|
#
30272 |
|
10-Oct-1997 |
peter |
This has always bugged me. At single user, the implied example it gives is not valid - it says that "sh" is the default, but you can't actually type "sh" at this prompt - it has to be /bin/sh or some other full pathname.
|
#
28344 |
|
17-Aug-1997 |
davidn |
Test that rc.shutdown exists before attempting to run it - silently return success if it doesn't to prevent any unwanted error msgs.
|
#
27942 |
|
06-Aug-1997 |
ache |
runshutdown(): get rid of getdtablesize loop, it gains nothing now but can waste time if many descriptors are available
|
#
27941 |
|
06-Aug-1997 |
ache |
rc.shutdown fixes: 1) revoke -> HUP 2) controlling terminal already present 3) add missing setprocresources call
|
#
27837 |
|
01-Aug-1997 |
davidn |
Add /etc/rc.shutdown capability to init. Add sample /etc/rc.shutdown (which is just a shell for now). Submitted by: Ollivier Robert <roberto@keltia.freenix.fr>
|
#
27275 |
|
08-Jul-1997 |
ache |
Move logwtmp(shutdown) call before any real action in death().
|
#
27215 |
|
05-Jul-1997 |
ache |
1. Replace malloc+bzero by calloc 2. Revoke internal active session list only now, not whole /etc/ttys
|
#
27197 |
|
04-Jul-1997 |
ache |
death: revoke all lines listed in /etc/ttys instead of sending HUP to all processes
|
#
27186 |
|
03-Jul-1997 |
ache |
Include <libutil.h> instead of private declarations
|
#
27176 |
|
02-Jul-1997 |
ache |
Remove unneded cast in login_getclassbyname which cause warning
|
#
27029 |
|
28-Jun-1997 |
pst |
Attempt to open the device for reading before actually adding the device to the session list. If the device comes back as unconfigured, just ignore that line in /etc/ttys. If someone HUP's init, we'll try again.
This change stops getty's from hanging on vty and sio ports that don't exist, either due to LKM drivers not being loaded, or probes failing. Reviewed by: bde
|
#
26594 |
|
13-Jun-1997 |
charnier |
Use err(3).
|
#
24408 |
|
30-Mar-1997 |
phk |
Fix mount call for devfs.
Submitted by: bde
|
#
22922 |
|
19-Feb-1997 |
dg |
Protect from stack overrun via /etc/ttys, which could possibly allow a root user to change the securelevel. Pointed out by Thomas H. Ptacek <tqbf@enteract.com>.
|
#
21941 |
|
22-Jan-1997 |
davidn |
Style police.
|
#
21865 |
|
19-Jan-1997 |
davidn |
Impose login_cap resource limits on processes started by init. /etc/rc started with "daemon" settings. "window=" started with "default" settings gettys started with "default" settings. This should open the way to junk kernel options MAX_{OPEN,CHILD} and the corresponding sysctl vars.
|
#
19227 |
|
28-Oct-1996 |
phk |
If passed the -d flag, mount devfs on /dev
|
#
12185 |
|
10-Nov-1995 |
dima |
If root does not have a password, `init' should not ask to enter it. otherwise it's not possible to get into single-user mode, if root does not have password and console insecure.
|
#
11910 |
|
29-Oct-1995 |
phk |
Define TRUE & FALSE rather than depending on bogus #includes.
|
#
10006 |
|
08-Aug-1995 |
mpp |
Fix init to correctly detect processes that are exiting multiple times per second.
|
#
9997 |
|
08-Aug-1995 |
ache |
nspace count was incremented only in child, so warning never displayed Pointed by: Mike Pritchard <mpp@mpp.minn.net>
|
#
8871 |
|
30-May-1995 |
rgrimes |
Remove trailing whitespace.
|
#
5478 |
|
10-Jan-1995 |
ache |
Add better argument handling Submitted by: jmz
|
#
3594 |
|
14-Oct-1994 |
ache |
revision 1.6 date: 1994/03/06 08:55:02; author: ache; state: Exp; lines: +4 -1 Stop count getty spacing problem, if we issue kill -1 1 ---------------------------- revision 1.5 date: 1994/03/04 17:51:39; author: ache; state: Exp; lines: +9 -2 I got a lot of "getty repeating too quickly on port %s, sleeping" from init.bsdi, it means that getty start and exit in five seconds. This is common situation for poor quality Russian phone lines: modem got CONNECT message and after retries got NO CARRIER. So I introduce spacing count, it means that this warning and sleep occurse only after GETTY_NSPACE times of sequental attempts. ---------------------------- revision 1.4 date: 1994/02/28 21:53:52; author: ache; state: Exp; lines: +71 -10 I found (and fix) ugly bugs in init.bsdi (this bugs not present in old init)
1) Init don't setup TERM environment variable for default terminal type from /etc/ttys before calling getty/window.
2) When "kill -1 1" issued, init don't restart getty when /etc/ttys parameters was changed (it only kill "off" end empty entries).
3) Small memory leak if "window" /etc/ttys parameter specified and "kill -1 1" issued.
Obtained from: FreeBSD 1.x
|
#
2327 |
|
28-Aug-1994 |
jkh |
What cretin named both a global and a function "reboot"? Global changed to Reboot. Submitted by: jkh
|
#
2323 |
|
27-Aug-1994 |
nate |
Bring in my changes from the 1.1 init.bsdi which causes a reboot (was a halt before) if init is sent an interrupt signal. This is necessary for <CTL><ALT><DEL> to do the right thing if enabled.
|
#
2233 |
|
23-Aug-1994 |
dg |
Nuked the 2 second DTR wait; this is handled correctly in the sio driver.
|
#
1559 |
|
26-May-1994 |
rgrimes |
This commit was generated by cvs2svn to compensate for changes in r1558, which included commits to RCS files with non-trunk default branches.
|
#
1558 |
|
26-May-1994 |
rgrimes |
BSD 4.4 Lite sbin Sources
Note: XNSrouted and routed NOT imported here, they shall be imported with usr.sbin.
|