Commit Graph

2319 Commits

Author SHA1 Message Date
hannken a6ee792cee The decision that `disksort_cylinder' uses to decide if the buffer needs
to go to the inversion list is incomplete. If the cylinders are equal
block numbers must be checked.

This caused lockups if some buffers with the same cylinder were cycling
through the list, as it may happen with softdep enabled.

Fixes PR #9197.
2000-01-28 09:27:38 +00:00
thorpej b58f7c1079 Remove unused global `consintr'. Rob Black, kern/3841. 2000-01-26 07:50:33 +00:00
enami a119cb3677 In the diagnostic check in config_detach, inform the name of parent and
its child who shouldn't be exist.
2000-01-25 13:23:26 +00:00
enami 65c138fea0 - Print a name of root device even if it is a network device.
- If RB_ASKNAME, only dumpdv holds the results asked interactively.
  Examie dumpspec only when !RB_ASKNAME.  This allows us to override
  dumps on none in kernel config file by booting kernel with RB_ASKNAME.
- Slightly rearrange code so that it more matches to comment.
2000-01-25 09:23:59 +00:00
enami 047cc5e94f Cleanup setroot() a bit:
- No longer necessary to use goto, just breaking the loop like other case
  is enough.
- Don't caliculate loop invariant every time.  Just reuse.
2000-01-25 03:42:36 +00:00
fvdl 65e677bd99 Add an exec hook mechanism, where kernel subsystem can register to
execute certain functions when a process does an exec(). Currently
uses a global list. Could possibly be done using a per-process list,
but this needs more thought.
2000-01-25 01:15:14 +00:00
thorpej 5aa64075cc Add a `config_pending' semaphore to block mounting of the root file system
until all device driver discovery threads have had a chance to do their
work.  This in turn blocks initproc's exec of init(8) until root is
mounted and process start times and CWD info has been fixed up.

Addresses kern/9247.
2000-01-24 18:03:19 +00:00
thorpej 6068308fcd In cwdinit(), if there isn't a cdir vnode yet, don't VREF() it. 2000-01-24 17:57:34 +00:00
mycroft 0153fa8a4d Regen. 2000-01-23 01:01:51 +00:00
mycroft db70ed30f4 Use proper varargs format for __semctl13. 2000-01-23 01:01:30 +00:00
thorpej 2ad35b74df After some discussion with Mycroft, change splstatclock() to splclock().
The rule is that you don't get to call scheduler-related functions (e.g.
wakeup()) above the clock interrupt.  Going to statclock unnecessarily
hoses e.g. serial interrupts on the SPARC.
2000-01-22 16:53:50 +00:00
thorpej 2ab34248eb Back out rev 1.36... what was I thinking? Also, update the comment that
led me astray to reflect reality.
2000-01-22 16:32:02 +00:00
thorpej 0ef111e8ee - Implement bowrite() -- perform an asynchronous, ordered write. 2000-01-21 23:22:24 +00:00
thorpej e3d3905ac7 Preserve B_ORDERED. 2000-01-21 23:21:46 +00:00
thorpej 05c6b5a9a0 - Add a B_ORDERED flag to communicate to drivers that an I/O request should
be issued/completed in order; that is, provide a barrier for I/O queues.
- Change the buffer driver queue links to a TAILQ, rather than using
  a home-grown equivalent.  Provide BUFQ_*() macros to manipulate buffer
  queues; these deal with the barrier provided by B_ORDERED.
- Update disksort() accordingly, and provide 3 versions:
	- disksort_cylinder(): historical disksort(), which keys on
	  b_cylinder (and b_blkno for the case when b_cylinder matches).
	- disksort_blkno(): sorts only on b_blkno.  Essentially the
	  same as disksort_cylinder(), but with fewer comparisons.
	- disksort_tail(): requests are simply inserted into the queue
	  at the tail.  This is provided as an option so that drivers
	  can simply have a pointer to the appropriate sort function.
  Note that disksort() now pays attention to B_ORDERED.
2000-01-21 23:20:51 +00:00
thorpej a0397a2573 Move callout initialization to a single location; no need to duplicate
that code all over the place.
2000-01-19 20:05:30 +00:00
cgd ccfb44f360 use the old cloning-device cf_unit increment behaviour, if
__BROKEN_CONFIG_UNIT_USAGE is defined.
2000-01-18 07:45:04 +00:00
matt 2dd872c9b4 defopt COMPAT_VAX1K 2000-01-17 02:59:25 +00:00
assar 70aab8de7d (sysctl_doeproc): make sure we release the proclist_lock even if
copyout fails
2000-01-16 15:07:48 +00:00
thorpej c194b71ab0 Per my comment earlier in the file, we only need to go do splsoftclock()
when write-locking the proclist; splstatclock() is a wee bit overkill.
2000-01-13 21:55:36 +00:00
mrg e7552e93d7 reverse (and fix) the logic of the other change; it cause semi-random alpha SIGABRT for longer command lines 2000-01-05 08:11:31 +00:00
msaitoh da3eeac505 EXEC_COFF cleanup 2000-01-02 13:39:49 +00:00
mycroft 40d251bc94 Update for y2k. 2000-01-01 05:00:03 +00:00
eeh 3bd42b03a7 Make getcwd_common() available to COMPAT_NETBSD32 code as well. 1999-12-30 16:01:34 +00:00
eeh f293acc959 Dump cores for 32-bit processes. 1999-12-30 16:00:23 +00:00
eeh b142754870 Handle args for 32-bit emulation processes properly. 1999-12-30 15:59:26 +00:00
eeh 7aeaf762e5 Move netbsd32_exec BEFORE normal 32-bit exec so 32-bit binaries are not executed
on 64-bit kernels without emulation mode.
1999-12-30 15:57:31 +00:00
cgd 71a030cab6 avoid 'marching unit numbers' for cloning devices. (e.g., previously,
if you com* at pcmcia?, and com3 and com4 as pcmcia cards, and removed
and reinserted the card that was com3, it would become com5.  if you then
removed and reinserted com4, it would become com6.  etc.)  Now, instead
of incrementing FSTATE_STAR configuration entries for a driver when
a cloning instance is attached, leave it alone, and scan the device softc
array (starting at the first cloning unit number) for units which are
available for use.  This wastes a tiny bit of time (can require a linear
scan of the softc table for the device), but device attachment should be
relatively infrequent and the number of units of each type of device
is never particularly large anyway.
1999-12-30 01:03:43 +00:00
thorpej 51fcba3845 Explicitly set secondary processors in motion before calling uvm_scheduler(). 1999-12-16 19:59:17 +00:00
jdolecek f7f3de79e0 g/c redundant vn_isunder() prototype (it.s in <sys/vnode.h>)
minor KNF changes
1999-12-15 08:36:44 +00:00
perseant fa6a733240 In lfs_bwrite, don't mark buffers dirty if lfs is mounted read-only.
(Previously buffers could be marked dirty by the cleaner, and possibly by
other means.)

Also check for softdep mount in vfs_shutdown before trying to bawrite
buffers, since other filesystems don't need it and lfs doesn't bawrite.
(This fragment reviewed by fvdl.)

Partially addresses PR#8964.
1999-12-15 07:10:32 +00:00
itojun ea861f0183 sync IPv6 part with latest KAME tree. IPsec part is left unmodified
due to massive changes in KAME side.
- IPv6 output goes through nd6_output
- faith can capture IPv4 packets as well - you can run IPv4-to-IPv6 translator
  using heavily modified DNS servers
- per-interface statistics (required for IPv6 MIB)
- interface autoconfig is revisited
- udp input handling has a big change for mapped address support.
- introduce in4_cksum() for non-overwriting checksumming
- introduce m_pulldown()
- neighbor discovery cleanups/improvements
- netinet/in.h strictly conforms to RFC2553 (no extra defs visible to userland)
- IFA_STATS is fixed a bit (not tested)
- and more more more.

TODO:
- cleanup os-independency #ifdef
- avoid rcvif dual use (for IPsec) to help ifdetach

(sorry for jumbo commit, I can't separate this any more...)
1999-12-13 15:17:17 +00:00
sommerfeld 8933230897 bitmask_snprintf: avoid returning too soon if we're using the
new-style format.
1999-12-13 01:29:03 +00:00
sommerfeld c3ddfa524d Fix bug observed by Perry and myself: when emacs was shut down
uncleanly due to a lost connection, it would hang in closef() waiting
for the usecount to go back to 1.

An audit of FILE_USE() vs FILE_UNUSE() usage led me to discover some
incorrect error-path code..

In sys_fcntl(), avoid leaking a file descriptor usecount in an error
case of F_SETFL; don't return, instead go to "out" to clean up.  I
suspect that the F_SETFL would fail because vop_fcntl is not
implemented in deadfs.
1999-12-08 18:53:56 +00:00
thorpej 33c520ace6 Regen. 1999-12-07 23:58:27 +00:00
thorpej 0bd5e93b0e Remove duplicate vop_balloc definition accidentally added in rev 1.21. 1999-12-07 23:57:49 +00:00
wrstuden 17afd02c47 Regen. 1999-12-07 21:07:38 +00:00
wrstuden 7cbac78932 Add comments to describe the lookup parameters needed in the various
component name fragments passed into VOP calls.
1999-12-07 21:06:48 +00:00
tron 0f8b4e4579 Revert order of formula to calculate the number of buffer pages if the
BUFCACHE option is defined. With the new formular a few pages less will
be used (22 on a system with 256MB) but we avoid a possible integer
overflow.
1999-12-05 17:12:43 +00:00
tron 8b7af21483 Correct calculation of buffer pages if BUFCACHE is defined. Patch supplied
by kern/8954 by URA Hiroshi.
1999-12-05 15:53:37 +00:00
ragge 184f8b2c39 First round of discarding the CL* macros. 1999-12-03 21:43:19 +00:00
itojun bbb8727584 bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code).  Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
1999-11-30 13:34:47 +00:00
fvdl 2aea14c604 Clear B_AGE in bdirty(), this buffer must go through the LRU again
to be back on the AGE queue. Otherwise we risk recycling a set
of buffers with (soft) dependencies on the AGE list, which may
last forever if the vnode they belong to is locked (i.e. the syncer
won't get to the buffers they depend on, so their dependencies
are never flushed).
1999-11-26 17:18:15 +00:00
fvdl d901f6eae0 Be more careful to block bio interrupts for some data structures. There
were at least a few missed cases where vp->v_{clean,dirty}blkhd were
unprotected since the softdep/trickle sync merge.
1999-11-23 23:52:40 +00:00
is 58f7417063 Call the machine dependent code to do d-cache/i-cache synchronization, for
architectures that need it. Without this, at least on Motorola 68040 and 68060
machines, the sigtramp regression test fails.
1999-11-21 17:04:05 +00:00
enami f6b8114fc7 Initialize the vnode_hold_list correctly. 1999-11-18 05:50:25 +00:00
is 082c2a59eb - strings handled by the common functions sysctl_string() and sysctl_rdstring()
are handled as arrays; that is, a truncated old value is returned, alongside
  with ENOMEM, if the buffer is too small.

- in all int, quad, and single struct cases, and all specials handled inside
  this file, oldlenp semantics are now as documented in the manual page, that
  is, a NULL oldp, but non-NULL oldlenp returns the needed size

[I had to change the oldlenp handling, so I thought I should make it as
 advertized. Formerly, the subroutines would not know when a NULL oldlenp
 was passed, do the work anyway, and the value would be thrown away.]

This is needed as a first step to make gethostname() and getdomainname()
conform to its own manual page and SUSV2. (See pr 7836 by Simon Burge)
1999-11-17 23:24:54 +00:00
fvdl 0b1963121a Add Kirk McKusick's soft updates code to the trunk. Not enabled by
default, as the copyright on the main file (ffs_softdep.c) is such
that is has been put into gnusrc. options SOFTDEP will pull this
in. This code also contains the trickle syncer.

Bump version number to 1.4O
1999-11-15 18:49:07 +00:00
simonb 7fdf32e3d0 Defopt MAXUPRC. 1999-11-13 05:02:25 +00:00
is 71d206232b Return the data length even for non-readonly strings, as advertized. 1999-11-12 16:10:16 +00:00
mycroft 895de56d08 Fix recent bug in sys_accept(): we must remove the file descriptor from the
file descriptor table before freeing the file description.
1999-11-05 11:48:57 +00:00
jdolecek 3999099463 proc_sysctl(): initialize ptmp to NULL - theoretically, ptmp might
be used uninitialized when name[0] != PROC_CURPROC and
proclists[0]->pd_list == NULL; actually, this can never happen
(proclists[0] == &allproc), but the compiler can not know this, so it
complains
1999-11-03 09:12:15 +00:00
enami 781f26d383 back out unnecessary stylistic changes in recent changes, to keep coding
style closer to NKF.
1999-10-30 12:11:27 +00:00
itojun b7f47adef9 add mbuf deep-copy fnudtion, m_dup().
NOTE: if you use m_dup(), your additional kernel code can become
incompatible with 4.xBSD or other *BSD.
1999-10-27 14:23:26 +00:00
jdolecek 37c00e7548 minor cleanup of previous - avoid goto and code duplication 1999-10-27 13:17:46 +00:00
darrenr d2c8da2c36 patch from Greg A. Woods to fix panic problems with code that attempts to
recover from failures to accept a socket successfully.  Problem suggested
by this:
> It would appear (from two "panic: closef: count < 0" failures in less
> than 12 hours) that Darren's fix to accept(2) for lost file descriptors
> isn't quite correct.  His fix inserts a call to closef() to handle one
> of several possible error conditions.  However everywhere else in the
> socket code in the same file where falloc() cleanup is necessary the
> function used is ffree().
1999-10-27 11:54:56 +00:00
kleink 522cbf0248 Update to match new SVR4-style definition names in <sys/exec_elf.h>. 1999-10-25 13:55:06 +00:00
ross 1ff9cacc0c Back out a small and unfinished piece of the old scheduler rototill. 1999-10-14 05:59:57 +00:00
thorpej e3203cc4b6 Detect if kmem is up, and if not, ignore EX_MALLOCOK. 1999-10-11 22:57:17 +00:00
hwr 6d638c3405 If time delta is larger than thresh. Use 10* adj factor. Make this
work for negative deltas too. From NAKAJIMA Yoshihiro <nakayosh@kcn.ne.jp>
in kern/8589.
1999-10-10 18:41:53 +00:00
mycroft fde519b5e2 Widen usecount and writecount to prevent overflow. 1999-10-01 22:03:17 +00:00
mycroft 5e7ae44739 Correct spelling in an #ifdef. 1999-10-01 21:57:42 +00:00
bouyer 52497e180a Remplace kern.shortcorename sysctl with a more flexible sheme,
core filename format, which allow to change the name of the core dump,
and to relocate it in a directory. Credits to Bill Sommerfeld for giving me
the idea :)
The default core filename format can be changed by options DEFCORENAME and/or
kern.defcorename
Create a new sysctl tree, proc, which holds per-process values (for now
the corename format, and resources limits). Process is designed by its pid
at the second level name. These values are inherited on fork, and the corename
fomat is reset to defcorename on suid/sgid exec.
Create a p_sugid() function, to take appropriate actions on suid/sgid
exec (for now set the P_SUGID flag and reset the per-proc corename).
Adjust dosetrlimit() to allow changing limits of one proc by another, with
credential controls.
1999-09-28 14:47:00 +00:00
kleink c13a492388 1003.1c: add {LOGIN_NAME_MAX}. 1999-09-27 16:24:39 +00:00
minoura be7984a052 First step toward network boot.
By Takeshi Nakayama <tn@catvmics.ne.jp>.
1999-09-23 15:14:57 +00:00
thorpej 0d7a86c356 - Centralize the declaration and clearing of `cold'.
- Call configure() after setting up proc0.
- Call initclocks() from configure(), after cpu_configure().  Once the
  clocks are running, clear `cold'.  Then run interrupt-driven
  autoconfiguration.
1999-09-17 20:11:56 +00:00
thorpej 11cae42531 Centralize the declaration and clearing of `cold'. 1999-09-17 19:59:35 +00:00
thorpej 6266379c9d Be slightly more informative in the tsleep() diagnostics. 1999-09-15 21:54:57 +00:00
thorpej e8431098fe Add a mechanism to defer configuration of children until interrupts
are enabled.
1999-09-15 19:37:08 +00:00
thorpej 3b01d1b872 Rename the machine-dependent autoconfiguration entry point `cpu_configure()',
and rename config_init() to configure() and call cpu_configure() from there.
1999-09-15 18:10:33 +00:00
itojun 65363da25e Merge in NetBSD/sh3 from cvs.kame.net repository.
Tree structure:
- sys/arch/sh3: sh3 generic code
	As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
1999-09-13 10:30:21 +00:00
mycroft 34b45d9bd7 Obey negative cache entries for intermediate directories during a create. 1999-09-10 23:24:23 +00:00
sommerfeld c450ebbbe7 If using kernel PLL (for NTP), initialize "fixtick" to a reasonable
approximation of reality if the MD code doesn't.  This variable is the
equivalent of "tickfix" for the non-NTP path.

This allows an alpha kernel (where hz=1024) with "options NTP" to
synch up quite nicely (as opposed to having an frequency error of
~560ppm, which is outside the capture range of the PLL).
1999-09-06 20:44:02 +00:00
hubertf abda8d9447 Allow hardlinks to symlinks.
Reviewed by: Bill Studenmund, Klaus Klein
1999-09-05 23:34:39 +00:00
jdolecek 026b142488 Change cache_lookup() as per discussion on tech-kern & ICB:
If the entry is found in name cache, cache_lookup() does all the
necessary locking now, simplifying the interface and making the
code easier to follow and maintain.

The code now also removes the entry from cache when it's either invalid
(vget() fails) or the vnode has been recycled while waiting for the lock.
In that case, unlock/relock of the directory vnode has been eliminated too.
Both changes could lead to sligh performace improvement in same cases.

Furthermore, obscure bug has been found and eliminated for ISDOTDOT in the
lockparent && ISLASTCN case: if the vget() succeded and the re-lock
of the directory vnode not, we returned the error with the '..' vnode still
locked.

For simplicity, cache_lookup() now returns 0 if the positive entry was found
in cache, -1 if not found and ENOENT or error returned by the locking
functions in any other case.

Many thanks to Bill Studenmund and especially Charles Hannum
for invaluable advices and code to get this right.

Tested by: jdolecek
Rewieved by: wrstuden, mycroft
1999-09-05 14:22:34 +00:00
jdolecek e49c7e1186 LMREADY: kill the DEBUG message "LKM: try ready"
LMLOADSYMS: print the DEBUG message only when (lkm_debug & LKMDB_LOAD)
1999-09-03 17:07:52 +00:00
bouyer 051211ffa9 Add a new flag, used by vn_open() which prevent symlinks from being followed
at open time. Use this to prevent coredump to follow symlinks when the
kernel opens/creates the file.
1999-08-31 12:30:35 +00:00
thorpej c2ce79c0c9 In _pool_put(), panic if we're put'ing with nout == 0. This will help us
detect a little earlier if we've dup-put'd.  Otherwise, underflow occurs,
and subsequent allocations simply hang or fail (it thinks the hardlimit
has been reached).
1999-08-29 00:26:01 +00:00
thorpej 8d4e2a9293 Make it possible to direct LOCKDEBUG messages to syslog only. 1999-08-27 01:14:38 +00:00
thorpej 0038e42900 Implement vlog() (varargs version of log()). 1999-08-27 01:14:15 +00:00
thorpej 4aafee104b Regen. 1999-08-25 05:06:31 +00:00
thorpej dc8ecaa15b Overhaul of the SVID IPC facilities, primarily to use the types specified
by the Single UNIX Specification version 2, rather than the SVR2-derived
types.  While I was here, I did a namespace sweep to expose the constants
and strucutures, and structure members described by SUSv2; documentation
updates coming shortly.

Fixes kern/8158.
1999-08-25 05:05:48 +00:00
thorpej 0174ee34d0 Add COMPAT_14. 1999-08-25 04:55:53 +00:00
wrstuden ba891a728d Deal with device vnodes which aren't on the spechash tables, rather than
panicing. So now we make sure vp->v_hashchain != NULL before removing
the node from the chain.
1999-08-20 22:21:25 +00:00
thorpej a21be175c5 Clean up some whitespace issues in the generated syscallargs.h file. 1999-08-20 19:07:31 +00:00
thorpej f2c2e160b1 Fix "print vnodes for dirty buffers" change: use vprint(); VOP_PRINT()
is only meant to be used by vprint(), and vprint() provides more
information about the vnode.
1999-08-19 18:09:44 +00:00
simonb c620766979 In vfs_shutdown() print any vnodes for busy buffers if DEBUG is defined.
Patch from Bill Studenmund.
1999-08-19 13:54:06 +00:00
tron 992156ec89 Remove the prototype for settime(), it is in "sys/time.h" now. 1999-08-16 18:53:55 +00:00
tron 35ba1291c8 Make settime() public because we need to use it for the Linux emulation. 1999-08-16 18:42:25 +00:00
ross 2f76dd5371 In getnewvnode(), initialize v_interlock when the vnode comes from the
pool allocator.
1999-08-14 06:23:59 +00:00
wrstuden 14693e0ca1 Modify comments regarding VOP_LOOKUP. Revised lookup description, and also
document both cases which can set PDIRUNLOCK.

Reviewed by Bill Sommerfeld.
1999-08-11 00:20:50 +00:00
thorpej cca4496da7 Use cpuid_t and cpu_number(). 1999-08-10 21:10:20 +00:00
ross ff87f817c1 Call stopprofclock(p) from sys_execve(). 1999-08-09 02:42:20 +00:00
thorpej eb20bbc780 Change the semantics of splsoftclock() to be like other spl*() functions,
that is priority is rasied.  Add a new spllowersoftclock() to provide the
atomic drop-to-softclock semantics that the old splsoftclock() provided,
and update calls accordingly.

This fixes a problem with using the "rnd" pseudo-device from within
interrupt context to extract random data (e.g. from within the softnet
interrupt) where doing so would incorrectly unblock interrupts (causing
all sorts of lossage).

XXX 4 platforms do not have priority-raising capability: newsmips, sparc,
XXX sparc64, and VAX.  This platforms still have this bug until their
XXX spl*() functions are fixed.
1999-08-05 18:08:08 +00:00
sommerfeld 2aa9696fee Implement arp_drain(), which frees packets tied up in the arp cache if
mbufs are in short supply.
Create a (trivial) protocol domain for arp so that the drain routine will
be called from m_reclaim()
1999-08-05 04:04:28 +00:00
sommerfeld b8e4538f80 Create new pool flag PR_LIMITFAIL, indicating that even PR_WAIT
allocations should fail if the pool is at its hard limit.
Document flag in pool(9).
Use it in mbuf.h for the first allocate call for M_GET, M_GETHDR, and
MCLGET, so that m_reclaim gets called even for blocking allocations.
1999-08-05 04:00:03 +00:00
thorpej 428443a130 Add some more diagnostic information to the 3 different `panic("m_copym")'
calls.
1999-08-05 02:24:29 +00:00
mycroft f85ee5e22e The old compaction test had an off-by-one error that caused it to not compact
in some cases where it could have.  Fix this, and the new version as well.
1999-08-04 22:33:20 +00:00
matt 0dc0497a97 Don't compress mbuf clusters which are referenced by multiple
mbufs since you might overwriting valuable data.  (think of
m_copy'ed data from a TCP re-transmission queue.  Since those
might be in clusters and referenced in two sockets).
1999-08-04 21:40:39 +00:00
mycroft 545d8679c0 It's now possible for sbcompress() to compact mbuf clusters, so do it.
This helps prevent mbuf cluster exhaustion when receiving lots of small
packets.
1999-08-04 21:30:12 +00:00
wrstuden 3bf14d81e9 Add support for fcntl(2) to generate VOP_FCNTL calls. Any fcntl
call with F_FSCTL set and F_SETFL calls generate calls to a new
fileop fo_fcntl. Add genfs_fcntl() and soo_fcntl() which return 0
for F_SETFL and EOPNOTSUPP otherwise. Have all leaf filesystems
use genfs_fcntl().

