Commit Graph

110168 Commits

Author SHA1 Message Date
Ralf S. Engelschall
62bb1d78fe Improve the RC framework for the clean booting/shutdown of Jails:
1. Feature: for flexibility reasons and as a prerequisite to clean
   shutdowns, allow the configuration of a stop/shutdown command
   via rc.conf variable "jail_<name>_exec_stop" in addition to the
   start/boot command (rc.conf variable "jail_<name>_exec_start"). For
   backward compatibility reasons, rc.conf variable "jail_<name>_exec"
   is still supported, too.

2. Debug: Add the used boot/shutdown commands to the debug output of
   the /etc/rc.d/jail script, too.

3. Security: Run the Jail start/boot command in a cleaned environment
   to not leak information from the host to the Jail during startup.

4. Feature: Run the Jail stop/shutdown command "jail_<name>_exec_stop" on
   "/etc/rc.d/jail stop <name>" to allow a graceful shutdown of the Jail
   before its processes are just killed.

5. Bugfix: When killing the remaining Jail processes give the processes
   time to actually perform their termination sequence. Without this the
   subsequent umount(8) operations usually fail because the resources
   are still in use. Additionally, if after trying to TERM-inate the
   processes there are still processes hanging around, finally just KILL
   them.

6. Bugfix: In rc.shutdown, if running inside a Jail, skip the /etc/rc.d/*
   scripts which are flagged with the KEYWORD "nojail" to allow the
   correct operation of rc.shutdown under jail_<name>_exec_stop="/bin/sh
   /etc/rc.shutdown". This is analogous to what /etc/rc does inside a Jail.

Now the following typical host-configuration for two Jails works as
expected and correctly boots and shutdowns the Jails:

-----------------------------------------------------------
#  /etc/rc.conf:
jail_enable="YES"
jail_list="foo bar"
jail_foo_rootdir="/j/foo"
jail_foo_hostname="foo.example.com"
jail_foo_ip="192.168.0.1"
jail_foo_devfs_enable="YES"
jail_foo_mount_enable="YES"
jail_foo_exec_start="/bin/sh /etc/rc"
jail_foo_exec_stop="/bin/sh /etc/rc.shutdown"
jail_bar_rootdir="/j/bar"
jail_bar_hostname="bar.example.com"
jail_bar_ip="192.168.0.2"
jail_bar_devfs_enable="YES"
jail_bar_mount_enable="YES"
jail_bar_exec_start="/path/to/kjailer -v"
jail_bar_exec_stop="/bin/sh -c 'killall kjailer && sleep 60'"
-----------------------------------------------------------
#  /etc/fstab.foo
/v/foo /j/foo/v/foo nullfs rw 0 0
-----------------------------------------------------------
#  /etc/fstab.bar
/v/bar /j/bar/v/bar nullfs rw 0 0
-----------------------------------------------------------

Reviewed by:	freebsd-hackers
MFC after:	2 weeks
2004-12-14 14:36:35 +00:00
Simon L. B. Nielsen
bfd2ccd6bd Add snd_audiocs(4). 2004-12-14 13:12:29 +00:00
Simon L. B. Nielsen
8dd33b6c68 - Update usage to reflect the current reality.
- Fix a bug where manual pages which had a "_" in their name did not
  get proper architecture setting.

MFC after:	1 week
2004-12-14 13:07:58 +00:00
Maxim Konovalov
989a2aae70 Add NetBSD 2.0. 2004-12-14 12:30:43 +00:00
Jeff Roberson
7842f65e7f - Garbage collect several unused members of struct kse and struce ksegrp.
As best as I can tell, some of these were never used.
2004-12-14 10:53:55 +00:00
Jeff Roberson
8ffb8f5558 - In kseq_choose(), don't recalculate slice values for processes with a
nice of 0.  Doing so can cause an infinite loop because they should be
   running, but a nice -20 process could prevent them from doing so.
 - Add a new flag KEF_PRIOELEV to flag a thread that has had its priority
   elevated due to priority propagation.  If a thread has had its priority
   elevated, we assume that it must go on the current queue and it must
   get a slice.
 - In sched_userret() if our priority was elevated and we shouldn't have
   a timeslice, yield here until we should.

Found/Tested by:	glebius
2004-12-14 10:34:27 +00:00
Poul-Henning Kamp
2a9e0c3216 Be a bit more assertive about vnode bypass. 2004-12-14 09:32:18 +00:00
Ruslan Ermilov
2010c542b2 Minor mdoc(7) tweaks, excellent work Nate! 2004-12-14 09:24:48 +00:00
Poul-Henning Kamp
d986dbb448 Add a new kind of reference count (fd_holdcnt) to struct filedesc
which holds on to just the data structure and the mutex.  (The
existing refcount (fd_refcnt) holds onto the open files in the
descriptor.)

The fd_holdcnt is protected by fdesc_mtx, fd_refcnt by FILEDESC_LOCK.

Add fdhold(struct proc *) which gets a hold on the filedescriptors of
the specified proc..

Add fddrop(struct filedesc *) which drops the fd_holdcnt and if zero
destroys the mutex and frees the memory.

Initialize the fd_holdcnt to one in fdinit().  Normal operations on
the filedesc structure will not change it.

In fdfree() use fddrop() to dispose of the mutex and structure.  Hold
the FILEDESC_LOCK() until we have cleaned out the contents and carefully
set the fields to null values during cleanup.

Use fdhold()/fddrop() in mountcheckdirs() and sysctl_kern_file().
2004-12-14 09:09:51 +00:00
Ruslan Ermilov
7e727eadc4 mdoc(7) nit: Removed redundant .Pp call. 2004-12-14 09:06:44 +00:00
Poul-Henning Kamp
30abaa53df Make fdesc_mtx private to kern_descrip.c now that the flock has come home. 2004-12-14 08:44:51 +00:00
Poul-Henning Kamp
12b18fdab4 Move the checkdirs() function from vfs_mount.c to kern_descrip.c and
call it mountcheckdirs().
2004-12-14 08:23:18 +00:00
Gleb Smirnoff
e0d32af754 - Use ng_callout() instead of timeout.
- Schedule next timeout *after* finishing job of the current one.
- Remove spl(9) calls.

Tested by:	ru
Reviewed by:	julian
2004-12-14 08:05:29 +00:00
Poul-Henning Kamp
a884a1b0f2 Make LINT compile.
When leaving functions for ddb use don't make them static: it makes
gcc think they are unused.

Shouldn't this be in #ifdef DDB anyway ?
2004-12-14 07:46:28 +00:00
Poul-Henning Kamp
c113083c5a Add new function fdunshare() which encapsulates the necessary light magic
for ensuring that a process' filedesc is not shared with anybody.

Use it in the two places which previously had private implmentations.

This collects all fd_refcnt handling in kern_descrip.c
2004-12-14 07:20:03 +00:00
Julian Elischer
b96aca53dc A bunch more whitespace and formatting diff reductions for NetBSD.
Obtained from:	NetBSD
MFC after:	1 week
2004-12-14 04:47:24 +00:00
Pyun YongHyeon
e4d2d49b31 Add manual page for snd_audiocs(4).
Reminded by:	trhodes
MFC after:	1 week
2004-12-14 04:06:04 +00:00
Julian Elischer
47f9e7b6ce Don't abandon ship just because the number of companions doesn't seem correct.
Obtained from:	NetBSD
MFC after:	1 week
2004-12-14 04:05:10 +00:00
Julian Elischer
80ee93cb22 Slightly reorganise part of the ohci_softintr() function
to better keep track of the total amoutn transferred during a
transfer. Seems similar to some code in the NetBSD version.
I notice they have incorporated matches from him so I don't know which
direction it went.

Submitted by:	damien.bergamini@free.fr
Obtained from:	patches to make the ueagle driver work
MFC after:	1 week
2004-12-14 03:59:24 +00:00
Julian Elischer
6e6281a3dc Small formatting change..
Move a declaration to the same place as in NetBSD.

Obtained from:	NetBSD
MFC after:	1 week
2004-12-14 03:54:08 +00:00
Nate Lawson
edd84e4843 Checkpoint reworking the man page to be more useful to non-developers,
document some debug output variables, etc.  Mdoc assistance welcome.
2004-12-14 01:07:44 +00:00
Nate Lawson
276cd9216d Unify ACPI_DEBUG support for all OEM drivers under ACPI_OEM. Since more than
one will never be supported on the same platform, this does not hurt
debugging.

MFC after:	3 days
2004-12-13 23:31:46 +00:00
Warner Losh
93c22173bd The format of the MLINKS entries is pairwise, not MLINKS += wise. So
list kernel_mount.9 the required number of times to allow make
installworld to complete.
2004-12-13 23:09:19 +00:00
Roman Kurakin
f41d84e53a Make code MPSAFE.
You could turn this off by debug.mpsafenet=0 for full network
stack or via debug.{cp|cx|ctau}.mpsafenet for cp(4), cx(4) and
ctau(4) accordingly.

MFC after:	10 days
2004-12-13 22:07:23 +00:00
Andrew Gallatin
aee409b987 Make kttcp work in -stable (and -current)
- Removed kttcp_sosend() and kttcp_soreceive() in favor of using
  sosend() / soreceive() with UIO_NOCOPY.  The locking changes in the
  socket layer make merging the kttcp_so* and the so* routines a real
  pain.  It was a lot easier to just use the integrated routines.

- Eliminated KTTCP_MAX_XMIT restrictions on send and receive sizes
  because I encountered no problems with streams larger than MAX_INT.
  MAX_INT bytes is only good for a few seconds at 4Gb/sec ;)

- Removed Giant from send / recv routines.

- Fixed character device protos, cdevsw init, etc, to work in 5.x /
  6.x

Reviewed by: sam
MFC after: 1 week
2004-12-13 20:40:16 +00:00
Tom Rhodes
fe10ebf1f4 Add kernel_mount.9 and appropriate MLINKS to the build. 2004-12-13 19:29:40 +00:00
Tom Rhodes
610b07d6a3 Add a manual page to document phk's mount work.
Reviewed by:	phk (content), brueffer (grammar and markup)
2004-12-13 19:25:30 +00:00
Sam Leffler
1034272d55 correct module dependency 2004-12-13 18:26:13 +00:00
Sam Leffler
169b73b33a correct module dependency 2004-12-13 18:12:26 +00:00
Brian Somers
1f82daa58f Add ``enable echo''. 2004-12-13 17:54:30 +00:00
Warner Losh
7a7e867742 LINT defines things which compile in code that as referring to the old
a_desc element.  change this to the new a_gen.a_desc to reflect
changes to vnode_if.h generation.

Noticed by: tinderbox, phk
2004-12-13 17:53:20 +00:00
Brian Somers
71c1c49abb Mention the necessity for ``enable echo'' in ppp(8). 2004-12-13 17:52:10 +00:00
Jeff Roberson
3ef6ac3361 - If delivering a signal will result in killing a process that has a
nice value above 0, set it to 0 so that it may proceed with haste.
   This is especially important on ULE, where adjusting the priority
   does not guarantee that a thread will be granted a greater time slice.
2004-12-13 16:45:57 +00:00
Suleiman Souhlal
3d96167a54 Exporting of NTFS filesystem broke in rev 1.70. Fix it.
Approved by:	phk, grehan (mentor)
2004-12-13 16:21:48 +00:00
David E. O'Brien
b8e19b78df Back the warnings down from 9 to 6, since that is the highest we have. If
we added a WARNS 7 level, it shouldn't be assumed this code will pass it.
2004-12-13 15:42:46 +00:00
Brian Somers
cf4bdb6e94 Handle select() returning -1/EINTR - fairly common in these KSE days.
PR:		74972
MFC after:	3 days
2004-12-13 14:50:13 +00:00
Jeff Roberson
2d59a44dc0 - Take up a 'slot' while we're on the assigned queue, waiting to be
posted to another processor.  Otherwise, kern_switch() gets confused
   and tries to sched_add(NULL).
2004-12-13 13:09:33 +00:00
Pawel Jakub Dawidek
89dd8e5326 bioq_insert_head() function is already in subr_disk.c. 2004-12-13 13:02:06 +00:00
Pawel Jakub Dawidek
bf4843166f Add bioq_insert_head() function.
OK'd by:	phk
2004-12-13 12:57:21 +00:00
Brian Somers
125eb366ea Implement an ``enable/disable echo'' option, defaults to off.
This allows LCP ECHOs to be enabled independently of LQR reports.

Note: This introduces a change in the default behaviour (search for lqr and
echo in the man page).  I'll update UPDATING to reflect this.

PR:		74821
2004-12-13 12:51:19 +00:00
Niels Heinen
8a7a5b487d Add myself to the committers' birthday calendar
Approved by nectar (mentor)
2004-12-13 12:22:28 +00:00
Poul-Henning Kamp
5cb471d04d Don't forget to bypass vnodes in corner cases.
Found by:	kkenn and ports/shell/zsh
Thanks to:	jeffr
2004-12-13 10:07:57 +00:00
Julian Elischer
1cc7d59e34 Might as well get the right $NetBSD$ string while we are at it.
MFC after:	1 week
2004-12-13 08:12:06 +00:00
Julian Elischer
cd015c5e87 Diff reduction to NetBSD.
Now only things that are different between us and NetBSD show up.
Means that these files are more of NetBSD style in some places but
since thay are NetBSD files, um, that's ok.

Obtained from:	NetBSD
MFC after: 1 week
2004-12-13 08:08:57 +00:00
Julian Elischer
18b5fd62f9 MFNetBSD
Whitespace diff reduction, formatting fixes and one actual
arithmetic error that NetBSD have fixed.

Obtained from:	NetBSD
MFC after: 1 week
2004-12-13 07:45:02 +00:00
Poul-Henning Kamp
1dc4727ea3 Another FNONBLOCK -> O_NONBLOCK.
Don't unconditionally set IO_UNIT to device drivers in write:  nobody
checks it, and since it was always set it did not carry information anyway.
2004-12-13 07:41:19 +00:00
Poul-Henning Kamp
ab9caf9d67 Use O_NONBLOCK instead of FNONBLOCK alias. 2004-12-13 07:37:29 +00:00
Warner Losh
57c75b8f1a Rather than casting through a (void *) to avoid the aliasing warning,
do things correctly from an aliasing perspective.  Put the
vop_generic_args element as the first element for all the vop_*_args
and adjust the code to take the address of that instead of the
structure.

OK'd based on a vague description by: phk
2004-12-13 07:23:34 +00:00
Poul-Henning Kamp
f0d5cba935 Explicit panic in vop_read/vop_write for devices 2004-12-13 07:13:21 +00:00
Warner Losh
1239b0391a We don't need vnode.h, but do need uio.h in these files. vnode.h
shouldn't be included in drivers, generally, so remove them.

OK'd by: phk
2004-12-13 07:09:54 +00:00