Commit Graph

2988 Commits

Author SHA1 Message Date
lukem 290cc55a28 - Implement
uint32_t namei_hash(const char *p, const char **ep)
  which determines the equivalent MI hash32_str() hash for p.
  If *ep != NULL, calculate the hash to the character before ep.
  If *ep == NULL, calculate the has to the first / or NUL found, and
  point *ep to that location.
- Use namei_hash() to calculate cn_hash in lookup() and relookup().
  Hash distribution goes from 35-40% to 55-70%, with similar profiled
  time spent in cache_lookup() and cache_enter() on my P3-600.
- Use namei_hash() to calculate cn_hash in nfs_readdirplusrpc(),
  insetad of homegrown code (that differed from that in lookup() !)
  namei_hash() has better spread and is faster than previous code
  (which used a non-constant multiplication).
2001-12-08 04:09:59 +00:00
enami df8cfd38a2 Test ".." correctly when creating reverse cache entry. 2001-12-08 04:09:56 +00:00
thorpej 205c159f0e Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).
2001-12-08 00:35:25 +00:00
jdolecek 3d4c59a8ee Back off previous for now, Jason thinks it's not right. Will discuss
on tech-kern@
2001-12-07 07:09:29 +00:00
christos d343ff07bf remove diagnostic test checking for cr_ref = 0. It will never be, because
free() will stick 0xdeadbeef into it.
2001-12-06 23:11:59 +00:00
jdolecek 255ce12e50 replace FIF_WANTCLOSE/FIF_LARVAL with FWANTCLOSE/FLARVAL, which are set
in f_flag of struct file
for now, keep former f_iflags of struct file as _f_spare0, it will be g/c'ed
when struct file will be changed (this will happen soon)
2001-12-06 22:34:24 +00:00
chs 163b4fbc50 in vinvalbuf(), vtruncbuf() and vflushbuf(), don't skip calling
VOP_PUTPAGES() just because the vnode has no pages.  layered filesystems
will want to pass these calls on through to the underlying filesystem,
and non-layered filesystems may need to remove the vnode from the
syncer queues.  fix up MP locking and add some locking assertions.
fixes PRs 12284 and 14640.
2001-12-06 04:34:33 +00:00
augustss 88b5ed0731 Use NULL instead of 0 in a few places. 2001-12-05 16:12:42 +00:00
enami 4654f5c754 Implement sigismasked() correctly. KNF while I'm here. 2001-12-05 07:32:24 +00:00
enami 996ee10484 Introduce new function malloc_roundup(), suggested by Bill Sommerfeld
on tech-kern.
2001-12-05 01:29:04 +00:00
thorpej 03efee5585 * Allow machine-dependent code to specify hooks for ptrace(2)
(__HAVE_PTRACE_MACHDEP) and procfs (__HAVE_PROCFS_MACHDEP).
  These changes will allow platforms like x86 (XMM) and PowerPC
  (AltiVec) to export extended register sets in a sane manner.

* Use __HAVE_PTRACE_MACHDEP to export x86 XMM registers (standard
  FP + SSE/SSE2) using PT_{GET,SET}XMMREGS (in the machdep
  ptrace request space).
* Use __HAVE_PROCFS_MACHDEP to export x86 XMM registers via
  /proc/N/xmmregs in procfs.
2001-12-05 00:58:05 +00:00
enami 769949847d KNF and other cosmetic changes. 2001-12-04 23:56:36 +00:00
jdolecek c152d680d8 Add M_CANFAIL malloc(9) flag. This flag changes behaviour in M_WAITOK
case when the requested memory size can't ever be granted - instead
of panic, malloc(9) would return failure (NULL).
Note kernel code should do proper bound checking, rather than
depend on M_CANFAIL. This flag is only supposed to be used in very
special cases, where common bound checking is not appropriate.

Discussed on tech-kern@, name ``M_CANFAIL'' suggested by Chuck Cranor.
2001-12-04 20:13:19 +00:00
augustss 20e5de88af Add IRFRAMEDISC line discipline.
Also, use symbolic names instead of numbers in a few places.
2001-12-03 23:30:37 +00:00
augustss d845d14a6c Move the code that expands the cd_devs array into a subroutine. 2001-12-02 02:40:57 +00:00
kleink e9d7166203 asm -> __asm. 2001-11-30 16:21:16 +00:00
msaitoh 1c87566f38 fix previous commit 2001-11-30 10:31:32 +00:00
msaitoh 797d100f77 fix printf format 2001-11-30 10:06:46 +00:00
enami b3d722b5b5 Since we know that `va' is non-NULL here, no need to test if it is NULL. 2001-11-30 01:54:21 +00:00
enami ba7af71cd5 Use cached pointer to next buf instead of re-fetching it. GCC actually
generates different code.
2001-11-30 01:31:30 +00:00
christos 0fdce3fa8a sprinkle crcvt() 2001-11-29 21:21:29 +00:00
christos 2a73d40eab introduce crcvt() that converts from struct uucred to struct ucred. 2001-11-29 21:21:13 +00:00
manu 9d2b93114a Updated comment about COMPAT_IRIX: we start working on o32 first... 2001-11-28 11:45:36 +00:00
bouyer 1cd410986d In cn_get_magic() don't increment i in the for(;;) loop, as it's already
set to point to the next value with CNS_MAGIC_NEXT().
Now it's obvious that the magic string on my U5 is +++++ and not +++ :)
2001-11-27 20:00:36 +00:00
jdolecek 577b809930 crfree(): add DIAGNOSTIC sanity check of cr_ref; unfortunately, if the memory
is freed prematurely the check won't be triggered immediatelly, probably
since the memory is likely to be reused fast; but it _would_ be triggered
eventually
2001-11-27 07:30:03 +00:00
manu 12c949a188 Added COMPAT_IRIX (being developped, not functionnal at that time) 2001-11-26 21:38:41 +00:00
jdolecek bf7f67be85 if the LKM support is not compiled in, don't bother using exec_lock
at all, it's only needed in LKM case

use #if defined(LKM) || defined(_LKM) condition for netbsd32_execve.c,
to DTRT when either compiled statically into kernel with LKM support,
or compiled as a LKM
2001-11-23 22:02:39 +00:00
jdolecek 59f63c238e Two changes to setrlimit(2):
* return EINVAL if specified current limit exceeds specified hard limit.
  This behaviour is required by SUSv2 (noted by Giles Lean on tech-kern)
* return EINVAL if an attempt is made to lower stack size limit below
  current usage; this addresses bin/3045 by Jason Thorpe, and conforms to SUSv2
2001-11-23 18:56:33 +00:00
enami f7fa67fcfc Use round_page() instead of roundup(, PAGE_SIZE).
Suggested by chs@netbsd.org.
2001-11-21 01:30:04 +00:00
enami 6a043f1db9 Protect multi statement macro with do {} while (0). This is not cosmetic. 2001-11-21 00:55:39 +00:00
lukem 99bccc3cab - pull in opt_kgdb.h where necessary
- replace opt_kgdb_machdep.h with opt_kgdb.h
- defparam opt_kgdb.h:
	KGDB_DEV KGDB_DEVNAME KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
- move from opt_ddbparam.h to opt_ddb.h:
	DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE DDB_BREAK_CHAR SYMTAB_SPACE
- replace KGDBDEV with KGDB_DEV
- replace KGDBADDR with KGDB_DEVADDR
- replace KGDBMODE with KGDB_DEVMODE
- replace KGDBRATE with KGDB_DEVRATE
- use `9600' instead of `0x2580' for 9600 baud rate
- use correct quotes for  options KGDB_DEVNAME="\"com\""
- use correct quotes for  options KGDB_DEV="17*256+0"
- remove unnecessary dependancy on Makefile for kgdb_stub.o
- minor whitespace cleanup
2001-11-20 08:43:19 +00:00
enami 39ab348507 Call pr_log(PRLOG_GET) when POOL_DIAGNOSTIC is defined instead of DIAGNOSTIC
for consistency.
2001-11-20 06:57:04 +00:00
lukem 576eed5512 Add new malloc(9) flag M_ZERO - zeros memory before returning.
From Poul-Henning Kamp's equivalent enhancement in FreeBSD.
2001-11-17 03:50:27 +00:00
lukem 2565646230 don't need <sys/types.h> when including <sys/param.h> 2001-11-15 09:47:59 +00:00
christos 88db539589 Make poll(2) ignore negative file descriptors (Bang Jun-Young). 2001-11-14 18:43:58 +00:00
lukem 43369f69d3 add RCSID 2001-11-13 13:33:44 +00:00
christos d1dcd2f401 PR/8657: z@rentaboat.se: alarm takes more seconds that it can handle.
This is a followup to PR/14558.

    - itimerfix(9) limited the number of seconds to 100M, before I changed
      it to 1000M for PR/14558.
    - nanosleep(2) documents a limit of 1000M seconds.
    - setitimer(2), select(2), and other library functions that indirectly
      use setitimer(2) for example alarm(3) don't specify a limit.