Reviewed by: thorpej
Tested by: wrstuden
1999-08-03 20:19:16 +00:00
wrstuden ae0b6372e0 Regen for revision: 1.19 of vnode_if.src. 1999-08-03 18:20:22 +00:00
wrstuden 5896b56eae Add VOP_FCNTL. 1999-08-03 18:19:08 +00:00
wrstuden cca0c4f6de Modify how lookup walks up mount points. As suggested by Konrad
Schroder <perseant@hitl.washington.edu>, unlock the mounted on
vnode before we call VFS_ROOT so that we cover the case where the new
root vnode shares a lock with the mounted-on vnode. Note that we have
asserted vfs_busy on the new fs before unlocking, so no other process can
steal the mount out from under us.
1999-08-03 18:17:24 +00:00
christos 93146392a8 OpenBSD patch to prevent non-root users who own block or character devices
(typically ttys or ptys) from changing the flags on them. [Commit by cjs.]
1999-07-31 03:18:43 +00:00
sommerfeld 3267e5e87d Probable fix for PR7943: lookups fail spuriously over NFS.
The problem was due to an interaction between the doomed unmounts done by
amd and getnewvnode.
I convinced myself that it's ok for getnewvnode() to do a sleeping vfs_busy().

Tested with multiple builds running while another process attempted to unmount
/usr once a second.
1999-07-29 13:31:45 +00:00
thorpej cb41412726 Fix a thinko in draining of spin locks: bump waitcount in the spin case,
too.  Remove some needless code duplication by adding a "drain" argument
to the ACQUIRE() macro (compiler can [and does] optimize the constant
conditional).
1999-07-28 19:29:39 +00:00
mellon a976011fcf - Correct the definition of the COUNT macro so that it takes the same
number of arguments when compiled without DIAGNOSTIC as with.
1999-07-28 01:59:46 +00:00
thorpej 0b1b32b6ff Make sure the kprintf_slock is initialized, and use the low-level atomic
locking primitive directly to lock it, since those will never attempt
to call printf() to display debugging information (and thus deadlock
on recursion into the kprintf_slock).
1999-07-27 21:50:37 +00:00
thorpej cd992b17df In _pool_put(), call simple_lock_freecheck() if we're LOCKDEBUG before
we put the item on the free list.
1999-07-27 21:31:17 +00:00
thorpej 6390046137 Improve the LOCKDEBUG code:
- Now compatible with MULTIPROCESSOR (requires other changes not yet
  committed, but which will be later today).
- In addition to tracking simple locks, track exclusive spin locks.
- Count spin locks like we do sleep locks (in the cpu_info for this
  CPU).
- Lock debug lists are now TAILQs, so as to make the locking order
  more obvious when dumping the list.

Also, some suggestions from Bill Sommerfeld:
- SIMPLELOCK_LOCKED and SIMPLELOCK_UNLOCKED constants, which may be
  defined in <machine/lock.h> (default to 1 and 0, respectively).  This
  makes it easier to support architectures which use test-and-clear
  rather than test-and-set.
- Add __attribute__((__aligned__)) to the `lock_data' member of the
  simplelock structure.  This makes it easier to support architectures
  which can only perform atomic operations on very-well-aligned memory
  locations.  NOTE: This changes the size of struct simplelock, and
  will cause a version bump.
1999-07-27 21:29:15 +00:00
thorpej c0e24db820 Use wakeup_one() for waking up sleep lock sleepers. 1999-07-26 23:02:53 +00:00
thorpej 1bd7bb28ea Implement wakeup_one(), which wakes up the highest priority process
first in line for the specified identifier.  For use in places where
you don't want a Thundering Herd.

While here, add an optimization to wakeup() suggested by Ross Harvey.
1999-07-26 23:00:58 +00:00
wrstuden eeefc02aec Add VLAYER to tests which will cause VOP_REVOKE to be called in sys_revoke(). 1999-07-26 19:20:09 +00:00
darrenr 8b165c84f7 don't log an error for ktrace if it's EPIPE - an error that should be
expected with fktrace/ktruss (i.e the error is `noise').
1999-07-25 13:59:08 +00:00
thorpej ea8fb3e04a Turn the proclist lock into a read/write spinlock. Update proclist locking
calls to reflect this.  Also, block statclock rather than softclock during
in the proclist locking functions, to address a problem reported on
current-users by Sean Doran.
1999-07-25 06:30:33 +00:00
thorpej 50f9f26fe1 Add a spin lock mode to the lock manager. Provides a read/write
spin lock facility.  Some code and ideas from Ross Harvey.
1999-07-25 06:24:22 +00:00
tron d5442d74c5 Fix NULL pointer access. Patch supplied by Dave Huang in PR kern/8055. 1999-07-24 15:10:02 +00:00
thorpej 014078a731 Garbage collect. 1999-07-22 23:31:07 +00:00
thorpej 2860ae9b30 Add proclist locking where appropriate (forgot to commit this file previously). 1999-07-22 23:00:27 +00:00
thorpej 01a8cffe77 Add a read/write lock to the proclists and PID hash table. Use the
write lock when doing PID allocation, and during the process exit path.
Use a read lock every where else, including within schedcpu() (interrupt
context).  Note that holding the write lock implies blocking schedcpu()
from running (blocks softclock).

PID allocation is now MP-safe.

Note this actually fixes a bug on single processor systems that was probably
extremely difficult to tickle; it was possible that schedcpu() would run
off a bad pointer if the right clock interrupt happened to come in the
middle of a LIST_INSERT_HEAD() or LIST_REMOVE() to/from allproc.
1999-07-22 21:08:30 +00:00
thorpej e8485145c1 Rearrange some code slightly. 1999-07-22 18:28:30 +00:00
thorpej 2715b812d1 Rework the process exit path, in preparation for making process exit
and PID allocation MP-safe.  A new process state is added: SDEAD.  This
state indicates that a process is dead, but not yet a zombie (has not
yet been processed by the process reaper).

SDEAD processes exist on both the zombproc list (via p_list) and deadproc
(via p_hash; the proc has been removed from the pidhash earlier in the exit
path).  When the reaper deals with a process, it changes the state to
SZOMB, so that wait4 can process it.

Add a P_ZOMBIE() macro, which treats a proc in SZOMB or SDEAD as a zombie,
and update various parts of the kernel to reflect the new state.
1999-07-22 18:13:36 +00:00
thorpej 32e1fd0d03 Move the call of cpu_wait() out of the wait4() functions, and into the
body of reaper(), right before the call to uvm_exit().  cpu_wait() must
be done before uvm_exit() because the resources it frees might be located
in the PCB.
1999-07-20 21:54:05 +00:00
chs fce05250f9 more cleanup:
remove simplelockrecurse, lockpausetime and PAUSE():
none of these serve any purpose anymore.
in the LOCKDEBUG functions, expand the splhigh() region to
cover the entire function.  without this there can still be races.
1999-07-19 03:21:11 +00:00
chs 327e64d87b remove simplelockrecurse, it's no longer needed. 1999-07-19 03:17:42 +00:00
thorpej c581bf97c5 A few things to make the Linux clone(2) emulation work a bit better:
- When the exit signal is specified to be 0, don't just assume they
  meant SIGCHLD.  In the Linux world, this appears to mean "don't deliver
  an exit signal at all".