So it only seems appropriate that any positive number of seconds in
struct timeval should be accepted by any code that uses itimerfix(9)
directly, except nanosleep(2) which should check for 1000M seconds
manually. This changes makes the manual pages of select(2), nanosleep(2),
setitimer(2), and alarm(3) consistent with the code.
2001-11-13 00:34:21 +00:00
lukem adc783d537 add RCSIDs 2001-11-12 15:25:01 +00:00
lukem 7bbd2f341b clean up whitespace 2001-11-12 15:21:46 +00:00
lukem 6e65bad538 regen (for RCSID) 2001-11-12 15:03:35 +00:00
lukem bbfda04203 add RCSID to generated .c files 2001-11-12 14:57:02 +00:00
christos 6ff985ffa8 PR/14558: Tero Kivinen: There is no point in limiting the number of seconds
to 100 million. Use 1000 million like the man page for nanosleep suggests.
This is much closer to MAXINT, and it conforms to POSIX.
2001-11-12 14:52:33 +00:00
lukem 6e69bda797 regen (for RCSID) 2001-11-12 14:50:28 +00:00
lukem d8dd7943fe add RCSID to generated .c file 2001-11-12 14:34:24 +00:00
christos 5c7505a94f fix compile typo. 2001-11-10 20:49:52 +00:00
bouyer f7bc541779 Fix a memory leak when we change pl_corename several times. 2001-11-08 21:24:47 +00:00
chs 6fbca7d0fc use pmap_kenter_pa() instead of pmap_enter(), this is required for
pages loaned to the kernel.  this implies that we also need to
call pmap_kremove() before uvm_km_free().

other general cleanup:  remove argument names from prototypes,
rename some variables, etc.
2001-11-06 07:30:14 +00:00
fvdl f8ff451a0a Fix reversed wait/nowait logic. 2001-10-31 22:23:18 +00:00
manu 40c8c13901 Made syscallargs.h lint-friendly, so that it can be included in libc sources
more easily.
2001-10-30 21:52:26 +00:00
thorpej e8ee04475d - Add a new vnode flag VEXECMAP, which indicates that a vnode has
executable mappings.  Stop overloading VTEXT for this purpose (VTEXT
  also has another meaning).
- Rename vn_marktext() to vn_markexec(), and use it when executable
  mappings of a vnode are established.
- In places where we want to set VTEXT, set it in v_flag directly, rather
  than making a function call to do this (it no longer makes sense to
  use a function call, since we no longer overload VTEXT with VEXECMAP's
  meaning).

VEXECMAP suggested by Chuq Silvers.
2001-10-30 15:32:01 +00:00
itohy 36a6ce75fe Fix memory leak if
- ktrace enabled for I/O operaion, and
 - readv() causes an error.
2001-10-30 13:37:21 +00:00
simonb 5f717f7c33 Don't need to include <uvm/uvm_extern.h> just to include <sys/sysctl.h>
anymore.
2001-10-29 07:02:30 +00:00
jdolecek 24ba90929c Avoid using microtime(9) for atime/mtime, we don't need to have it
THAT accurate and microtime(9) is painlessly slow on i386 currently.
This speeds up small transfers much. The gain for large transfers
is less significant, but notable too.
Bottleneck was found by Andreas Persson (Re: kern/14246).

Performance improvement with PIII on 661 Mhz according to hbench (with
PIPE_MINDIRECT=8192):

buffersize     before    after
512            17        49
1024           33        110
2048           52        143
4096           77        163
8192           142       190
64K            577       662
128K           372       392
2001-10-28 20:47:15 +00:00
christos f7cb99f9c6 make a copy of the epp->ep_path, because it is too late to use it when
copyargs is called since we've swapped vmspaces.
2001-10-28 04:46:42 +00:00
chs a54f8441f8 in cache_lookup(), if we get a cache hit but then fail to vget() the found
vnode, we should not attempt to remove the namecache entry.  this is because
vget() can sleep (eg. if VXLOCK is set because the vnode is being reclaimed),
and so multiple threads can end up in this context at the same time.
if this happens, each thread ends up removing the cache entry, but
the code to remove the entry assumes that the entry is still valid.
so we should just leave the (now stale) entry in the cache.
if another thread finds the entry again before it is reused,
that thread will notice that the entry is stale and remove it safely.
fixes PR 14042.
2001-10-27 04:53:38 +00:00
chs 6bc926aa9e in pool_drain(), call pool_reclaim() while we still have interrupts blocked
since the pool in question might be one used in interrupt context.
2001-10-21 00:06:05 +00:00
thorpej e45efd967f Deprecate the "m_act" alias of "m_nextpkt" (m_act is a historical
name), and just use m_nextpkt everywhere.
2001-10-18 20:17:24 +00:00
thorpej 9b2f51421c Use a pool cache for namei buffers -- it's faster to allocate from
a pool cache than a pool.
2001-10-17 23:33:29 +00:00
christos bfe76ac87a Allow userland to pass MNT_IGNORE (from enami) 2001-10-11 16:27:24 +00:00
mycroft cbd7c4d140 When a pipe was grown to BIG_PIPE_SIZE, we could get in a select()/write() loop
because pipe_poll() and pipe_write() did not agree on when it was okay to write
more data.  Fix pipe_write(), since it seems to be the broken one.
2001-10-08 07:50:17 +00:00
bjh21 d0844f93bb Add support for allocating pool memory in units smaller than a whole page.
This is activated by defining POOL_SUBPAGE to the size of the new allocation
unit, and makes pools much more efficient on machines with obscenely large
pages.  It might even make four-megabyte arm26 systems usable.
2001-10-07 12:44:06 +00:00
eeh c824ea9b57 Remove the property sysctl interface for now. 2001-10-05 19:05:05 +00:00
pooka 11d8d4dae9 add casts to debug printfs to make this compile on archs where
size_t is of type int
2001-10-05 12:55:24 +00:00
eeh e1bd5ac110 Add generic properties. 2001-10-04 18:56:06 +00:00
chs 90a3a778a7 when attempting to reclaim a vnode, tell the lockmgr() that it's ok
to just fail if we already hold the lock.  we'll skip that vnode
and try another.  fixes PR 14090.
2001-10-04 05:46:45 +00:00
chs adb1a233b7 replace wakeup_one() with wakeup(). wakeup_one() can only be used if the
woken-up thread is guaranteed to pass the buck to the next guy before
going back to sleep, and the rest of the lockmgr() code doesn't do that.
from Bill Sommerfeld.  fixes PR 14097.
2001-09-29 21:27:49 +00:00
jdolecek 560e3c342e Use lmin() instead of min(), and long for mlen & clen, to avoid integer
overflow on LP64 architectures. This fixes kern/10070 by Juergen Weiss.

Fix tested on NetBSD/alpha by Bernd Ernesti, on NetBSD/sparc64
by David Brownlee and Eduardo Horvath.
2001-09-29 14:16:19 +00:00
jdolecek 18c0643bfb Update the uio resid counts appropriately when any error occurs
(not just EPIPE), so that the higher-level code would note partial
write has happened and DTRT if the write was interrupted due to
e.g. delivery of signal.

This fixes kern/14087 by Frank van der Linden.
Much thanks to Frank for extensive help with debugging this, and review
of the fix.

Note: EPIPE/SIGPIPE delivery behaviour was retained - they're delivered
even if the write was partially successful.
2001-09-29 13:48:11 +00:00
chs a76b67cf09 jump through hoops to avoid calling uvm_km_free_poolpage() while holding
spinlocks, since that function can sleep.  (note that there's still one
instance remaining to be fixed.)  use TAILQ_FOREACH where appropriate.
2001-09-26 07:14:56 +00:00
enami b0df86c9e6 In the function getnewvnode:
- Mark file system busy again on retry.
- Don't use the variable `listhd' uninitialized.
2001-09-26 00:59:57 +00:00
jdolecek 25bef3c837 Take care to transfer whole buffer passed via write(2); write(2) should
not do short writes unless when using non-blocking I/O.
This fixes kern/13744 by Geoff C. Wing.

Note this partially undoes rev. 1.5 change. Upon closer examination,
it's been apparent that hbench-OS expectations were not actually justified.
2001-09-25 19:01:21 +00:00
chs 039c1fd312 print a stack trace in more LOCKDEBUG cases.
add a blank line between complaints.
use TAILQ_FOREACH where appropriate.
2001-09-25 06:13:29 +00:00
chs e7d9abce3e in ltsleep(), assert that the interlock is held (if one is given). 2001-09-25 01:38:38 +00:00
chs 7bb91a0959 resize the namecache hash table also when desiredvnodes changes. 2001-09-24 06:01:13 +00:00
sommerfeld b27c418d40 Deal with invokers who pass us environment variable settings as part
of the command they want us to run.

Fixes part 3A of PR#14046
2001-09-24 00:20:11 +00:00
sommerfeld acf40b361c Correct comment to match code 2001-09-22 22:36:30 +00:00
jdolecek 8573719e3d add new UVM_LOAN_WIRED flag - the memory pages loaned in TOPAGE case
are only wired if this flag is present (i.e. they are not wired by default now)
loaned pages are unloaned via new uvm_unloan(), uvm_unloananon() and
uvm_unloanpage() are no longer exported
adjust uvm_unloanpage() to unwire the pages if UVM_LOAN_WIRED is specified
mark uvm_loanuobj() and uvm_loanzero() static also in function implementation

kern/sys_pipe.c: uvm_unloanpage() --> uvm_unloan()
2001-09-22 05:58:04 +00:00
chs d0b76cab5e use shared locks instead of exclusive for VOP_READ() and VOP_READDIR(). 2001-09-21 08:02:55 +00:00
jdolecek 1d161cb2d4 call pmap_update() after pmap_enter()s
ALWAYS call uvm_unloanpage() in cleanup - it's necessary even
in pipe_loan_free() case, since uvm_km_free() doesn't seem
to implicitly unloan the loaned pages
2001-09-20 19:09:13 +00:00
jdolecek ef8abe0767 Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
2001-09-18 19:36:32 +00:00
jdolecek a7357fecf4 soreceive(): do not ignore uiomove() error
Problem reported and fix provided by Aaro Koskinen in kern/11692.
2001-09-17 18:59:29 +00:00
wiz 456dff6cb8 Spell 'occurred' with two 'r's. 2001-09-16 16:34:23 +00:00
jmc 87a006a7de Fix issues areound compilation errors (ntv is a pointer in adjtime1 and needs
-> rather than . access and adjtime1 needs the syscall args passed in)
2001-09-16 09:55:26 +00:00
manu adb22920bc Split root-only time-related system calls so that we have an upper part, that
checks root privs, and a lower part that does the actual job. The lower part
will be called by the upcoming clockctl driver. Approved by Christos
Also fixed a few cosmetic things
2001-09-16 06:50:06 +00:00
chs d9faf4d4e7 regen 2001-09-15 20:37:36 +00:00
chs 64c6d1d2dc a whole bunch of changes to improve performance and robustness under load:
- remove special treatment of pager_map mappings in pmaps.  this is
   required now, since I've removed the globals that expose the address range.
   pager_map now uses pmap_kenter_pa() instead of pmap_enter(), so there's
   no longer any need to special-case it.
 - eliminate struct uvm_vnode by moving its fields into struct vnode.
 - rewrite the pageout path.  the pager is now responsible for handling the
   high-level requests instead of only getting control after a bunch of work
   has already been done on its behalf.  this will allow us to UBCify LFS,
   which needs tighter control over its pages than other filesystems do.
   writing a page to disk no longer requires making it read-only, which
   allows us to write wired pages without causing all kinds of havoc.
 - use a new PG_PAGEOUT flag to indicate that a page should be freed
   on behalf of the pagedaemon when it's unlocked.  this flag is very similar
   to PG_RELEASED, but unlike PG_RELEASED, PG_PAGEOUT can be cleared if the
   pageout fails due to eg. an indirect-block buffer being locked.
   this allows us to remove the "version" field from struct vm_page,
   and together with shrinking "loan_count" from 32 bits to 16,
   struct vm_page is now 4 bytes smaller.
 - no longer use PG_RELEASED for swap-backed pages.  if the page is busy
   because it's being paged out, we can't release the swap slot to be
   reallocated until that write is complete, but unlike with vnodes we
   don't keep a count of in-progress writes so there's no good way to
   know when the write is done.  instead, when we need to free a busy
   swap-backed page, just sleep until we can get it busy ourselves.
 - implement a fast-path for extending writes which allows us to avoid
   zeroing new pages.  this substantially reduces cpu usage.
 - encapsulate the data used by the genfs code in a struct genfs_node,
   which must be the first element of the filesystem-specific vnode data
   for filesystems which use genfs_{get,put}pages().
 - eliminate many of the UVM pagerops, since they aren't needed anymore
   now that the pager "put" operation is a higher-level operation.
 - enhance the genfs code to allow NFS to use the genfs_{get,put}pages
   instead of a modified copy.
 - clean up struct vnode by removing all the fields that used to be used by
   the vfs_cluster.c code (which we don't use anymore with UBC).
 - remove kmem_object and mb_object since they were useless.
   instead of allocating pages to these objects, we now just allocate
   pages with no object.  such pages are mapped in the kernel until they
   are freed, so we can use the mapping to find the page to free it.
   this allows us to remove splvm() protection in several places.

The sum of all these changes improves write throughput on my
decstation 5000/200 to within 1% of the rate of NetBSD 1.5
and reduces the elapsed time for "make release" of a NetBSD 1.5
source tree on my 128MB pc to 10% less than a 1.5 kernel took.
2001-09-15 20:36:31 +00:00
chs adf5d360a7 add a new VFS op, vfs_reinit, which is called when desiredvnodes is
adjusted via sysctl.  file systems that have hash tables which are
sized based on the value of this variable now resize those hash tables
using the new value.  the max number of FFS softdeps is also recalculated.

convert various file systems to use the <sys/queue.h> macros for
their hash tables.
2001-09-15 16:12:54 +00:00
enami 163c9dd7c1 Defopt CALLWHEEL_STATS. 2001-09-13 05:22:16 +00:00
thorpej 16c229ea7c Optimization suggested by Bill Sommerfeld: Keep a hint as to the
"earliest" firing callout in a bucket.  This allows us to skip
the scan up the bucket if no callouts are due in the bucket.

A cheap O(1) hint update is done at callout insertion (if new callout
is earlier than hint) and removal (is bucket empty).  A thorough
refresh of the hint is done when the bucket is traversed.

This doesn't matter much on machines with small values of hz
(e.g. i386), but on systems with large values of hz (e.g. Alpha),
it has a definite positive effect.

Also, keep the callwheel stats in evcnts, so that you can view them
with "vmstat -e".
2001-09-11 04:32:19 +00:00
christos fdad5eb59c Don't trash the ref count of cred. It causes a memory leak. 2001-09-08 15:34:06 +00:00
christos f556e46298 Hijack the credentials used to evaluate access, to avoid a potential lwp
race by modifying the proc's credentials temporarily. From Bill Sommerfeld.
Thanks for forcing me to do this right :-)
2001-09-08 02:05:39 +00:00
christos 51d673156c Set the credentials to be used in the NDINIT macro so that syscalls can
hijack them.
2001-09-08 02:02:04 +00:00
enami 405f874060 extent_alloc_subregion shouldn't allocate a region pasts the end of subregion. 2001-08-27 13:35:44 +00:00
thorpej bbd3d01db5 Artur Grabowski's simple brute-force malloc debugger, which uses
guard pages.  Can only debug one malloc type at a time, and nothing
larger than 1 page.  But can be useful for debugging certain types
of "data modified on freelist" type problems.

Modified from code in OpenBSD.
2001-08-17 00:48:29 +00:00
chs e9fbc91f95 user maps are always pageable. 2001-08-16 01:37:50 +00:00
enami 256a367268 Give different names for different wait channels.
# and minor knf fix while I'm here.
2001-08-05 08:25:39 +00:00
jdolecek 332bb4894a bound check mount args more thoroughly 2001-08-03 06:00:13 +00:00
jdolecek c650c8d91c make local 'nsops' same unsigned type as the value we store there in sys_semop() 2001-08-03 05:58:18 +00:00
christos f2a8a907b4 simplify an expression. 2001-07-29 21:24:23 +00:00
christos 3e1e7a68e5 adjust to the new copyargs footprint 2001-07-29 21:22:58 +00:00
christos e2b51c04af - make copyargs function return the reason it failed and pass a pointer to
the stack, so that it can be modified.
- pass the error code in the exit code in addition to aborting.
- kill the second exit1() call; it does not make any sense.
2001-07-29 21:22:42 +00:00
thorpej 9e74a14e1f Add a sysctl to frob sb_max. 2001-07-27 21:19:09 +00:00
thorpej 59612894e1 Now that M_TRAILINGSPACE() checks buffer writeability properly,
we can greatly simplify sbcompress().  Slightly modified from
a similar change in FreeBSD.
2001-07-27 19:27:49 +00:00
thorpej fcc2e4e5f6 Use pool_cache_*() for mbufs and clusters. While we don't use the
ctor/dtor feature, it's still faster to allocate from the cache groups
than it is from the pool (cache groups are analogous to "magazines"
in the Solaris SLAB allocator).
2001-07-26 19:05:04 +00:00
jdolecek 875b784599 pipe_create(): explicitly zero whole memory returned from pool_get(), instead
of some selective pieces. This fixes problem with NEW_PIPE in kernels
with DEBUG option, reported via e-mail by Chuck Silvers.