- Simplify P_EXITSIG(); don't check against initproc here, just change
  the exit signal to SIGCHLD if reparenting to initproc.

A very simple clone(2) test program now works, and the MpegTV package
starts, but doesn't run properly yet (I believe there is a separate
bug which keeps it from working properly).
1999-07-15 23:18:41 +00:00
wrstuden a0f2937049 Define VLAYER and make layered fs's set this flag when creating their vnodes.
getnewvnode now checks this bit, and it if's set makes sure a vnode's not
locked before removing it from the free list.

Closes PR 7954 by Alan Barrett <apb@iafrica.com>.
1999-07-15 21:30:31 +00:00
thorpej 5fdbf26214 Regen. 1999-07-12 23:01:47 +00:00
thorpej bee019244f Remove two lines that were apparently added by accident. 1999-07-12 23:01:27 +00:00
kleink dfa5aad003 Regen. 1999-07-12 22:04:00 +00:00
kleink e79a283e47 XSH5: change function signature to `void *sbrk(intptr_t)'. 1999-07-12 21:55:19 +00:00
sommerfeld c4fe7934c5 Fix kern/7944: getcwd permission checking was overly restrictive.
(Don't require start directory to have read permission).
1999-07-11 09:27:23 +00:00
thorpej f9a7668b3f defopt IPSEC and IPSEC_ESP (both into opt_ipsec.h). 1999-07-09 22:57:15 +00:00
wrstuden 379a26972f Modify file systems to deal with struct lock in struct vnode. All leaf
fs's other than nfs use genfs_lock() for locking.

Modify lookup routines to set PDIRUNLOCK when they unlock the parrent.
1999-07-08 01:05:58 +00:00
wrstuden 332bef3064 Regen to reflect WILLPUT & WILLUNLOCK syntax. 1999-07-07 23:33:50 +00:00
wrstuden 99a1c75bcb Update syntax to support WILLUNLOCK and WILLPUT syntax. Change calls which
really vput to indicate that rather than just WILLRELE.
1999-07-07 23:32:50 +00:00
ws 974de8f7f8 Handle misalignment in vmcmd_map_readvn and vmcmd_map_zero correctly. 1999-07-07 20:23:45 +00:00
thorpej 7b3258b6a7 Make the kthread API a bit more friendly to loadable kernel modules. 1999-07-06 21:44:09 +00:00
sommerfeld 140b1ee075 Housecleaning time:
Fix and document naming convention for vnode variables (always use
lvp/lvpp and uvp/uvpp instead of a hash of cvp, vpp, dvpp, pvp, pvpp).

Delete old stale #if 0'ed code at the end.

Change error path code in getcwd_getcache() slightly (merge common
cleanup code; shouldn't affect behavior any).
1999-07-04 20:16:57 +00:00
sommerfeld e303e2ee8b Fix kern/7906: race between unmount and getnewvnode()
mp->mnt_flags & MNT_MWAIT is replaced by mp->mnt_wcnt, and a new mount
flag MNT_GONE is created (reusing the same bit).

In insmntque(), add DIAGNOSTIC check to fail if the filesystem vnode
is being moved to is in the process of being unmounted.

getnewvnode() now protects the list of vnodes active on mp with
vfs_busy()/vfs_unbusy().

To avoid generating spurious errors during a doomed unmount, change
the "wait for unmount to finish" protocol between dounmount() and
vfs_busy().  In vfs_busy(), instead of only sleeping once, sleep until
either MNT_UNMOUNT is clear or MNT_GONE is set; also, maintain a count
of waiters in mp->mnt_wcnt so that dounmount() knows when it's safe to
free mp.

tested by running a "while :; do mount /d1; umount -f /d1; done" loop
against multiple find(1) processes.
1999-07-04 16:20:12 +00:00
sommerfeld 6f57fc7820 fix typo in previous 1999-07-04 06:17:52 +00:00
sommerfeld c7e5c39191 Don't permanently lose the async bit on an failed unmount 1999-07-04 06:16:29 +00:00
wrstuden b101a0685c Make fhopen use FILE_UNUSE, and don't leak file descriptors.
Patch from Jason Thorpe. Also should close PR 7889 from
Assar Westerlund <assar@sics.se> describing this problem.
1999-07-01 18:58:16 +00:00
itojun 118d2b1d4f IPv6 kernel code, based on KAME/NetBSD 1.4, SNAP kit 19990628.
(Sorry for a big commit, I can't separate this into several pieces...)
Pls check sys/netinet6/TODO and sys/netinet6/IMPLEMENTATION for details.

- sys/kern: do not assume single mbuf, accept chained mbuf on passing
  data from userland to kernel (or other way round).
- "midway" ATM card: ATM PVC pseudo device support, like those done in ALTQ
  package (ftp://ftp.csl.sony.co.jp/pub/kjc/).
- sys/netinet/tcp*: IPv4/v6 dual stack tcp support.
- sys/netinet/{ip6,icmp6}.h, sys/net/pfkeyv2.h: IETF document assumes those
  file to be there so we patch it up.
- sys/netinet: IPsec additions are here and there.
- sys/netinet6/*: most of IPv6 code sits here.
- sys/netkey: IPsec key management code
- dev/pci/pcidevs: regen

In my understanding no code here is subject to export control so it
should be safe.
1999-07-01 08:12:45 +00:00
itojun 9765602d90 add PR_LISTEN for UNIX domain socket, SOCK_STREAM case. 1999-07-01 07:59:57 +00:00
darrenr cd92b615fa fix sys_accept() to return EOPNOTSUPP for protocols which don't support
listen/accept (PR_LISTEN flag in protosw) and detect obvious faults in
parameters passed.  It is still possible for the address used for copying
the socket information to become invalid between that check and the copyout
so close the connection's allocated fd if the copyout fails so that we can
return EFAULT without allocating an fd and the application not knowing about
it.  Ideally we'd be able to queue the connection back up so a later accept
could retrieve it but unfortunately that's not possible.
1999-07-01 05:56:32 +00:00
is b4b3d042fd Only check for ETXTBSY if the access would otherwise be allowed.
Needed to fix pr4134.
1999-06-30 10:00:06 +00:00
fvdl 811a6162c3 Allow execution of shared objects. This is silly, but is allowed in,
for example, Solaris and Linux, and at least one Linux ldd implementation
even depends on it.
1999-06-29 23:39:06 +00:00
wrstuden 6e06666498 Add fhopen, fhstat, fhstatfs syscalls. Also move getfh in from the nfs
syscall code.
1999-06-29 22:18:47 +00:00
wrstuden a9e728797e regen. 1999-06-29 22:17:39 +00:00
wrstuden d55b282c54 Add fhopen, fhstat, fhstatfs. 1999-06-29 22:15:31 +00:00
ross d13c150e3b include <string.h> for memset(3) when compiling userland test setup 1999-06-27 06:18:33 +00:00
augustss 94b815050e Add powerhooks, i.e., the ability to register a function that will be
called when the machine does a suspend or resume.
XXX Will go away when Jason's kevents come to life.
1999-06-26 08:25:25 +00:00
kleink 7b67bca335 Add compile-time and run-time feature test knobs for the 1003.1 Mapped Files,
Process Memory Locking, Range Memory Locking and Memory Protection options.
1999-06-24 14:18:10 +00:00
sommerfeld c45e268d01 Fix PR7373 for real: Rearrange locking to avoid need for LOCKPARENT in lookup 1999-06-21 05:11:09 +00:00
sommerfeld 8d750c058f regen (no actual change, but comments in the master file changed) 1999-06-21 02:30:53 +00:00
sommerfeld 9bad197221 Correct comment about how LOCKPARENT affects VOP_LOOKUP 1999-06-21 02:28:46 +00:00
christos c029fe53c6 Fix umask inheritance problem introduced by the cwdi changes, whereby
children processes will not inherit the parent's umask but 022.
1999-06-20 08:54:13 +00:00
ragge 5ad2718e7c Add vax to user of device_register. 1999-06-20 00:51:37 +00:00
sommerfeld 1425b5931b Fix PR7761: clip overly large length rather than failing 1999-06-19 18:01:26 +00:00
thorpej bbf19ba181 Um, hi, let's initialize pointers before we use them. 1999-06-17 23:17:45 +00:00
thorpej 12347b2657 Make uvm_vslock() return the error code from uvm_fault_wire(). All places
which use uvm_vslock() should now test the return value.  If it's not
KERN_SUCCESS, wiring the pages failed, so the operation which is using
uvm_vslock() should error out.

XXX We currently just EFAULT a failed uvm_vslock().  We may want to do
more about translating error codes in the future.
1999-06-17 15:47:22 +00:00
thorpej ad528dfdf0 Regen. 1999-06-15 23:29:17 +00:00
thorpej 0cec533f77 Add mlockall at #242 and munlockall at #243. 1999-06-15 23:28:16 +00:00
christos e13d964178 Regen 1999-06-09 04:25:54 +00:00
christos 3f8f92f2b4 Add EXCL keyword as described in tech_kern, and fix comments. Make the
vtrace syscall UNIMPL because it is.
1999-06-09 04:25:30 +00:00
thorpej c146fe969e Regen. 1999-06-08 03:08:32 +00:00
thorpej 8b35c542b5 mincore: caddr_t -> void * 1999-06-08 03:07:39 +00:00
thorpej 84380f9fbe In sosend(), if so_error is set, clear it before returning the error to
the process (i.e. pre-Reno behavior).  The 4.4BSD behavior (introduced
in Reno) caused transient errors to stick incorrectly.

This is from PR #7640 (Havard Eidnes), cross-checked w/ FreeBSD, where
Bill Fenner committed the same fix (as described in a comment in the
Vat sources, by Van Jacobsen).
1999-06-08 02:39:57 +00:00
thorpej 1c5f2999b2 Make sure `olddelta' is a valid pointer before performing the guts of
the adjtime(2) system call.  Fixes PR #7721, Darren Reed.
1999-06-07 22:33:53 +00:00
thorpej d76e7b8c6d Don't pass a nam2blk around at all; just have setroot() and friends reference
dev_name2blk[] directly.  Addresses PR #7622 (ITOH Yasufumi), although
in a different way.
1999-06-07 20:16:08 +00:00
thorpej 4476366369 Make sure the regression test compiles. 1999-06-07 02:25:05 +00:00
pk 62cb666f4a Guard our global resource `phpool' against all interrupts. 1999-06-06 22:20:15 +00:00
pk 0e286f5c1f Guard our global resource `expool' against all interrupts. 1999-06-06 22:14:53 +00:00
thorpej 2c3dc83a64 Keep interrupt-safe maps on an additional queue. In uvm_fault(), if we're
looking up a kernel address, check to see if the address is on this
"interrupt-safe" list.  If so, return failure immediately.  This prevents
a locking screw if a page fault is taken on an interrupt-safe map in or
out of interrupt context.
1999-06-04 23:38:41 +00:00
lukem 5e76cbddfb in humanize_number(), when printing a u_int64_t, use '%qu' (unsigned long long)
instead of '%qd' (long long)
1999-06-02 05:53:56 +00:00
lukem 6a62a9cff3 sanity check bufcache before using it 1999-06-01 00:40:48 +00:00
thorpej e50ef977d1 Don't use a read lock on an intrsafe map; these maps can only use exclusive,
non-sleeping locks.
1999-05-28 19:40:09 +00:00
thorpej 2580d306ab Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags.  PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that.  INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now).  This will eventually
change now these maps are locked, as well.
1999-05-26 19:16:28 +00:00
thorpej 701868a6c8 Pass the appropriate access_type to uvm_vslock() for the given physio
operation: B_READ == VM_PROT_READ|VM_PROT_WRITE, B_WRITE == VM_PROT_READ.
1999-05-26 01:08:03 +00:00
thorpej 497248ca55 XXX Pass VM_PROT_NONE to uvm_vslock() as access_type. Why are we even
vslocking here?!  copyout() on its own seems to suffice just about everwhere
else, and it's not like the process is going to exit; it's in a system
call!
1999-05-26 01:07:06 +00:00
tron bb5689beb3 Only attempt to remove symbol table from DDB's lists of symbol tables
if we really loaded one.
1999-05-25 00:16:08 +00:00
thorpej ba2bc023f7 Call the mdcallback immediately after computing bufpages; bufpages may
need to be clipped, and this needs to be done before computing nbuf.
1999-05-21 00:05:12 +00:00
thorpej 3aa41b1b36 Make this actually work if the BUFCACHE option is not specified, by falling
back on the traditional BSD formula of 10% of first 2MB and 5% of remaining.
1999-05-20 20:01:28 +00:00
lukem 091ffad669 MI implementation of allocsys() 1999-05-20 05:59:52 +00:00
lukem 03b1725220 rework format_bytes() into a more generic humanize_number().
implement the former with the latter.
1999-05-20 05:58:19 +00:00
sommerfeld 6c63af182f Delete test code. 1999-05-15 22:37:22 +00:00
sommerfeld c01c0d9453 Revise previous fix:
1) protect socket flags under splsoftnet()
	2) avoid leaking memory on an error