sys_pipe(): g/c fdp, provide it at the chunk of FreeBSD code where it's used
2001-07-26 14:14:28 +00:00
wiz f1bde32520 s/necesary/necessary/ 2001-07-24 16:43:02 +00:00
assar bec71dc090 change vop_symlink and vop_mknod to return vpp (the created node)
refed, so that the caller can actually use it.  update callers and
file systems that implement these vnode operations
2001-07-24 15:39:30 +00:00
wiz a9356936b4 seperate -> separate 2001-07-22 13:33:58 +00:00
thorpej f20822333e Add `WALLSIG' which causes wait4(2) to wait for all processes, regardless
of exit signal.  Add Linux-compatible aliases __WCLONE (for WALTSIG) and
__WALL (for WALLSIG), for compatibility with the Linux clone(2) API.
2001-07-18 19:10:26 +00:00
thorpej 1071f796f4 bcopy -> memcpy 2001-07-18 06:51:38 +00:00
thorpej f2f13262df bzero -> memset 2001-07-18 06:48:27 +00:00
thorpej 33d6023447 Unshare signal actions on exec.
From Matthew Orgass <darkstar@pgh.net>.
2001-07-18 05:34:58 +00:00
thorpej 35c5abaeff Unshare the file descriptor table and `cwdinfo' when we exec.
From Matthew Orgass <darkstar@pgh.net>.
2001-07-18 05:34:37 +00:00
matt 7fa8aeac6c When we auto size the vnode cache, make sure we do it *before* we
init vfs so it can the size into account when creating its hash lists.
This means that for a 2GB system, it'll have a default of 65536 buckets
instead of 2048 and when you have 200,000+ vnodes that makes a significant
difference.
2001-07-18 00:51:54 +00:00
jdolecek f9f0d49b94 comment police 2001-07-17 18:21:59 +00:00
jdolecek db3510e6f8 fix bogus uio->uio_offset check introduced in rev. 1.5, which effectively
disabled loans for writes (a.k.a "direct write"), oops; use uio->uio_resid
for the check instead