1999-05-15 22:36:34 +00:00
tv fc3f28c6bd Wow, that was much easier than I originally thought. Fix PR kern/7583:
serious race condition in sosend().  Upon closer inspection, the appropriate
flags are checked within splsoftnet() for soreceive(), so no change needed
there.  Also a little KNFing in sosend().
1999-05-15 16:42:48 +00:00
thorpej c10a926030 Allow the caller to specify a stack for the child process. If NULL,
the child inherits the stack pointer from the parent (traditional
behavior).  Like the signal stack, the stack area is secified as
a low address and a size; machine-dependent code accounts for stack
direction.

This is required for clone(2).
1999-05-13 21:58:32 +00:00
thorpej a6c810d72a Fix a (currently) harmless brian-o in last. 1999-05-13 17:28:30 +00:00
thorpej 5d97669cfe Allow an alternate exit signal (i.e. not SIGCHLD) to be delivered to the
parent, specified at fork time.  Specify a new flag to wait4(2), WALTSIG,
to wait for processes which use an alternate exit signal.

This is required for clone(2).
1999-05-13 00:59:03 +00:00
drochner 4a60ccd128 fix 2 problems with subregion allocation:
-a subregion start was ignored if all previous allocations were before
the subregion, reported by Lennart Augustsson in PR kern/7539
-an existing allocation which overlaps the beginning of the subregion
was ignored (ie overlapped) if is is not the last allocation
1999-05-11 11:02:54 +00:00
thorpej 6c37e2b392 Make sure page allocations are counted everywhere that they need to be. 1999-05-10 21:15:42 +00:00
thorpej 4b6d8943c2 Improve the pool allocator's diagnostic helpers, adding the ability to
log on a per-pool basis, reentrancy checking, and dumping various pool
information from DDB.
1999-05-10 21:13:05 +00:00
lukem 719cd63d24 Implement format_bytes(), which pretty prints a given u_int64_t into a
given buffer, and if necessary, reducing the display width of the
number to fit in the buffer by increasing the units (from kilobytes
(2^10) through to exabytes (2^60)).
1999-05-09 13:48:44 +00:00
tv 4c9c896cc8 FILE_UNUSE wasn't updated in the FDSCRIPTS block. 1999-05-07 17:38:41 +00:00
christos e649afd171 Add NTFS for the compat names. 1999-05-06 17:11:04 +00:00
thorpej e3669c3393 Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
1999-05-05 20:01:01 +00:00
thorpej 4913e22a19 Fix alignment problem in the garbage-collection code path. 1999-05-05 19:05:43 +00:00
christos a32f7169fc Align struct timeval time to the same alignment requirements of a quad.
This broke the sparc elf kernel which in microtime uses ldd to load both
words at the same time. The a.out kernel, just got lucky.
1999-05-04 16:16:54 +00:00
sommerfe c0d15c5c7c Count lockmgr locks held by process if LOCKDEBUG || DIAGNOSTIC.
(previously, it was just under LOCKDEBUG).
1999-05-04 15:58:53 +00:00
cgd 1bce8c40fc ep_arglen is in units of 'sizeof (char *)', not in units of bytes. use
howmany(value, sizeof (char *)) to get the right value.
1999-04-30 23:02:06 +00:00
thorpej 645d5bd5f6 Share everything with proc0. 1999-04-30 21:40:30 +00:00
thorpej b699afcb5b Pay attention to FORK_SHARECWD, FORK_SHAREFILES, and FORK_SHARESIGS. 1999-04-30 21:39:51 +00:00
thorpej 2835fc6e46 Pull signal actions out of struct user, make them a separate proc
substructure, and allow them to be shared.

Required for clone(2).
1999-04-30 21:23:49 +00:00
thorpej 882d9195a3 Oops, forgot to commit this one. Free the cwdinfo on exit. 1999-04-30 20:54:04 +00:00
thorpej 16936c9565 Break cdir/rdir/cmask info out of struct filedesc, and put it in a new
substructure, `cwdinfo'.  Implement optional sharing of this substructure.

This is required for clone(2).
1999-04-30 18:42:58 +00:00
cgd ee94a4dacb add checks for COMPAT_OSF1 in the appropriate places 1999-04-30 05:29:20 +00:00
scottr 3d5c979e43 Pull in opt_poollog.h for POOL_LOGSIZE. 1999-04-29 17:47:19 +00:00
cgd e85db685e9 * don't have the [onz]magic setup functions set up the stack.
* add arguments describing the vnode and ecoff header of the executable
  being set up to the [onz]magic setup functions.
* export the stack setup function and the [onz]magic setup functions.
* call the MD ecoff hook _before_ the [onz]magic and stack setup
  functions, and bail out early if the MD hook sets up vmcmds.
1999-04-27 05:36:43 +00:00
cgd 5338149302 correct comment: turn off set-id if MNT_NOSUID is set, not MNT_NOEXEC. 1999-04-27 05:28:44 +00:00
thorpej 3d23eb3ce3 More improvements to mbuf and mbuf cluster allocation:
- Initialize mbpool and mclpool with msize and mclbytes, respectively,
so that those values may be patched and have an actual affect on the
next system reboot.

- Set low water marks on mbpool (default: 16) and mclpool (default: 8).
This should be of great help for diskless systems, which need to allocate
mbufs in order to clean dirty pages; the low water marks increase the
chances of this being possible to do in memory starvation situations.

- Add support for getting/setting some mbuf-related parameters via sysctl.
* msize and mclsize (read-only)
* nmbclusters (read-only unless the platform has direct-mapped pool pages,
in which case the value can be increased).
* mblowat and mcllowat (read/write)
1999-04-26 22:04:28 +00:00
thorpej 879070ef90 Add support for the kern.mbuf sysctl node. 1999-04-26 21:56:23 +00:00
is af3d525792 Fix adosfs's locking panic 1999-04-26 20:33:18 +00:00
simonb a560bdeeec Use the nmbclusters variable and not the NMBCLUSTERS constant when setting
the mclpool hardlimit.
1999-04-25 03:03:03 +00:00
simonb 5d8b1ef3e4 g/c REAL_CLISTS. 1999-04-25 02:56:26 +00:00
simonb 8ce41be7b0 Move inclusion of "opt_sb_max.h" from sys/socketvar.h to
conf/param.c, and move the initialisation of the sb_max
variable from kern/uipc_socket2.c to conf/param.c.  Now
everthing that includes sys/socketvar.h doesn't get
recompiled when SB_MAX's value changes.
1999-04-22 04:50:05 +00:00
mrg 48c12bfeed revert previous. oops. 1999-04-21 02:37:07 +00:00
mrg 58540a2274 properly test the msgsz as "msgsz - len". from PR#7386 1999-04-21 02:31:49 +00:00
gwr 9b055e8c43 minor nits -- replace vsprintf with vsnprinf 1999-04-12 00:24:17 +00:00
gwr 8946cf4be4 minor nits -- strncpy into p->p_comm 1999-04-12 00:22:08 +00:00
kleink bff1bef006 * Add a comment to ktrgetheader() mentioning that ktr_len and ktr_buf are
being left uninitialized intentionally; addresses PR kern/6987.
* In ktrsysret(), initialize the unused ktr_eosys to avoid writing random junk.
1999-04-11 18:44:00 +00:00
wrstuden 2e1fa90ecb Fix obscure bug in namei(), which was the cause of PR 7306.
The problem is that if "sl" is a symbolic link, a lookup on "sl/"
will be flagged as the last component. Thus VOP_LOOKUP will lock
the parent directory if LOCKPARENT is set. In order for the symbolic
link to be resolved, this lock needs to be released. namei() would
test for this by checking if ni_pathlen == 1, which it wouldn't as
"/" is left in the name, and namei() would not unlock the parent.
The next call to lookup() to resolve the symbolic link would fail
as the parent was still locked.
1999-04-07 05:47:37 +00:00
thorpej b2741be06e More locking protocol fixes. Protect pool_head with a spin lock (statically
initialized).  This lock also protects the "next drain candidate" pointer.

XXX There is still one locking protocol problem, which should not be
a problem in practice, but is still marked as an issue in the code anyhow.
1999-04-06 23:32:44 +00:00
sommerfe c97bb0650d Fix compile warning (not seen with egcs, but...) 1999-04-05 03:33:31 +00:00
chs c109816333 Undo the part of the last revision about pr_rmpage() referencing
a data structure after it was freed.  This wasn't actually a problem,
and the change caused the wrong pool_item_header to be freed
in the non-PR_PHINPAGE case.
1999-04-04 17:17:31 +00:00
thorpej 4fd2edfbe8 mbinit() can now allocate memory. Update a comment accordingly. 1999-04-01 00:23:25 +00:00
thorpej c431ebc42f Call cpu_startup() immediately after uvm_init(), but before mbinit().
Call configure() directly immediately after config_init().

This causes autoconfiguration to happen at the same time as before, but
creates some kernel submaps earlier, so that e.g. mbinit() can now
allocate memory.
1999-04-01 00:22:45 +00:00
thorpej 278e7ae222 Yet more fixes to the pool allocator:
- Protect userspace from unnecessary header inclusions (as noted on
current-users).

- Some const poisioning.

- GREATLY simplify the locking protocol, and fix potential deadlock
scenarios.  In particular, assume that the back-end page allocator
provides its own locking mechanism (this is currently true for all
such allocators in the NetBSD kernel).  Doing so allows us to simply
use one spin lock for serialized access to all r/w members of the pool
descriptor.  The spin lock is released before calling the back-end
allocator, and re-acquired upon return from it.

- Fix a problem in pr_rmpage() where a data structure was referenced
after it was freed.

- Minor tweak to page manaement.  Migrate both idle and empty pages
to the end of the page list.  As soon as a page becomes un-empty
(by a pool_put()), place it at the head of the page list, and set
curpage to point to it.  This reduces fragmentation as well as the
time required to find a non-empty page as soon as curpage becomes
empty again.

- Use mono_time throughout, and protect access to it w/ splclock().

- In pool_reclaim(), if freeing an idle page would reduce the number
of allocatable items to below the low water mark, don't.
1999-03-31 23:23:47 +00:00
mycroft f145c291bd If copyout() fails, make sure to unbusy the mount point before returning. 1999-03-31 19:18:45 +00:00
mycroft 0622545249 Previous change to vn_lock() was bogus. If we got EDEADLK, it was from
lockmgr(), and it already unlocked v_interlock.  So, just return in this case.
1999-03-31 18:30:13 +00:00
thorpej 98d006d2c6 Set a hard limit (rather than an advisory high water mark for pages) of
NMBCLUSTERS for the mbuf cluster pool.  On platforms which use direct-mapped
segments for pool pages (MIPS and Alpha), this makes NMBCLUSTERS actually
meaningful (such ports don't even allocate mb_map, as it is not used to
map mbuf cluster pages).

Improve the message logged at a maximum rate of once per second.  The
new message: "WARNING: mclpool limit reached; increase NMBCLUSTERS".

In the back-end pool page allocator, remove the message about mb_map
being full.  The message was not necessarily correct as the allocator
may have been starved for pages, rather than for space in the map.  Also,
the hard limit on the mbuf cluster pool will be reached before the map
fills (the last cluster will always fit into the map), so the message
is redundant.

Add a comment in mbinit() about considering setting low water marks on
the mbuf and mbuf cluster pools.
1999-03-31 01:26:40 +00:00
thorpej d4d4e314e9 Fix several bugs/deficiencies in the pool allocator:
- Add support for hard limits, with optional rate-limited logging of
a warning message when the pool limit is reached.  (This will be used
to fix a bug in mbuf cluster allocation on the MIPS and Alpha ports.)

- Fix some locking protocol errors.  This required splitting pr_flags
into pr_flags (which is protected by the spin lock) and pr_roflags (which
are `read only' flags, set when the pool is initialized, and never changed
again; these do not need to be protected by a mutex).