don't bother updating uio->uio_offset in pipe_direct_write(), it's not used
by upper layers anyway
2001-07-17 18:18:52 +00:00
jdolecek 588b94c0a2 Expel MSG_COMPAT/COMPAT_OLDSOCK, make the COMPAT_43 wrappers
arrange things as needed.  Unfortunately, the check in sockargs()
have to stay, since 4.3BSD bind(2), connect(2) and sendto(2) were
not versioned at the time :(

This code was tested to pass regression tests.
2001-07-17 11:49:40 +00:00
jdolecek 37d12500d5 only allocate buffer kva for the end which needs it 2001-07-17 06:05:28 +00:00
christos 2c913b0983 Fix problem reported by Greg Woods, with ld -n generated binaries.
Now if the requested alignment of the psection is less than PAGE_SIZE
we use readvn, not pagedvn and we don't adjust sizes.
2001-07-15 20:52:35 +00:00
christos 87e055d89e Use DPRINTF, and print all exec_vmcmds when we are debugging.
Don't use DEBUG, use DEBUG_EXEC to turn all that on.
2001-07-15 20:49:40 +00:00
jdolecek 55aebfe98e Remove initial newline from copyright[], which was mistakely added in rev.1.191.
Fixes kern/13470 by Tetsuya Isaki.
2001-07-15 14:36:06 +00:00
matt f300898396 Add support for kern.maxphys, vm.maxslp, vm.uspace (the later two for ps). 2001-07-14 06:36:01 +00:00
christos 66b3b42040 use be32toh instead of bswap32
add a macro MACHO_MACHDEP_CASES instead of ifdef'ing cpu types.
thanks jason!
2001-07-14 03:05:31 +00:00
christos b6639a0e83 new exec module for MACH-O fat binaries
XXX: shared libraries are not handled properly yet.
2001-07-14 02:09:41 +00:00
christos 69f5770270 - add exec_read_from and make exec_elf32 use it.
- add a macho probe function
2001-07-14 02:08:29 +00:00
christos 32a9a52549 add mach/macho exec struct 2001-07-14 02:06:34 +00:00
fvdl 75e45c9dee Check msgbufenabled before referencing msgbufp in panic. Avoids
a NULL ptr reference if there is an early panic (i.e. before
initmsgbuf() was called).
2001-07-10 20:40:56 +00:00
lukem dfaec93e4e move to kqueue branch for now 2001-07-10 11:59:50 +00:00
simonb cb89e2e488 ANSIfy. 2001-07-09 23:35:56 +00:00
simonb bc45d3d53c ANSIfy. 2001-07-09 10:54:12 +00:00
wiz fc687b32f5 Fix last commit: It's ">", not "<", in this case. Okay'd by christos. 2001-07-08 19:08:48 +00:00
christos 7d591946ec add verbiage to error 2001-07-08 18:57:50 +00:00
wiz cc0b68092e Correct various misspellings of 'transfer' and inflected forms. 2001-07-08 18:06:42 +00:00
wiz daa5d204e4 synchron*, not sychron* 2001-07-08 17:41:14 +00:00
jdolecek 9bbd53c2ba vfs_sysctl(): cosmetic: provide explicit size for vfsnames[], to catch
mistakes VFS_MAXID/CTL_VFS_NAMES are updated
2001-07-08 10:32:38 +00:00
fvdl 2017fd0179 flags was used uninitialized. 2001-07-07 23:33:54 +00:00
wdk d80e8c579c Disable single step when entering KGDB. S-S will be enabled later if
required.   This duplicates the behavour used by DDB in db_stop_at_pc()

Architectures that emulate single step in software (SOFTWARE_SSTEP) don't
clear their temporary breakpoints making it impossible to restart on the
same instruction.
2001-07-07 22:58:00 +00:00
lukem dafe2b38ba freebsd kqueue implementation 2001-07-06 08:01:32 +00:00
itojun d5b4c4a05d remove a #ifdef __OpenBSD__ segment. 2001-07-03 08:06:40 +00:00
itojun ebdb9f12f3 typo (should we get rid of this portion? 2001-07-02 23:02:11 +00:00
jdolecek 12aa43b8b1 Don't try to be too smart about chunking - if the data size is bigger
than PIPE_CHUNK_SIZE, just transfer first PIPE_CHUNK_SIZE and return short
write, expecting the caller to call us again later (if they need). Previous
behaviour (besides being wrong for O_NONBLOCK reads) hung hbench under some
circumstances and other applications may have similar expectations as hbench.
This might also fix port-vax/13333 by Manuel Bowyer.

Other changes to pipe_direct_write() include:
* return short write (and success) on EOF if any data were already read;
  we return EPIPE on next write(2) call
* simplify error handling, actually handle uvm_loan() failure correctly,
  call pipe_loan_free() on error explicitly and only call uvm_unloan()
  if the address space was _not_ already freed by pipe_loan_free()
  Thanks Chuck Silvers for uvm_unloan() hints :)

Fallthough to common write in pipe_write() if pipe_direct_write()
returns ENOMEM, otherwise always break out immediatelly.
Use uvm_km_valloc_wait() instead uvm_km_valloc() in pipe_loan_alloc().
2001-07-02 20:43:39 +00:00
matt 54ec2573c9 Use consistent types for len. Limit sockarg length to reasonable values. 2001-07-01 20:42:48 +00:00
thorpej 5bdb21d48a Duh, use fd_getfile() in sys_close(). 2001-07-01 18:12:00 +00:00
thorpej ce232da4eb Regen; added Linux-compatible clone(2) system call. 2001-07-01 18:07:33 +00:00
thorpej 9377ba2c38 Linux-compatible clone(2) system call, lifted from the Linux
compatibility module.  Based on patches from Bang Jun-Young <bjy@mogua.org>.
2001-07-01 18:06:11 +00:00
thorpej 7f109318f9 Protect the `pool cache group' pool with splvm(), so that pool caches
can be used by code that runs in interrupt context.
2001-07-01 06:12:20 +00:00
gmcgarry d6182a9e77 In-kernel device configuration manager - allows modification
of device locators at run-time.

Written by Mats O Jansson <moj@stacken.kth.se>.  Reworked by
Jun-ichiro itojun Hagino <itojun@netbsd.org>.
2001-07-01 02:56:20 +00:00
jdolecek 77f0267d21 Use array based upon CTL_VFS_NAMES to get filesystem name for non-VFS_GENERIC
syscall, instead of mountcompatnames[].
Move the extern mountcompatnames[], nmountcompatnames definition to
COMPAT_09 || COMPAT_43 section.
2001-06-28 08:12:08 +00:00
jdolecek 1ff201e042 Only define mountcompatnames[] for COMPAT_09 and COMPAT_43, make the
table actually match state in NetBSD 0.9 (checked against sys/mount.h
rev. 1.11).
The array is not to be modified from now on, comment updated accordingly.
2001-06-28 08:04:18 +00:00
atatat 298956dcf1 If no select collision is needed, try our best to avoid it by clearing
the flag.
2001-06-28 05:45:49 +00:00
thorpej 25f00d4c18 In getnewvnode(), allocate a vnode from the pool with NOWAIT. If
that fails, just try to recycle a vnode.  If we can't allocate or
recycle, issue a warning, sleep a bit, and try the whole thing
again.

This prevents us from blocking forever if we want to use a very large
number of vnodes, but don't have {memory,kva} resources from which to
allocate them.
2001-06-26 22:52:03 +00:00
jdolecek e65c47a67f vfs_rootmountalloc: take advantage of LIST_FOREACH() 2001-06-26 19:14:25 +00:00
thorpej a279b0973b Reduce some complexity in the fault path -- Rather than maintaining
an spl-protected "interrupt safe map" list, simply require that callers
of uvm_fault() never call us in interrupt context (MD code must make
the assertion), and check for interrupt-safe maps in uvmfault_lookup()
before we lock the map.
2001-06-26 17:55:14 +00:00
thorpej a160a0b77c Make the kmemstats limits unsigned, and use unsigned arithmetic
to compute them.  Prevents overflows when using a very large number
of kmem pages.

From chopps@netbsd.org.
2001-06-26 16:02:27 +00:00
wrstuden 716d3ae08f In vcount(), when getting rid of unused aliases, don't vgone one which
has VXLOCK set - it's already being vgoned, most likely by one of our
callers. If we call vgone, we can end up sleeping against ourself
with VXLOCK set - we'll start the race for root.

Pointed out by Love <lha@stacken.kth.se> on tech-kern. Analysis from
Artur Grabowski <art@openbsd.org> via Love.

Should resolve PR kern/13077
2001-06-26 15:51:06 +00:00
thorpej c0b03b60e7 Really only need uvm_extern.h. From Chuck Cranor. 2001-06-25 22:08:52 +00:00
jdolecek 26d45c1101 Back off the sendit()/recvit() change, some have problems with it 2001-06-25 20:46:11 +00:00
jdolecek d865180393 sys_connect(): fix the call to FILE_UNUSE() so that it's done on return, rather
than immediatelly after getsock() call
2001-06-25 19:46:50 +00:00
jdolecek 7f7c60e827 Add 'kernsa' parameter for sendit()/recvit(); if nonzero, msg->msg_name
is supposed to point directly to struct mbuf or struct sockaddr in kernel
space as appropriate, rather than being a pointer to memory in userland.

This is to be used by compat/* when emulation needs to wrap
send{to|msg}(2)/recv{from|msg}(2) and modify the passed struct
sockaddr.
2001-06-25 19:24:02 +00:00
thorpej 99db7959b4 Include <uvm/uvm.h> rather than <uvm/uvm_param.h> directly. 2001-06-25 16:24:31 +00:00
jdolecek 36f8e84443 Move prototype of sysctl_dopipe() from <sys/sysctl.h> to <sys/pipe.h>
and adjust kern/kern_sysctl.c accordingly.
2001-06-21 19:08:36 +00:00
jdolecek 82ce96aaec Don't include opt_new_pipe.h, it's not needed here 2001-06-21 18:59:51 +00:00
jdolecek ad2b5880f0 Oops, fell into rpipe/wpipe trap:
The end we want to do selwakeup() on is not necessarily same as the one
we send SIGIO to. Make pipeselwakeup() accept two parameters and update
callers accordingly. This change fixes behaviour for code, which does
select(2)s on the write end waiting for reader (watched on gv, the problem
manifestated itself as a too long delay before the document was displayed).

Clearly separate the resource free code for FreeBSD
and NetBSD case in pipeclose(), so that it's a bit clearer what's going on.
Also LK_DRAIN the lock before the memory is returned to pipe_pool.

Add missing wakeup() in pipe_write() for PIPE_WANTCLOSE case.
2001-06-21 18:46:22 +00:00
jdolecek 3fd1ca0fc9 Do not include the ELF 'catch all' entry in execsw[] by default, which
used to make ELF binaries unmatched by any signature check to be run under
NetBSD 'emulation'. This causes problems like kern/12253.
The old behaviour is available with option EXEC_ELF_CATCHALL.
2001-06-19 17:58:41 +00:00
christos 0f380fac15 Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
2001-06-18 02:00:48 +00:00
manu 94a4020177 Use SB_ASYNC in struct sockbuf sb_flags field instead of SS_ASYNC in
struct socket so_state field to decide if we need to send asynchronous
notifications. This makes possible to request notification on write but
not on read, and vice versa.

This is used in Linux emulation code, because when async I/O is requested,
Linux does not send SIGIO to write end of sockets, and it never send any
SIGIO to any end of pipes. Il Linux emulation code, we then set SB_ASYNC
only on the read end of sockets, and on no end for pipes.
2001-06-16 21:29:32 +00:00
jdolecek ee882e3a09 Add port of high performance pipe implementation written by John S. Dyson
for FreeBSD project. Besides huge speed boost compared with socketpair-based
pipes, this implementation also uses pagable kernel memory instead of mbufs.

Significant differences to FreeBSD version:
* uses uvm_loan() facility for direct write
* async/SIGIO handling correct also for sync writer, async reader
* limits settable via sysctl, amountpipekva and nbigpipes available via sysctl
* pipes are unidirectional - this is enforced on file descriptor level
	for now only, the code would be updated to take advantage of it
	eventually
* uses lockmgr(9)-based locks instead of home brew variant
* scatter-gather write is handled correctly for direct write case, data
  is transferred by PIPE_DIRECT_CHUNK bytes maximum, to avoid running out of kva

All FreeBSD/NetBSD specific code is within appropriate #ifdef, in preparation
to feed changes back to FreeBSD tree.

This pipe implementation is optional for now, add 'options NEW_PIPE'
to your kernel config to use it.
2001-06-16 12:00:02 +00:00
jdolecek 664cf935c7 Import FreeBSD sys_pipe.c rev 1.82 for reference (this was used as a base
for the NetBSD port).
2001-06-16 09:21:34 +00:00
jdolecek c57b6d9ba4 Add DTYPE_PIPE (to be used by new pipe implementation) and handle
it accordingly.
2001-06-16 08:28:39 +00:00
thorpej 7660fd850d In check_exec(), don't bother checking P_TRACED along with
MNT_NOSUID, just check MNT_NOSUID to clear the S{U,G}ID bits
in the attributes for the vnode we're about to exec.

We now check P_TRACED right before we would actually perform
the s{u,g}id function in the exec code.

This closes a race condition between exec of a setuid binary
and ptrace(2).
2001-06-15 17:24:19 +00:00
thorpej 80cc38a1af Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads.  What we do is stick descriptors in the table, but
mark them as "larval".  This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again.  When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
2001-06-14 20:32:41 +00:00
nathanw 9e8fb68348 The trace_req() function is a no-op; garbage collect it. 2001-06-13 16:06:27 +00:00
tron 848a0e68f6 Lower interrupt priortiy properly if setting the setting the kernel time
is denied in a securelevel above 1. This fixes PR kern/13158.
2001-06-11 07:07:12 +00:00
mrg 7a84fc0483 use real \n's copyright[]; avoids gcc 3.0-prerelease warnings. 2001-06-08 12:53:30 +00:00
thorpej d9b3317e3e Rework fdalloc() even further: split fdalloc() into fdalloc() and
fdexpand().  The former will return ENOSPC if there is not space
in the current filedesc table.  The latter performs the expansion
of the filedesc table.  This means that fdalloc() won't ever block,
and it gives callers an opportunity to clean up before the
potentially-blocking fdexpand() call.

Update all fdalloc() callers to deal with the need-to-fdexpand() case.

Rewrite unp_externalize() to use fdalloc() and fdexpand() in a
safe way, using an algorithm suggested by Bill Sommerfeld:
- Use a temporary array of integers to hold the new filedesc table
  indexes.  This allows us to repeat the loop if necessary.
- Loop through the array of file *'s, assigning them to filedesc table
  slots.  If fdalloc() indicates expansion is necessary, undo the
  assignments we've done so far, expand, and retry the whole process.
- Once all file *'s have been assigned to slots, update the f_msgcount
  and unp_rights counters.
- Right before we return, copy the temporary integer array to the message
  buffer, and trim the length as before.
Note that once locking is added to the filedesc array, this entire
operation will be `atomic', in that the lock will be held while
file *'s are assigned to embryonic table slots, thus preventing anything
else from using them.
2001-06-07 01:29:16 +00:00
mrg 1ce89f683e in coredump() remove the COMPAT_NETBSD32 #ifdef, and replace it with a hook.
move coredump32() into compat/netbsd32.
2001-06-06 21:37:19 +00:00
thorpej c55795d055 Change fdalloc() to return ERESTART if we had to reallocate the
descriptor array, which may have blocked.  Change callers of
fdalloc() to restart whatever they\'re doing if this condition
happens.  (XXX unp_externalize() needs some work, but that will
be tackled later.)

Change finishdup() to close the descriptor in the `new\' slot if
one exists, and change sys_dup2() accordingly.

Closes a race condition when using kernel-assisted user threads.

While here, garbage-collect UF_MAPPED -- it is not used anywhere.
2001-06-06 17:00:00 +00:00
thorpej f1c14428bb Do the reentrancy checking if POOL_DIAGNOSTIC, not DIAGNOSTIC. Prevents
ABI change for diagnostic vs. non-diagnostic kernels.
2001-06-05 18:51:03 +00:00
mrg b49770c009 add a DEBUG for why the lkm entry point failed. 2001-06-05 12:36:08 +00:00
thorpej e93d1531c2 Avoid a sleeping malloc call while holding the spechash_slock.
XXX This is kinda gross, but prevents complete lossage on an
XXX MP system.
From Bill Sommerfeld.
2001-06-05 04:42:05 +00:00
thorpej 47c29f3cbe Assert that no locks are held if we're called with PR_WAITOK.
From Bill Sommerfeld.
2001-06-05 04:40:39 +00:00
thorpej 2fbef8e269 Assert that no locks are held if we're called with EX_WAITSPACE.
From Bill Sommerfeld.
2001-06-05 04:39:56 +00:00
thorpej 67a875a8c9 Assert that no locks are held if we're called with M_WAITOK. 2001-06-05 04:39:02 +00:00
thorpej 31769952ca Add a simple_lock_only_held() LOCKDEBUG routine, which allows code
to assert that exactly zero or one (and a specific one) locks are
held.

From Bill Sommerfeld.
2001-06-05 04:38:08 +00:00
chs 821ec03ed9 replace vm_map{,_entry}_t with struct vm_map{,_entry} *. 2001-06-02 18:09:08 +00:00
lukem d84d2c6c85 add missing #include "opt_kgdb.h" 2001-05-30 15:24:23 +00:00
mrg 09cf52ad81 regen. 2001-05-30 11:48:07 +00:00
mrg 72d327d434 use _KERNEL_OPT not _KERNEL&&|_LKM 2001-05-30 11:27:46 +00:00
chs 187cadcb77 don't define bpendtsleep in profiling kernels since it confuses gprof. 2001-05-28 22:20:03 +00:00
thorpej 442a329915 Statically-initialize `allevents' so that events can be registered
very early (before main() is called).
2001-05-28 16:40:31 +00:00
thorpej 9ec2953eef Make "reboot" an option at the root device/filesystem prompt (we
already had a "halt").
2001-05-27 01:29:50 +00:00
chs c90ead639a regen. 2001-05-26 21:34:04 +00:00
chs 07cabef8a2 replace vm_page_t with struct vm_page *. 2001-05-26 21:33:11 +00:00
chs 11a9651c8f replace vm_page_t with struct vm_page *. 2001-05-26 21:27:10 +00:00
kristerw 76475ad726 Removed an incorrect use of __CONCAT when formatting panic messages.
The ISO C standard says in 6.10.3.3 that if the result of using the
'##' operator "is not a valid preprocessing token, the behaviour is
undefined." Gcc 3.0 warns about this.
2001-05-24 10:33:08 +00:00
lukem c9b9613b3e for FIOGETOWN, only change the sign of *data if fo_ioctl returned without error 2001-05-24 06:52:43 +00:00
lukem 0fd012d03b regen for whitespace cleanup 2001-05-24 06:44:30 +00:00
manu a3703d68ef Backed out a previous commit that was incomplete and hence broke several
emulation package build
2001-05-19 17:28:33 +00:00
manu 37a42fd1bf Moved e_flags outsied of ifdef __HAVE_MINIMAL_EMUL in struct emul
and removed an ifdef that was taking care of this problem
2001-05-19 08:52:05 +00:00
perry 4be93c9ed7 Add a /* LINTSTUB: include <foo.h> */ mechanism. 2001-05-16 04:17:04 +00:00
perry bf16779f43 allow long typed functions 2001-05-16 03:58:14 +00:00
perry 3fe923fc2c I -> Ignore 2001-05-15 22:32:02 +00:00
perry 7cb4818421 awk script to automatically generate lint stub files from stylized
comments in .S files.
2001-05-15 22:23:09 +00:00
lukem 6cb5e77db5 remove use of gcc syntax for designated initialisers when initialising
unions `union_elem: ...', and use c99 syntax `.union_elem = ...' only
where necessary.
in this case, there's no need to tag elf_probe_func because that's the
first union element, and therefore, the implicit case. only specifically
mention ecoff_probe_func where necessary.

if we decide to not use this c99 feature for now, at least there's now
less stuff to rip out.
2001-05-15 02:00:12 +00:00
sommerfeld b4c4ecb455 Make this build again ifdef DIAGNOSTIC (oops) 2001-05-13 17:17:34 +00:00
sommerfeld 5b2241ad77 Remove pool reentrancy testing overhead unless DIAGNOSTIC is defined.
Previously, we passed __FILE__ and __LINE__ on all pool_get/pool_set calls.

This change results in a measured 1.2% performance improvement in
ping-flood packets-per-second as reported by ping(8).
2001-05-13 17:06:58 +00:00
thorpej 2f58df9a8f Rearrange the code that adds pages of objects to the pool; require
that the caller allocate the pool_item_header when it allocates the
pool page, so we can avoid a locking pitfall (sleeping with a simple
lock held).

Also revive pool_prime(), as there are some letigimate uses of it,
but in doing so, eliminate some of the bogosities of the old version
(i.e. don't do an implicit "setlowat", just prime the pool, and incr
the minpages for each additional page we add, and compute the number
of pages to prime in a way that callers would expect).
2001-05-10 04:51:41 +00:00
thorpej 6ec67f871a Use POOL_NEEDS_CATCHUP() in one more place. 2001-05-10 02:19:32 +00:00
thorpej db26619a5e Encapsulate the test for a pool needing a pool_catchup() in a macro. 2001-05-10 01:37:40 +00:00
thorpej 627edfcb50 Remove pool_create() and pool_prime(). Nothing except pool_create()
used pool_prime(), and no one uses pool_create() anymore.

This makes it easier to fix a locking pitfall.
2001-05-09 23:46:02 +00:00
thorpej 626cb1c3ce Use pool_init() rather then pool_create(). 2001-05-09 23:38:20 +00:00
jdolecek 27a5a43c04 In the check_header() function, bump the number of allowed section headers
to 512. Apparently, there are ELF binaries with more than 128 section
headers - an example is one of Linux Word Perfect 8 utilities.

This fixes kern/12455 by Mark Davies.
2001-05-07 17:09:13 +00:00
manu 7e6929fe90 Changed EMUL_BSD_ASYNCIO_PIPE to EMUL_NO_BSD_ASYNCIO_PIPE, so that
the native emulation (NetBSD) does not have a flag.
2001-05-07 09:55:12 +00:00
lukem 5b2ac78763 regen from vnode_if.sh rev 1.29 2001-05-07 08:48:07 +00:00
lukem e1adc31453 delint: vop_default_desc was declared const but not defined const. 2001-05-07 08:46:02 +00:00
enami 8e5a4722c5 Make this file *just* compiles again when __HAVE_MINIMAL_EMUL is defined. 2001-05-07 02:51:53 +00:00
enami 362af21bc7 Fix broken indentation introduced by previous commit. 2001-05-07 02:28:55 +00:00
manu 573ce64c6b implement the recently introduced EMUL_BSD_ASYNCIO_PIPE emulation package
flag.

EMUL_BSD_ASYNCIO_PIPE notes that the emulated binaries expect the original
BSD pipe behavior for asynchronous I/O, which is to fire SIGIO on read() and
write(). OSes without this flag do not expect any SIGIO to be fired on
read() and write() for pipes, even when async I/O was requested. As far as
we know, the OSes that need EMUL_BSD_ASYNCIO_PIPE are NetBSD, OSF/1 and
Darwin.
2001-05-06 19:22:32 +00:00
manu 5a6b8191b5 Added two flags to emulation packages:
EMUL_BSD_ASYNCIO_PIPE notes that the emulated binaries expect the original
BSD pipe behavior for asynchronous I/O, which is to fire SIGIO on read() and
write(). OSes without this flag do not expect any SIGIO to be fired on
read() and write() for pipes, even when async I/O was requested. As far as
we know, the OSes that need EMUL_BSD_ASYNCIO_PIPE are NetBSD, OSF/1 and
Darwin.

EMUL_NO_SIGIO_ON_READ notes that the emulated binaries that requested
asynchrnous I/O expect the reader process to be notified by a SIGIO, but
not the writer process. OSes without this flag expect the reader and the
writer to be notified when some data has arrived or when some data have been
read. As far as we know, the OSes that need EMUL_NO_SIGIO_ON_READ are Linux
and SunOS.
2001-05-06 19:09:52 +00:00
simonb cbbd901bdc Declare schedhz. 2001-05-06 13:46:34 +00:00
simonb 6a2acde042 Save the start and end positions in the message buffer of the formatted
panic string.

Suggested by Jason Thorpe eons ago.
2001-05-06 13:23:42 +00:00
thorpej da1f26d65f Add pool_cache_destruct_object(), used to force destruction of
an object and release back into the pool.
2001-05-04 19:41:25 +00:00
scw 2963ff5c58 Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
2001-05-02 10:32:08 +00:00
enami bda65c7816 Define local variable cpu_id only when either MULTIPROCESSOR or DIAGNOSTIC
is defined since it isn't used otherwise.
2001-05-01 04:30:04 +00:00
kleink 50d738a0f0 Add %j, %t and %z modifiers. 2001-04-30 21:29:45 +00:00
kml fc1ebff2b2 Large values of sb_max would cause an overflow in sbreserve(); cast to
u_quad_t to avoid this.  (from FreeBSD uipc_socket2.c v1.19)
2001-04-30 03:32:56 +00:00
bjh21 beb69f2aad Before allowing kgmon to do anything, check that we managed to allocate the
profiling buffer at startup.  If not, pretend the kernel doesn't have
profiling support at all.
2001-04-28 12:56:00 +00:00
jdolecek 27706951af Slighly improve comment for ltsleep(), the previous formulation might
be understood incorrectly (at least, it confused me at first, before
I looked at the actual code).
2001-04-27 08:00:03 +00:00
lukem cdf90834d5 put TAB after #defines 2001-04-27 06:07:27 +00:00
marcus 11ac2c3105 STDC cleanup: multi line string literal removed. 2001-04-27 00:06:11 +00:00
marcus b6240639a2 STDC cleanup: volatile needs to be cast away for lk_flags as well. 2001-04-27 00:05:13 +00:00
enami 5a6a17f734 Make sysctl_msgbuf() to copy message buffer to userland even if
the write pointer points to the beginning of message buffer.
2001-04-26 06:07:13 +00:00
thorpej c24c3604b0 SPINLOCK_INTERLOCK_RELEASE_HOOK should actually be
SPINLOCK_SPIN_HOOK, so that we actually check for
pending IPIs on the Alpha more than once.  Also,
when we call alpha_ipi_process(), make sure to go
to splipi().
2001-04-20 22:58:39 +00:00
thorpej a18eaa4cb6 Make sure there is there is a curproc in ltsleep(). 2001-04-20 17:58:49 +00:00
lukem 63a13d4499 use ${.CURDIR:H:H} instead of ../.. for default setting of SYSDIR,
because the latter doesn't work with objdirs
2001-04-18 11:21:24 +00:00
thorpej 5b35dc8136 When unmounting a file system, acquire the syncer_lock before
vfs_busy'ing just before the dounmount() call.  This is to avoid
sleeping with the mountlist_slock held -- but we must acquire
syncer_lock before vfs_busy because the syncer itself uses
syncer_lock -> vfs_busy locking order.
2001-04-16 22:41:09 +00:00
thorpej bf2dcec4f5 Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
2001-04-13 23:29:55 +00:00
thorpej 4cb159296b Remove an splimp() that really has no purpose in life. 2001-04-12 03:08:42 +00:00
kleink fba80da1d1 Regen. 2001-04-10 11:06:20 +00:00
kleink c73bcbb0f8 Slight indentation nit. 2001-04-10 11:03:56 +00:00
enami c75004b245 Fix the name of some bits in struct vnode.v_flag. 2001-04-09 14:14:10 +00:00
jdolecek b6d1d4db02 Change the first arg to fileops fo_stat routine to struct file *, adjust
callers and appropriate routines to cope. This makes fo_stat more
consistent with rest of fileops routines and also makes the fo_stat
match FreeBSD as an added bonus.
Discussed with Luke Mewburn on tech-kern@.
2001-04-09 10:22:00 +00:00
jdolecek 16b1272b3f Add new 'stat' fileop and call the stat function via f_ops rather
than directly.
For compat syscalls, also add necessary FILE_USE()/FILE_UNUSE().
Now that soo_stat() gets a proc arg, pass it on to usrreq function.
2001-04-07 09:00:57 +00:00
jhawk 4f4abf46ee SYSDIR should be relative here, too.
And actually use it after we define it.

Optimize the find expression (use -prune over -path)
2001-04-05 19:49:40 +00:00
jhawk 0ee6a7e6e9 Remove grossly inefficient "! -path /sys/arch*" construct in favor of -prune.
Use a relative path (../..) instead of /sys.

Enhance the sed expression to work with .'s in paths.
Quote sed expressions in single quotes rather than double
quotes unless there's a good reason otherwise.
2001-04-03 16:56:16 +00:00
chs 702fa72b16 in bwrite(), when deciding whether to convert sync writes into delayed writes,
examine the filesystem contained in a block device rather than the filesystem
containing the block device vnode.  fixes PR 12484.
2001-04-01 16:16:56 +00:00
enami 2ceebb6c0e Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.
2001-03-31 00:35:21 +00:00
jdolecek 466a79b36b Make it possible to use different function for unimplemented syscalls
than sys_nosys().
2001-03-30 16:56:36 +00:00
fvdl 2c310ee4d5 Depending on the NAMECACHE_ENTER_REVERSE option, always enter reverse
mappings (vnode -> name) in the reverse mapping hash table. Without
this option, there is no change; only directories will be entered to
speed up getcwd. This is an option because it will cause getcwd
to hit longer hash chains, and at the moment its usefulness is
still limited.
2001-03-29 22:39:23 +00:00
lukem b4e2b14fe6 convert to ANSI KNF 2001-03-22 04:52:25 +00:00
thorpej 20fe4e2d96 Add a protosw flag, PR_ABRTACPTDIS (Abort on Accept of Disconnected
Socket), and add it to the protocols that use that behavior (all
PR_LISTEN protocols except for PF_LOCAL stream sockets).
2001-03-21 19:22:27 +00:00
pooka 6c3e28927e fix typo in comment 2001-03-17 09:38:36 +00:00
chs ac3bc537bd eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS			0
KERN_INVALID_ADDRESS		EFAULT
KERN_PROTECTION_FAILURE		EACCES
KERN_NO_SPACE			ENOMEM
KERN_INVALID_ARGUMENT		EINVAL
KERN_FAILURE			various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE		ENOMEM
KERN_NOT_RECEIVER		<unused>
KERN_NO_ACCESS			<unused>
KERN_PAGES_LOCKED		<unused>
2001-03-15 06:10:32 +00:00
chs 941da355cf in getnewbuf(), when we need to write a buffer before reusing it,
return NULL instead of restarting the loop since we might sleep
while starting the i/o.  this tells getblk() to check if someone else
created the buffer while we slept.  from OpenBSD.
2001-03-10 18:43:55 +00:00
tsutsui d507b847c6 Declare constty extern. 2001-03-09 13:35:50 +00:00
chs 83d071a318 add UBC memory-usage balancing. we track the number of pages in use for
each of the basic types (anonymous data, executable image, cached files)
and prevent the pagedaemon from reusing a given page if that would reduce
the count of that type of page below a sysctl-setable minimum threshold.
the thresholds are controlled via three new sysctl tunables:
vm.anonmin, vm.vnodemin, and vm.vtextmin.  these tunables are the
percentages of pageable memory reserved for each usage, and we do not allow
the sum of the minimums to be more than 95% so that there's always some
memory that can be reused.
2001-03-09 01:02:10 +00:00
cgd d45416e707 when executing args in the ccode=0 case, send output to a tmp file and
(only if cmd exited successfully) use tmp file as input to sed pipeline.
This works around two issues:
(1) a pathological case where the script would fail in ... interesting
    ways if the command being executed closed its stdout.  (Certain
    commands are used only for their side effects, but not their output,
    and doing some testing on my own i got into hot water when one
    of my mods caused a command to close its output).
(2) the fact that genassym would succeed even when the command in
    fact failed (because the last cmd in the pipeline is the one whose
    exit status would be reported).
2001-03-06 02:20:18 +00:00
fvdl f28b5d3d94 Avoid spinning forever when hardclock() wants to grab the kernel lock
held by the reaper. From Bill Sommerfeld.
2001-03-05 20:38:21 +00:00
eeh 59c87936e0 Oops. Forgot to add this to execsw. Seems like SVR4 64 is not used much. 2001-03-03 01:46:04 +00:00
lukem de1c2690b6 convert to ANSI KNF 2001-02-27 05:19:13 +00:00
lukem 1fa336cced oops; accidentally dropped an initialisation in pollscan() in previous.
called poll() to fail in interesting ways. noted by chs/nathanw
2001-02-27 04:44:51 +00:00
lukem 602451ac6e convert to ANSI KNF 2001-02-26 21:58:30 +00:00
lukem 4637391f86 minor KNF 2001-02-26 21:09:57 +00:00
lukem 735e1dcaa8 convert to ANSI KNF 2001-02-26 20:43:25 +00:00
lukem 7fee352603 convert to ANSI KNF 2001-02-26 20:24:30 +00:00
jdolecek 5a8911a72d Call module "stat" entry where appropriate.
Problem reported and patch provided by SATOU Takashi in kern/12037.
2001-02-24 10:16:46 +00:00
nathanw 214bc3e43f All of our ports have reasonable cpu_coredump()'s that set
core.c_midmag. Garbage collect the "traditional dump" code that
handled the core.c_midmag == 0 case.
2001-02-23 22:01:50 +00:00
jdolecek 522f569810 make some more constant arrays 'const' 2001-02-21 21:39:52 +00:00
eeh 6a9224a06d Remove old compatibility hack. Should no longer be needed. 2001-02-21 00:47:21 +00:00
eeh 8a4a682091 Support flexible process address space limits and bump kernel version number. 2001-02-14 18:21:42 +00:00
itojun d64f080341 make sure we do not return shared M_EXT mbuf. it will avoid possible mbuf
overwrites if bridge/loopback/multicast/whatever is used.  sync with kame
2001-02-14 17:09:19 +00:00
itojun 02bc628319 add pfctlinput2() (pfctlinput() with args). 2001-02-11 06:38:45 +00:00
eeh 52af2be8e9 Add COMPAT_SVR4_32 entries. 2001-02-11 01:29:43 +00:00
eeh 24defd04da Rename the tablet line discipline "tablet". 2001-02-11 01:28:47 +00:00
thorpej b016744976 Don't uvm_deallocate() the address space in exit1(). The address
space is already torn down in uvmspace_free() when the vmspace
refrence count reaches 0.  Move the shmexit() call into uvmspace_free().

Note that there is a beneficial side-effect of deferring the unmap
to uvmspace_free() -- on systems where TLB invalidations are
particularly expensive, the unmapping of the address space won't
have to cause TLB invalidations; uvmspace_free() is going to be
run in a context other than the exiting process's, so the "pmap is
active" test will evaluate to FALSE in the pmap module.
2001-02-10 05:05:27 +00:00
itojun d1507261c4 return ECONNABORTED, if the socket (tcp connection for example)
is disconnected by RST right before accept(2).  fixes PR 10698/12027.
checked with SUSv2, XNET 5.2, and Stevens (unix network programming
vol 1 2nd ed) section 5.11.
2001-02-07 12:20:43 +00:00
eeh ec22628573 Move maxdmap and maxsmap where they belong and make them big enough. 2001-02-06 19:54:43 +00:00
eeh 4380259bc7 Specify a process' address space limits for uvmspace_exec(). 2001-02-06 17:01:51 +00:00
chs eef7499a6c in vtruncbuf(), pass 0 (meaning everything at or past the start of the range)
instead of the vnode's size to pgo_flush() since there can be pages past EOF.
in the same call, cast "lbn" to voff_t to avoid overflow.
2001-02-06 10:58:55 +00:00
pk 11c1f60120 When freeing a session, remove the reference to it from the associated tty. 2001-02-04 22:32:24 +00:00
eeh e938c4e842 *NEVER* cast a reference parameter (unless you're using C++). 2001-02-04 19:12:09 +00:00
mrg d4dfeaf200 add sunos32 support. 2001-02-02 07:30:22 +00:00
enami 6dcc7e3de4 Don't use PR_URGENT to allocate page header. We don't want to just panic
on memory shortage.  Instead, use the same wait/nowait condition with the
item requested, and just cleanup and return failure if we can't allocate
page header while we aren't allowed to wait.
2001-01-29 02:38:02 +00:00
thorpej cfa7048975 Regen; getpid(2) is MP-safe. 2001-01-27 07:48:28 +00:00
thorpej 8740614bad getpid(2), our first MP-safe syscall! 2001-01-27 07:47:26 +00:00
thorpej 1b6a66420e Regen; add sy_flags. 2001-01-27 07:23:06 +00:00
thorpej 1628dd441e Add a "sy_flags" to struct sysent, define a SYCALL_MPSAFE
system call flag (indicating that the kernel lock does not
need to be acquired when entering the kernel on that syscall).
2001-01-27 07:21:43 +00:00
itojun 6e24d735f0 when the peer is disconnected before accept(2) is issued,
do not return junk data in mbuf (= sockaddr on accept(2)'s 2nd arg).
set the length zero.

behavior checked with bsdi and freebsd.
partial solution to PR 12027 and 10698 (need more investigation).
2001-01-22 18:14:11 +00:00
jdolecek d9466585b7 make filesystem vnodeop, specop, fifoop and vnodeopv_* arrays const 2001-01-22 12:17:35 +00:00
jdolecek d0a540b250 rename vfs_op_init() to vfs_op_check() and make it only check the offsets
and number of ops, not touch anything - vnode_if.sh now generated
proper offset numbers; vfs_op_check() is only defined and called for DEBUG
kernels

constify extern declaration of vfs_op_descs[]
g/c vfs_opv_numops, use VNODE_OPS_COUNT instead
make vfs_opv_init_explicit() and vfs_opv_init_default() static
2001-01-22 09:57:25 +00:00
jdolecek c3f6f769a3 regen: *_desc are generated correctly, new VNODE_OPS_COUNT,
structures constified
2001-01-22 09:53:31 +00:00
jdolecek 950412b4f5 when generating individual *_desc, generate also proper offsets so that
then don't need to be patched at runtime
add new define VNODE_OPS_COUNT (to vnode_if.h) so that the number is known
at compile-time
make stuff const, it now can be
2001-01-22 09:52:21 +00:00
martin d1ff650a0c Regen after de-const-ing. 2001-01-19 12:24:09 +00:00
martin c9803fbf98 Remove over-const-ification.
This structures are actually modified at kernel init time by vfs_op_init.

XXX - looks like the state after initialization is pretty const and with
some magic in the generator script (and appropriate changes to vfs_op_init)
it could be made const.
2001-01-19 12:22:56 +00:00
jdolecek 34c8ae80da constify 2001-01-18 20:28:15 +00:00
thorpej 2f89e3d744 Explicitly include <machine/intr.h> if __HAVE_GENERIC_SOFT_INTERRUPTS. 2001-01-17 18:21:41 +00:00
fvdl ea08a209b5 Adapt for procfs_valid* argument change. 2001-01-17 01:13:23 +00:00
thorpej d74e432ed3 Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().
2001-01-15 20:19:50 +00:00
thorpej 7200d34a76 Whenever ps_sigcheck is set to true, signotify() the process, and
wrap this all up in a CHECKSIGS() macro.  Also, in psignal1(),
signotify() SRUN and SIDL processes if __HAVE_AST_PERPROC is defined.

Per discussion w/ mycroft.
2001-01-14 22:31:58 +00:00
thorpej a624c70966 Use splvm(), not the home-grown splmem(). 2001-01-14 02:08:35 +00:00