- Make the low water support actually mean something.  When a low water
mark is set, add free items to the pool until the low water mark is
reached.  When an item allocation causes the number of free items to
drop below the low water mark, make the pool catch up to it.  This can
make the pool allocator more useful for several applications (e.g.
pmap `pv entry' management) and more robust for others (for e.g. mbuf
and mbuf cluster allocation, so that the pagedaemon can use NFS to clean
pages on diskless systems without completely running dry on buffers to
receive packets in during extreme memory shoratages).

- Add a comment where we sleep waiting for more pages for the back-end
page allocator.  Specifically, instead of sleeping potentially forever,
perhaps we should just wake up once a second to try allocating a page
again.  XXX Revisit this soon.
1999-03-31 01:14:06 +00:00
wrstuden bd2d8363bc The mode for a node is a mode_t in both struct stat and struct vattr -
don't use a u_short for intermediate storage in vn_stat.
1999-03-30 00:16:44 +00:00
kleink 2304549e9f Sync __getlogin()'s namelen argument with the libc-internal declaration
(u_int vs. size_t).
1999-03-28 17:34:33 +00:00
kleink 1c35ac8f6b Regen. 1999-03-28 17:32:51 +00:00
kleink 38c7f65f0c Sync __getlogin()'s namelen argument with the libc-internal declaration
(u_int vs. size_t).
1999-03-28 17:29:52 +00:00
eeh 69d1f9d0d3 COMPAT_SPARC32 -> COMPAT_NETBSD32 1999-03-26 04:29:20 +00:00
thorpej c647f127c1 Assign initproc in main(), not start_init(). It's conventient to do so. 1999-03-26 01:10:50 +00:00
sommerfe ef07055d58 Disallow tracing of processes unless tracer's root directory is at or
above tracee's root directory.
1999-03-25 04:45:56 +00:00
nathanw e8b935d003 Garbage collect a non-useful variable in getcwd_scandir(). 1999-03-25 02:32:18 +00:00
sommerfe f1a508e354 Prevent deadlock cited in PR4629 from crashing the system. (copyout
and system call now just return EFAULT).  A complete fix will
presumably have to wait for UBC and/or for vnode locking protocols to
be revamped to allow use of shared locks.
1999-03-25 00:20:35 +00:00
mrg d2397ac5f7 completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
1999-03-24 05:50:49 +00:00
lukem 8a931fcdd8 Ensure that you can only bind a more specific address when it is done by the
same uid or by root.

This code is from FreeBSD. (Whilst it was originally obtained from OpenBSD,
FreeBSD fixed it to work with multicast. To quote the commit message:
    - Don't bother checking for conflicting sockets if we're binding to a
      multicast address.
    - Don't return an error if we're binding to INADDR_ANY, the conflicting
      socket is bound to INADDR_ANY, and the conflicting socket has
      SO_REUSEPORT set.
)
1999-03-23 10:45:37 +00:00
thorpej 845b609f97 Set the high water mark on the mbuf cluster pool to NMBCLUSTERS. 1999-03-23 02:51:27 +00:00
thorpej 9614a68c70 Fix the order of arguments to roundup(). 1999-03-23 02:49:03 +00:00
thorpej f2a91c9b91 Put back the code to log `mb_map full' that was lost when mbuf clusters
were converted to use the pool allocator.
1999-03-22 22:06:58 +00:00
sommerfe 098b6f8e8a Disallow descriptor-passing of descriptors which are open on
directories which aren't under the recipient's root.

Clean up of many error conditions involving descriptor passing, to
eliminate infinite loops, panics, premature garbage collection of
sockets, and descriptor leaks:
 - Avoid letting unp_gc() see descriptors with a refcount of zero by
removing them from the socket's queue before releasing them.
 - Avoid socket leak in PRU_ABORT (this will also gc descriptors queued
on a not-yet accepted socket when the accepting socket goes away).
 - Put in block comment explaining how unp_gc() should work.
 - Correctly manage unp_defer count so we don't get stuck in an infinite
loop with nothing to do.
 - Don't tie MARK and DEFER bits so closely together.
 - Mark descriptors queued on not-yet-accepted sockets as well.
 - Don't call sorflush on non-socket, it doesn't work very well.
 - Deal with discard of NULL file pointer.
 - Hopefully cause GC to converge faster by only deferring sockets in
unp_mark().
1999-03-22 17:54:38 +00:00
sommerfe 2f0f84b8e8 bug fix to fdavail: be consistent about taking per-process descriptor
limit into account when checking against the limit; fdp->fd_nfiles may
be greater than the current descriptor limit, and there may be space
in fdp->fd_ofiles beyond the limit.  If we say it's available,
unp_externalize will get confused and panic when fdalloc fails.
1999-03-22 17:39:44 +00:00
sommerfe 36dc99adac vinvalbuf, called from vclean, could cause a locking-against-self
deadlock in VOP_FSYNC() if the unreferenced vnode picked for
reclamation happened to be stacked on top of a vnode the process
already had locked.  This could happen if the same filesystem was
accessed both through a union mount and directly; it seemed to happen
most frequently when the direct access was through NFS.

Avoid this deadlock by changing vinvalbuf to pass a new FSYNC_RECLAIM
flag bit to VOP_FSYNC() to indicate that a reclaim is in progress and
only a `shallow' fsync is necessary.

Do nothing in *_fsync() in umapfs, nullfs, and unionfs when
FSYNC_RECLAIM is set; the underlying vnodes will shortly be released
in *_reclaim and may be reclaimed (and fsync'ed) later.
1999-03-22 17:24:19 +00:00
sommerfe 6d0f67d6aa Regen files based on changes to syscalls.master, vnode_if.src (latter
was changes to comments only, but..)
Build vfs_getcwd.c as standard part of kernel.
Add implementation of fchroot(), since two emulations already had it.
Call vn_isunder() in fchdir(), chroot(), and fchroot() to make it harder
to escape chroot().
1999-03-22 17:13:34 +00:00
sommerfe 095cd96cd5 Change namei cache to record vnode->(parent,name) entries (for directories).
Add kernel implementation of getcwd() which uses this cache, falling
back to reading the filesystem on a cache miss.
Along for the ride: add new VOP_FSYNC flag FSYNC_RECLAIM indicating
that a reclaim is being done, so only a "shallow" fsync is needed.
1999-03-22 17:01:55 +00:00
sommerfe 75fb6d661f Include some comments with more details on the VOP_LOOKUP locking protocol 1999-03-22 16:57:37 +00:00
bouyer 87662a89a2 Hinherit MNT_NOEXEC from the mount point. Without this a user can exec
arbitrary binaries by doing a user mount, even if the admin has carefully
setup his system to avoid arbitrary binaries execution.
1999-03-17 15:35:03 +00:00
kleink 51be278873 Defopt COMPAT_M68K4K. 1999-03-09 21:02:38 +00:00
mycroft f3df26f6f3 This is sort of gratuitous, but...
Strip the leading path off of init's argv[0].
1999-03-05 07:26:21 +00:00
fvdl 31289a4af8 Fill in vnodecovered in the mount structure before calling VFS_MOUNT anyway,
some things (e.g. unionfs) may depend on it. It's currently ok
for vnodecovered to be set already; it's not for v_mountedhere in
the vnode, though.

From John Darrow.

XXX should probably just extend VFS_MOUNT to take the vnode pointer as
an argument.
1999-03-02 07:47:49 +00:00
ross e47e3c9f45 schedclk() -> schedclock(), for consistency with hardclock(), statclock(), ...
update comments for recent scheduler mods
1999-02-28 18:14:57 +00:00
fvdl c0fb2ab4f2 Use a SETRECURSE lock before calling VFS_MOUNT in the mount() system call,
since the lock may be taken again. This was the intention of the CANRECURSE
lock already there, but didn't work.

Only fill in the vnode<->mountpoint links (mountedhere and vnodecovered)
after VFS_MOUNT returned succesfully. It might happen that something called
from VFS_MOUNT mistook the vnode for an already successfully mounted on
one because of this.
1999-02-28 14:12:54 +00:00
fvdl 080ad305ff Recursive locks were previously only available with LK_CANRECURSE. This
could be done in one of 2 ways:

	* call lk_init with LK_CANRECURSE, resulting in a lock that
 	  always can be used recursively.
	* call lockmgr with LK_CANRECURSE, meaning that it's ok if this
	  lock is already held by us.

Sometimes we need a locking type that says: take this lock now, exclusively,
but while I am holding it, I may go through a code path which could attempt
to get the lock again, and which is unaware that the lock might already
be taken.  Implement LK_SETRECURSE for this purpose. Assume that locks and
unlocks come in matching pairs (they should), and check for this 'level'
using SETRECURSE locks.
1999-02-28 14:09:15 +00:00
wrstuden 0078fc50dc Modify VOP_CLOSE vnode op to always take a locked vnode. Change vn_close
to pass down a locked node. Modify union_copyup() to call VOP_CLOSE
locked nodes.

Also fix a bug in union_copyup() where a lock on the lower vnode would
only be released if VOP_OPEN didn't fail.
1999-02-26 23:38:55 +00:00
christos 88162a0fe9 Make this compile without EXEC_AOUT and with COMPAT_FREEBSD 1999-02-23 18:19:29 +00:00
mycroft d4955ba8a9 While I'm on a fixed point kick, improve the NTP clock factor correction to
give <.1% error in all (supported) cases.  It doesn't cost us much.
1999-02-23 17:41:48 +00:00
ross 6803dbddbb Replace the recent scheduler mods with calls to scheduler_{fork,wait}_hook(),
(inlined) so scheduler functionality can be kept in a single .h/.c set.
Also, the wait hook has changed the way it clips the scheduler history.
1999-02-23 02:57:18 +00:00
ross b4a33c4e60 Scheduler bug fixes and reorganization
* fix the ancient nice(1) bug, where nice +20 processes incorrectly
  steal 10 - 20% of the CPU, (or even more depending on load average)
* provide a new schedclk() mechanism at a new clock at schedhz, so high
  platform hz values don't cause nice +0 processes to look like they are
  niced
* change the algorithm slightly, and reorganize the code a lot
* fix percent-CPU calculation bugs, and eliminate some no-op code

=== nice bug === Correctly divide the scheduler queues between niced and
compute-bound processes. The current nice weight of two (sort of, see
`algorithm change' below) neatly divides the USRPRI queues in half; this
should have been used to clip p_estcpu, instead of UCHAR_MAX.  Besides
being the wrong amount, clipping an unsigned char to UCHAR_MAX is a no-op,
and it was done after decay_cpu() which can only _reduce_ the value.  It
has to be kept <= NICE_WEIGHT * PRIO_MAX - PPQ or processes can
scheduler-penalize themselves onto the same queue as nice +20 processes.
(Or even a higher one.)

=== New schedclk() mechansism === Some platforms should be cutting down
stathz before hitting the scheduler, since the scheduler algorithm only
works right in the vicinity of 64 Hz. Rather than prescale hz, then scale
back and forth by 4 every time p_estcpu is touched (each occurance an
abstraction violation), use p_estcpu without scaling and require schedhz
to be generated directly at the right frequency. Use a default stathz (well,
actually, profhz) / 4, so nothing changes unless a platform defines schedhz
and a new clock.  Define these for alpha, where hz==1024, and nice was
totally broke.

=== Algorithm change === The nice value used to be added to the
exponentially-decayed scheduler history value p_estcpu, in _addition_ to
be incorporated directly (with greater wieght) into the priority calculation.
At first glance, it appears to be a pointless increase of 1/8 the nice
effect (pri = p_estcpu/4 + nice*2), but it's actually at least 3x that
because it will ramp up linearly but be decayed only exponentially, thus
converging to an additional .75 nice for a loadaverage of one. I killed
this, it makes the behavior hard to control, almost impossible to analyze,
and the effect (~~nothing at for the first second, then somewhat increased
niceness after three seconds or more, depending on load average) pointless.

=== Other bugs === hz -> profhz in the p_pctcpu = f(p_cpticks) calcuation.
Collect scheduler functionality. Try to put each abstraction in just one
place.
1999-02-23 02:56:03 +00:00
drochner 220b8d9add PR kern/7033 (Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>): use
device minor to unit/partition macros from sys/disklabel.h
1999-02-22 16:00:01 +00:00
cjs d390501801 Safer use of printf. 1999-02-22 00:12:36 +00:00
mycroft bb815bda9e Fix a thinko in the previous.
Also:
* Do the boundary check when creating a new region as well.
* If we crossed the boundary, don't just throw away the region; lop off the
  beginning and see if we still fit.
SB16 is now fully functional on the Alpha.
1999-02-18 18:52:29 +00:00
mycroft ca00239fe9 Speed up the calculation of dontcross; use EXTENT_ALIGN to calculate it
directly rather than using a loop.  Also adjust so that we can allocate at
the end of the integer range.
1999-02-18 18:13:50 +00:00
christos 1aede0624c Now that shell has been fixed so that ". filename" does not look at . if .
is not in the path add ./ to the files.
1999-02-17 18:17:10 +00:00
christos ac66b8f92d Don't forget to lower the spl in the error case of sigprocmask 1999-02-13 15:25:51 +00:00
veego 8b48b6c4af Protect the COMM variable with an '.ifmake tags' to stop the long delay
while doing a make in src/sys/arch/* on slow machines.
1999-02-12 19:52:30 +00:00
cjs 1caabb110e Don't hardware /sys, use $SYSDIR if it exists. This should still be looked
at, though; should we be using relative paths instead?
1999-02-12 04:58:18 +00:00
thorpej 94962b67c7 Fix some printf format problems on Alpha. 1999-02-12 00:46:11 +00:00
christos be58edf2b6 Add compat_aout bit. 1999-02-11 09:35:21 +00:00
christos 7f718b612a Print the line that caused the error message. Unfortunately the line
numbers reported by awk are not useful, because the \$ preprocessing
by sed...
1999-02-11 09:32:01 +00:00
kleink 5dfcd3c125 Regen: socklen_t changes. 1999-02-10 18:05:24 +00:00
explorer c3167035de no need to set tailp twice. 1999-02-10 18:03:05 +00:00
kleink dfffb2f357 * Due to addition and use of socklen_t, make the socket option and address
arguments passed to accept(), bind(), connect(), getpeername(), getsockname(),
getsockopt(), recvfrom(), sendto() and sendmsg() unsigned, which also elimiates
a few casts.
* Reflect the (now) signedness of msg_iovlen, which necessiates the addition
of a few casts.
1999-02-10 18:02:28 +00:00
kleink f69591d12d Use of casts as lvalues is a GNU C extension; rearrange slightly. 1999-02-10 17:03:26 +00:00
christos fe1f028894 PR/6962: Paul Shupak: FreeBSD elf support. 1999-02-09 20:35:04 +00:00
wrstuden d0ab43c887 Oops. Need to have VOP_LOCK before calling uvm_vnp_terminate, not after
(comments and code inspection in uvm_vnp_terminate agree on this).
1999-02-09 01:57:05 +00:00
jonathan c9d036d796 defopt MEMORY_DISK_{HOOKS,SERVER,IS_ROOT}. 1999-02-07 09:34:58 +00:00
explorer 47bc7c51b7 rewrite usage of tailp slightly, to convince gcc that it really isn't used
initialized.
1999-02-06 11:57:35 +00:00
msaitoh de35d7228d fix compiler warning 1999-02-03 01:16:20 +00:00
msaitoh a01e3cd255 Implement [v]snprintf() 1999-01-28 00:05:49 +00:00
drochner 846db6691a make console_debugger() a macro - no need to waste a stackframe 1999-01-26 17:05:41 +00:00
kleink 88cb9dd89c Adapt the System V behaviour of a child process inheriting its parent's
ucontext link but still reset it on exec().
1999-01-25 16:00:06 +00:00
sommerfe 31a1ef68c7 Tweak to earlier fix to p_estcpu:
- no longer conditionalized
	- when traced, charge time to real parent, not debugger
	- make it clear for future rototillers that p_estcpu should be moved
	  to the "copy" region of struct proc.
1999-01-23 22:23:19 +00:00
sommerfe 068dd91745 Under control of "slowchild" global, make child process inherit the
scheduling penalty for being cpu-bound (p_estcpu) of its parent.
1999-01-23 17:02:35 +00:00
ross d8d8301934 Fix the recently infamous "sucky performance" problem by charging wait(2)'ing
parents for children's p_estcpu. I think this problem has always been there.
It's particularly noticable with X because the server builds up non-trivial
CPU, and hence, non-trivial p_estcpu scheduler penalty. The repeatedly
forked children were always starting from scratch and receiving a scheduler
preference.
1999-01-23 08:25:36 +00:00
kleink fe2f7c1f64 Indentation nit. 1999-01-22 20:51:04 +00:00
chs 3bd133da7d no need to do locking in extext_destroy(). 1999-01-22 07:57:59 +00:00
chs 5819a5d0f4 fix an off-by-one space-waster in hashinit() and add some description. 1999-01-22 07:57:13 +00:00
chs 254ae63e2c avoid math on void *. 1999-01-22 07:55:49 +00:00
chs 33c042b6a2 print a little more info in simple_lock_freecheck(). 1999-01-22 07:55:17 +00:00
mycroft 808496666c Do remove sockets on so_q0, since select(2) and accept(2) do not (currently?)
return them.
1999-01-21 22:09:10 +00:00
christos 198f0a3f56 Fix initialization of resource limits for number of files and number
of processes:
- Don't initialize rlim_max to RLIM_INFINITY. The limits for those should
  be maxfiles and maxproc respectively. Programs expect getrlimit to
  return reasonable values, so that they can allocate structures (for
  example jdk does this).
- Don't initialize rlim_cur to NOFILE and MAXUPRC respectively, but to
  min(NOFILE, maxfiles) and min(MAXUPRC, maxproc) respectively.
1999-01-21 14:50:41 +00:00
mycroft 0fb75f560a Oops; previous was slightly broken. 1999-01-20 20:24:12 +00:00
mycroft 430ecf369d Do not remove sockets from the accept(2) queue on close. 1999-01-20 09:15:41 +00:00
chuck 4ef779d5e5 MNN is no longer optional 1999-01-16 21:06:44 +00:00
sommerfe 324ea43975 Fix format mismatch which only turns up when building with DEBUG 1999-01-15 22:02:59 +00:00
thorpej 54cabada51 Garbage-collect some straggling netimp stuff. 1999-01-14 01:14:01 +00:00
sommerfe 114c430bbb Allow lkm's to include symbols for use by DDB. 1999-01-13 23:06:28 +00:00
thorpej e598335d1c Garbage-collect `mbutl'. 1999-01-09 22:10:12 +00:00
thorpej 99d93cb85e Garbage-collect `union mcluster' and `mclfree'. 1999-01-09 21:54:07 +00:00
lukem 0e36738ca6 add copyright 1999 1999-01-06 13:51:09 +00:00
christos 6434d50bd2 Fix 3 problems with the new signature code:
- don't set position to 0, set it to NO_ADDR (cgd)
- no need to malloc size + 1 bytes (cgd)
- fix calculation of minimum note size section.
1999-01-06 11:52:53 +00:00
erh 2f64a3eccc Protect the syscallargs header file with a define. 1999-01-03 04:25:26 +00:00
thorpej e1315a2447 Make this compile with POOL_DIAGNOSTIC, and add a POOL_LOGSIZE option.
Defopt these.
1998-12-27 21:13:43 +00:00
christos 27e4ef39db Add support for parsing OS type note fields. 1998-12-23 15:08:37 +00:00
kleink 7d144777a3 #ifdef __STDC__ -> #if __STDC__ 1998-12-22 21:21:36 +00:00
thorpej 943f7cd0e7 In unp_internalize(), add a comment explaining why we must ALIGN() the
data after the cmsghdr when accessing internalized SCM_RIGHTS messages
(i.e. array of struct file *s).  The historic interface does not align
the externalized SCM_RIGHTS messages (i.e. array of ints).
1998-12-21 23:12:19 +00:00
thorpej 992f3b8ea7 Fix a fencepost error in unp_scan() which caused a bad pointer deref on
the SPARC platform only (ILP32 but ALIGNBYTES of 7), due to a missing
ALIGN().
1998-12-21 23:03:02 +00:00
thorpej 489d6d0e46 Reverse the stopgap change made in revision 1.29:
date: 1998/08/01 01:47:24;  author: thorpej;  state: Exp;  lines: +18 -8
Don't call the protocol drain routines if how == M_NOWAIT, which typically
means we're in interrupt context.  Since we can be called from a network
hardware interrupt, we could corrupt the protocol queues we try to drain
them at that time.

The problem has been addressed by letting the drain'able protocols use
a locking scheme to prevent queue corruption.
1998-12-18 21:40:14 +00:00
drochner 8ece294afc COMPAT_xxx option review: add missing opt_compat_linux.h
alpha -> __alpha__
1998-12-18 14:10:06 +00:00
drochner c22ef79250 solve the COMPAT_OLDSOCK/MSG_COMPAT problem differently:
The source files which need MSG_COMPAT define COMPAT_OLDSOCK.
1998-12-18 13:18:42 +00:00
briggs 4a01b776e5 Prototype pool_print() and pool_chk() if DEBUG.
Initialize pool hash table with PR_HASHTABSIZE (i.e., 8) LIST_INIT()s
instead of one memset().
Only check for page != ph->ph_page if PR_PHINPAGE is set (in pool_chk()).
Print pool base pointer when reporting page inconsistency in pool_chk().
1998-12-16 04:28:23 +00:00
thorpej 2ef3bcfbb8 In the sosend() loop, if the residual count is > 0 before calling PRU_SEND,
set SS_MORETOCOME as a hint to the lower layer that more data is coming
on the next iteration of the loop.  Clear the flag after the PRU_SEND
call.

Suggested by Justin Walker <justin@apple.com> on the freebsd-net
mailing list.
1998-12-16 00:26:10 +00:00
christos 32b0dc0fbd Regen 1998-12-10 16:44:16 +00:00
christos bee9dafdf5 defopt COMPAT_43 1998-12-10 15:07:01 +00:00
pk 1673c21984 Enable `device_register()' for the sparc. 1998-12-03 23:50:11 +00:00
thorpej d90b3d3438 Add dump_kmemstats(), callable from DDB to show kmem statistics. From
Chuck Silvers via Chuck Cranor.
1998-12-02 20:35:28 +00:00
bouyer c2912048fc Cosmectic change in a panic(), so that the panic string printed by savecore
has more meaning.
1998-12-02 10:41:01 +00:00
kenh b519a199d6 Pass MNT_NODEVMTIME flag to lower VFS layer. 1998-12-01 23:17:25 +00:00
kleink abd228c31c Regen: getpgid() prototype change. 1998-11-26 16:13:56 +00:00
kleink 5eb7ae9656 getpgid(2) returns a value of type pid_t. 1998-11-26 16:07:05 +00:00
mycroft 74ad07cef5 Revert the functional change in rev 1.38; permit a msg_iovlen of 0.
There are two reasons for this:
* We should be able to pass file descriptors without sending any data.
* We could send zero-length iovecs anyway (but we shouldn't have to do this).
Also, msg_iovlen is already a u_int, so delete a bunch of casts.
1998-11-26 02:25:20 +00:00
castor 813222c472 Allow pattern matching for symbol string to handle GCC's output for mips,
where strings are output as
	.ascii	"foo\000"
instead of
	.ascii	"foo\0"
1998-11-25 06:10:19 +00:00
thorpej eb8f1afb3e Implement vdevgone(), to revoke all vnodes corresponding to the specified
type, major, (low minor...high minor).
1998-11-18 20:24:59 +00:00
thorpej f50fecdeaf Oops, fix uninitialzed variable in last. 1998-11-18 18:40:54 +00:00
thorpej 587f931901 Be a bit more precise about how we allow no deactivation support in
config_detach().
1998-11-18 18:40:08 +00:00
thorpej 3579ddab03 If the ca_activate entry point fails, make sure to restore the old
dv_flags.
1998-11-18 18:38:07 +00:00
thorpej ab1b371163 Implement config_detach(), mostly from Chris Demetriou, modified slightly
by Ken Hornstein and myself.

Add flags to struct device, and define one as "active".  Devices are
initially active from config_attach().  Their active state may be changed
via config_activate() and config_deactivate().

These new functions assume that the device being manipulated will recursively
perform the action on its children.

Together, config_deactivate() and config_detach() may be used to implement
interrupt-driven device detachment.  config_deactivate() will take care of
things that need to be performed at interrupt time, and config_detach()
(which must run in a valid thread context) finishes the job, which may
block.
1998-11-17 08:38:07 +00:00
perry 0c20c72cf9 (mostly) fix kernel tags support. from Frederick Bruckman in pr-6445. 1998-11-15 20:36:30 +00:00
thorpej 88bc4b9f8d Conditionally include the 4.4BSD-Lite2 compat vfs sysctl code. 1998-11-15 18:38:11 +00:00
tls 6321478a33 At securelevel >=2, don't allow new mounts, only allow change from rw to ro. 1998-11-14 06:38:54 +00:00
thorpej 1d03badef0 Implement a way to queue kernel threads for creation after init,
pagedaemon, reaper, etc.  Caller provides a callback function and
argument which will be called to create the threads.
1998-11-14 00:08:49 +00:00
thorpej d23593a784 Make vfs_sysctl() work. 1998-11-13 20:15:32 +00:00
mycroft 1115f2e840 Er, NSIG is one *more* than the number of signals. 1998-11-13 17:23:52 +00:00
mycroft d6ffecf67c Oops; signal numbers are 1..NSIG, not 0..NSIG-1. 1998-11-13 17:12:54 +00:00
thorpej 2f3f9379cf Add a couple more file systems to mountcompatnames[] (even though they
didn't exist in 4.3BSD or NetBSD 0.9) and always put the table into
the kernel.  It's going to be needed for VFS sysctls.
1998-11-13 04:12:35 +00:00
thorpej 920a1ace5b fork_kthread() -> kthread_create(). Set P_NOCLDWAIT on kernel threads,
which will cause any of their children to be reparented to init(8) (which
is already prepared to wait out orphaned processes).
1998-11-11 22:45:32 +00:00
thorpej a0fac8a7bc Move fork_kthread() to a new file, kern_kthread.c, and rename it to
kthread_create().  Implement kthread_exit() (causes a thrad to exit).
Set P_NOCLDWAIT on kernel threads, which will cause any of their children
to be reparented to init(8) (which is already prepared to wait out orphaned
processes).
1998-11-11 22:44:24 +00:00
thorpej 04dc9a8878 Remove some code accidentally readded when Christos implement P_NOCLDWAIT. 1998-11-11 22:37:13 +00:00
thorpej 6956a57584 Initial version of API for creating kernel threads (likely to change somewhat
in the future):
- New function, fork_kthread(), takes entry point, argument for entry point,
  and comment for new proc.  May be called by any context, will fork the
  thread from proc0 (requires slight changes to cpu_fork()).
- cpu_set_kpc() now takes a third argument, a void *arg to pass to the
  thread entry point.  Thread entry point now takes void * instead of
  struct proc *.
- Create the pagedaemon and reaper kernel threads using fork_kthread().
1998-11-11 06:34:43 +00:00
mycroft d4026f6eb5 GC the B_CACHE bit. 1998-11-09 01:18:34 +00:00
mycroft 36918f312f Rework cluster_rbuild() to use buffers with the file system block size.
From Alasdair Baird.
1998-11-08 18:18:31 +00:00