Commit Graph

3710 Commits

Author SHA1 Message Date
hannken fbae381aaa The file system snapshot pseudo driver.
Uses a hook in spec_strategy() to save data written from a mounted
file system to its block device and a hook in dounmount().

Not enabled by default in any kernel config.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-12-10 11:40:11 +00:00
atatat 38f213672c Make kern.sbmax writeable again as well.
From a follow-on to PR kern/23695 by a Mr. Davis, which I missed at a
quick glance.
2003-12-09 01:52:07 +00:00
atatat a5d6d5ebfd Make kern.logsigexit writeable again.
Fixes PR kern/23695.
2003-12-09 01:25:33 +00:00
hannken 37efcf9045 Fix the last commit(s). On machines with sizeof(long) != sizeof(int)
the hash compare would fail.
2003-12-08 14:23:33 +00:00
hannken 10654a5c0a Fix last commit. The current spl was an implicit argument to the ACQUIRE
macro.  With help and approval from YAMAMOTO Takashi <yamt@netbsd.org>
2003-12-08 14:21:25 +00:00
martin 8c36f2238a Add missing break. 2003-12-07 10:33:03 +00:00
he 073a54fdfa Also make declaration of sysctl_kern_maxptys() depend on NPTY > 0.
Makes the mvme68k RAMDISK kernel compile again.
2003-12-07 10:31:32 +00:00
chs 291c877a9c add support for more than 2 PT_LOAD sections. from OpenBSD. 2003-12-07 02:18:53 +00:00
martin c70b2edfae Fix kern.cp_time for MULTIPROCESSOR kernels: calculate size of result
correctly, free original instead of incremented pointer, copy results for
n = -2 case too, so top shows correct stats.
Additionaly, rearange code for better readability (from Andrew).
2003-12-06 21:33:51 +00:00
fvdl 150a6bd869 Include opt_posix.h for the P1003_1B_SEMAPHORE define.
Include <machine/cpu.h> just to be sure.
2003-12-06 20:06:11 +00:00
yamt 8e92859632 rev.1.55 didn't handle BUFQ_SORT_CYLINDER case correctly.
pointed by Juergen Hannken-Illjes.  patch provided by him.
2003-12-06 17:23:22 +00:00
yamt 88046c4ce5 fix a debug code to follow recent change about tailing slashes. 2003-12-06 14:17:13 +00:00
yamt e5d5094296 - turn non-verbose parts of NAMEI_DIAGNOSTIC into normal DEBUG.
- comments on #endif.
2003-12-06 14:16:11 +00:00
martin fb5bbc3d78 We can not count CPUs at sysctl initialization time - so don't make
hw.ncpu an immediate value.
2003-12-06 09:36:34 +00:00
atatat 936b72608c Don't need those any more 2003-12-06 04:25:57 +00:00
atatat 44f5f6b89b The missing pieces of PROC_PID_STOPEXIT/P_STOPEXIT, a sysctl tweakable
flag that makes a process stop as it exits.
2003-12-06 04:16:33 +00:00
atatat 4673a65de6 #include "opt_multiprocessor.h"
This makes hw.ncpu and kern.cp_time work better on those platforms.
2003-12-06 02:52:29 +00:00
simonb efee714557 Wrap long line. 2003-12-06 01:53:14 +00:00
he b2518d1259 Make sure buf_inorder() returns a value under all conditions. 2003-12-06 01:21:23 +00:00
jdolecek 43dfb7e7a8 add #ifdef DEBUG segnum sanity check in shm_delete_mapping() 2003-12-05 22:09:56 +00:00
jdolecek 0e253cf5f5 back the sigfilter emulation hook change off 2003-12-05 21:12:42 +00:00
fvdl 9038f863f4 Resurrect include of opt_insecure.h to get the INSECURE definition.
From Kouichirou Hiratsuka on current-users.
2003-12-05 16:19:09 +00:00
yamt a9133ee855 buf_inorder: deal with 64-bit daddr_t correctly. 2003-12-05 10:16:16 +00:00
atatat 13f8d2ce5f Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 19:38:21 +00:00
drochner 0b653612f0 fix typo in comment 2003-12-04 19:23:00 +00:00
manu 18e13eee35 Add a sigfilter emulation hook. It is used at the beginning of kpsignal2()
so that a specific emulation has the oportunity to filter out some signals.

if sigfilter returns 0, then no signal is sent by kpsignal2().

There is another place where signals can be generated: trapsignal. Since this
function is already an emulation hook, no call to the sigfilter hook was
introduced in trapsignal.

This is needed to emulate the softsignal feature in COMPAT_DARWIN (signals
sent as Mach exception messages)
2003-12-03 20:24:51 +00:00
dbj 076b9a1a1e when ifdef DEBUG and debug_verify_freelist != 0
then perform an expensive search of the buffer freelists
in brelse and bremfree to verify consistency
2003-12-02 04:18:19 +00:00
dbj 2162bce654 add explanatory comment in bremfree:
We break the TAILQ abstraction in order to efficiently remove a
 buffer from its freelist without having to know exactly which
 freelist it is on.
2003-12-02 03:36:33 +00:00
christos d16297df4c PR/23613: Christian Biere: Bogus bounds check in nanosleep. 2003-12-02 01:34:30 +00:00
dbj 37a927564e In vclean(DOCLOSE), if vinvalbuf fails because of a write error,
then redo the vinvalbuf without the V_SAVE which will force
unflushed buffers to be discarded.
2003-12-01 18:53:10 +00:00
provos a0ce863234 fix off by one in find_last_set(); triggered for processes that have no
open file descriptors; found by tim robbins from freebsd
2003-11-30 18:16:45 +00:00
jdolecek ae0ead8db3 fix semaphore ID bound checking
problem pointed and patch provided in kern/23585 by Jeff Ito
2003-11-29 11:43:25 +00:00
matt 7bf0959ab7 Restore a change that made AF_LOCAL sockets block on connect(2) until
accepted.  However, this time this behavor is not the default.  Instead
it must enabled by using the LOCAL_CONNWAIT socket option on either the
connecting or accepting socket.
2003-11-29 10:02:42 +00:00
perry 6032efb56d Revert a change that altered the semantics of AF_LOCAL sockets. Sadly
this made us API incompatible with other Unixes.
2003-11-29 06:08:29 +00:00
scw c65769f7cf Cast to pointer via intptr_t. 2003-11-28 08:18:03 +00:00
manu d662d7555d Make the wakeup optionnal in proc_stop, so that it is possible to stop a
process without waking up its parent.
2003-11-27 23:16:47 +00:00
yamt 49f98b206e fdcopy: copy inline bitmaps properly.
hopefully fixes PR/23469.
2003-11-26 12:42:28 +00:00
cl 4da6cdf9f6 Fix check for pending upcalls after we return stacks.
Noted by yamt@.
2003-11-25 10:05:17 +00:00
manu 1147a0b1e6 Enable tracing of out of line data sent with Mach message 2003-11-24 16:51:33 +00:00
yamt f9d2295ad0 turn ACQUIRE macro into a function by introducing new internal
flags, LK_SHARE_NONZERO and LK_WAIT_NONZERO.  from FreeBSD.
2003-11-23 08:57:16 +00:00
dbj 6a88e9174b add "show mount" ddb command 2003-11-18 18:26:18 +00:00
martin ccd8c9e649 Remove spurious space accidently introduced in last. 2003-11-18 13:13:03 +00:00
martin 63a3b1e4ae Change K&R string literal continuation lines to ANSI C string concatenation.
Fixes PR kern/23474.
2003-11-18 13:01:21 +00:00
cl ac4fd64ba5 - remove blocked/unblocked upcall ordering.
- always wait for unblocked upcall if we have to continue a blocked
  thread.

=> removes wakeup from sys_sa_stacks when a stack is returned.
=> avoids extra sa_unblockyield syscall when unblocked upcall is
   delivered before blocked upcall is processed.
=> avoids double pagefault if we continued a thread before the
   pagefault was resolved.
=> avoids losing unblocked state if we continued a thread after
   skipping the unblocked upcall.
2003-11-17 22:57:52 +00:00
cl 2e11d201c2 - use list to keep track of free stacks.
- use splay tree for the pagefault check if the thread was running on
  an upcall stack.

=> removes the limitation that all upcall stacks need to be
   adjoining and that all upcall stacks have to be loaded with the
   1st sys_sa_stacks call.
=> enables keeping information associated with a stack in the kernel
   which makes it simpler to find out which LWP is using a stack.
=> allows increasing the SA_MAXNUMSTACKS without having to
   allocate an array of that size.
2003-11-17 22:52:09 +00:00
christos d0d2881501 expose proc_stop; needed by mach/darwin emulation 2003-11-17 19:21:56 +00:00
wiz 4bbfee09ca Various typo fixes from Jonathon Gray via jmc@openbsd. 2003-11-17 11:16:10 +00:00
cube d3730f1c68 o Fix a bug in ksyms that changed the real meaning of st_name entries for
symbols, and made it impossible for the kernel to use that value, and
  correctly find symbols from LKMs.
o Allow LKM users to use DDB to debug the entry function of a LKM by
  loading the symbol table with the temporary name /lkmtemp/ before calling
  it, and then renaming it once we know the module name.

Approved by ragge@.
2003-11-17 10:16:18 +00:00
keihan 0714799990 www.netbsd.org -> www.NetBSD.org 2003-11-17 10:07:58 +00:00
thorpej 48afa79adc We have CVS; there is no reason to make .bak files when generating the
syscall table and vnode interface tables.
2003-11-15 20:26:02 +00:00
thorpej 001102c808 Regen: fsync_range(2) system call. 2003-11-15 01:20:48 +00:00
thorpej 857f24339f Kernel portion of the fsync_range(2) system call. Written by Bill
Studenmund, and contributed by Wasabi Systems, Inc.
2003-11-15 01:19:38 +00:00
jonathan a03a5696d5 include <sys/mbuf.h> before FAST_IPSEC-dependent headers. 2003-11-14 07:13:25 +00:00
yamt 5ee0718f8f plug memory leak on error. 2003-11-13 11:59:46 +00:00
chs e07f0b9362 eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed.  however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors.  most of
the callers of uvm_useracc() make the above incorrect assumption.  the
rest are all misguided optimizations, which optimize for the case
where an operation will fail.  we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors.  since there appear to be no good uses of uvm_useracc(), we'll
just remove it.
2003-11-13 03:09:28 +00:00
chs 709a3b4e52 two changes in improve scalability:
(1) split the single list of pages allocated to a pool into three lists:
     completely full, partially full, and completely empty.
     there is no longer any need to traverse any list looking for a
     certain type of page.

 (2) replace the 8-element hash table for out-of-page page headers
     with a splay tree.

these two changes (together with the recent enhancements to the wait code)
give us linear scaling for a fork+exit microbenchmark.
2003-11-13 02:44:01 +00:00
jonathan fa24e6f3f8 Add m_tag_delete_nonpesrsistent(), for deleting all packet tags on
mbuf chains which are recycled (e.g., ICMP reflection, loopback
interface).  A consensus was reached that such recycled packets should
behave (more-or-less) the same way if a new chain had been allocated
and the contents copied to that chain.

Some packet tags may in future be marked as "persistent" (e.g., for
mandatory access controls) and should persist across such deletion.
NetBSD as yet hos no persistent tags, so m_tag_delete_nonpersistent()
just deletes all tags. This should not be relied upon.
2003-11-13 01:48:12 +00:00
cl e2c29624f5 Prevent sa_newcachelwp() from creating new LWPs when the process is exiting.
This should fix PR 23418 which was also reported by Thomas Klausner and
Ian Fry (who also provided core dumps for analysis - thanks!).

Also g/c sa_yieldcall since it's now safe to put LWPs back into the cache.
Also return stacks in failure case.
2003-11-12 21:27:46 +00:00
dsl 0342c9586a - Count number of zombies and stopped children and requeue them at the top
of the sibling list so that find_stopped_child can be optimised to avoid
  traversing the entire sibling list - helps when a process has a lot of
  children.
- Modify locking in pfind() and pgfind() to that the caller can rely on the
  result being valid, allow caller to request that zombies be findable.
- Rename pfind() to p_find() to ensure we break binary compatibility.
- Remove svr4_pfind since p_find willnow do the job.
- Modify some of the SMP locking of the proc lists - signals are still stuffed.

Welcome to 1.6ZF
2003-11-12 21:07:37 +00:00
dbj d3bad238a2 XXX an impossible malloc failure check in set_statfs_info 2003-11-12 20:38:24 +00:00
yamt c337d7540c fix typos in comments. 2003-11-09 07:57:15 +00:00
yamt 29352ed442 - fix an use-after-free bug in /dev/fd/* handling.
specifically, don't keep a stale pointer in fd_ofiles.
  it isn't needed anymore as fd allocation is now done using bitmaps.
- clean up dupfdopen() a little.
- don't call fd_used() unnecessarily.
2003-11-09 07:55:38 +00:00
yamt 1fc953c5e2 in the non-overwritten case of sys_dup2(),
call fd_used() by itsself rather than leaving it to finishdup().
2003-11-09 07:52:26 +00:00
dbj 84865d5d4f protect a few uses of buf's b_flags with b_interlock 2003-11-08 04:22:35 +00:00
cl 4d3b1ee6dc always set L_SA_UPCALL if the LWP on the VP is asleep 2003-11-07 18:37:41 +00:00
cl 716d179db5 make lwp running again if we don't switch away in sa_switch(), return is
not enough.  (noticed by yamt@)
2003-11-07 11:59:48 +00:00
ragge c556165f92 Do not try to enter more than MAX_INT16 symbols into the patricia tree;
the not-entered symbols will be found anyway but via a linear-search.
This only happens if something is wrong when linking the kernel.
Fixes problems reported on port-hp700.
2003-11-06 18:22:01 +00:00
dsl aed7f069e5 Ensure that the controlling tty is unlinked from the session and pgrp.
Due to the way the console is handled, neither the revoke() nor vrele()
is guaranteed to be seen by the real, underlying tty.
2003-11-06 09:30:13 +00:00
dsl 96e2f904d9 Remove a pile of redundant (caddr_t) casts. 2003-11-06 09:16:22 +00:00
dsl 2ffbd2ab99 Remove p_nras from struct proc - use LIST_EMPTY(&p->p_raslist) instead.
Remove p_raslock and rename p_lwplock p_lock (one lock is enough).
Simplify window test when adding a ras and correct test on VM_MAXUSER_ADDRESS.
Avoid unpredictable branch in i386 locore.S
(pad fields left in struct proc to avoid kernel bump)
2003-11-04 10:33:15 +00:00
cl 66c8bc7693 Reimplement VP donation such that multiple unblocked upcalls can be
combined.  Also prepare for adding VP repossession later.

- kern_sa.c: sa_yield/sa_switch: detect if there are pending unblocked
  upcalls.
- kern_sa.c: sa_unblock_userret/sa_setwoken: queue LWPs about to invoke
  an unblocked upcall on the sa_wokenq.  put queued LWPs in a state where
  they can be put in the cache.  notify LWP on the VP about pending
  upcalls.
- kern_sa.c: sa_upcall_userret: check sa_wokenq for pending upcalls,
  generate unblocked upcalls with multiple event sas
- kern_sa.c: sa_vp_repossess/sa_vp_donate: g/c, restore original
  sa_vp_repossess
2003-11-03 22:34:51 +00:00
jdolecek a2ed003b8b sa_yield(): 'sa' is used only for KDASSERT(), so make it #ifdef DEBUG 2003-11-02 17:04:05 +00:00
jdolecek 1cfc34d60f use LIST_FOREACH() as appropriate 2003-11-02 16:42:22 +00:00
cl 763d8350f0 perform indention change left out of previous commit 2003-11-02 16:30:55 +00:00
cl 350dd95eff Cleanup signal delivery for SA processes:
General idea:  only consider the LWP on the VP for signal delivery, all
other LWPs are either asleep or running from waking up until repossessing
the VP.

- in kern_sig.c:kpsignal2: handle all states the LWP on the VP can be in
- in kern_sig.c:proc_stop: only try to stop the LWP on the VP.  All other
  LWPs will suspend in sa_vp_repossess() until the VP-LWP donates the VP.
  Restore original behaviour (before SA-specific hacks were added) for
  non-SA processes.
- in kern_sig.c:proc_unstop: only return the LWP on the VP
- handle sa_yield as case 0 in sa_switch instead of clearing L_SA, add an
  L_SA_YIELD flag
- replace sa_idle by L_SA_IDLE flag since it was either NULL or == sa_vp

Also don't output itimerfire overrun warning if the process is already
exiting.
Also g/c sa_woken because it's not used.
Also g/c some #if 0 code.
2003-11-02 16:26:10 +00:00
jdolecek b74c137c2a use LIST_FOREACH() where appropriate 2003-11-02 12:01:40 +00:00
wiz 0aca09fbc0 Fix two typos. From Tom Cosgrove via jmc@openbsd. 2003-11-02 09:49:20 +00:00
provos c224a63428 use fdremove to remove kqueue file descriptor so that bitmap information
is maintained correctly; found by Juergen Hannken-Illjes
2003-11-01 18:47:16 +00:00
jdolecek 8f8952e2b1 add a macro to copy ksiginfo_t, and use it in kern_sig.c:ksiginfo_put()
change suggested by Christian Limpach
2003-11-01 17:59:57 +00:00
jdolecek 3abecdb88d avoid stong words in comments 2003-11-01 17:35:42 +00:00
cl 5d2db86263 cleanup whitespace and debugging output 2003-11-01 15:36:35 +00:00
jdolecek 0b33ae64cb in sigtimedwait(), use malloc(9)ed (and thus wired) memory for the waitset
we pass via sigctx, so that it guaranteed that the memory wouldn't be
paged out at the time the signal arrives

potential problem pointed out by YAMAMOTO Takashi
2003-11-01 07:44:14 +00:00
christos ddb8b44bce include opt_malloclog.h 2003-11-01 07:07:31 +00:00
cl f6e633af3a - add missing P_WEXIT check
- assign lwp to sa_vp before setting P_SA/L_SA flags
- don't unlock/lock the kernel lock around mi_switch unnecessarily
2003-11-01 02:09:52 +00:00
cl b936d40f39 Avoid sneaking past signal delivery in sa_upcall_userret():
generate unblocked upcalls in sa_unblock_userret(), before signal
delivery/p_userret handling in userret().

Also defer getting state for preempted upcalls because on some ports
preemption can happen between sa_unblock_userret() and sa_upcall_userret().
2003-11-01 01:38:46 +00:00
cl 8edffb7356 Avoid race condition where an LWP is put into the cache before
its state is saved:
- don't sa_putcachelwp() in sa_vp_repossess/sa_vp_donate
- only defer saving the event LWP's state
- sa_putcachelwp() after the interrupted LWP's state is saved
2003-10-31 23:36:50 +00:00
cl 8904362ede Allow defer of event and interrupted LWP state independently.
Removes code duplication in sa_upcall_getstate() and allows
sa_upcall_getstate() to be used to get state of a single LWP.
2003-10-31 22:47:44 +00:00
cl def5d22a63 Don't PHOLD() in sa_putcachelwp() because the scheduler lock is held.
PHOLD() before grabbing the scheduler lock unless the lwp is curlwp.
2003-10-31 22:03:18 +00:00
drochner f1aa108dd8 -fix ELF_INTERP_NON_RELOCATABLE:
-obey ELF_LINK_ADDR in ELF_load_file()
 -set ELF_LINK_ADDR in the probe() function if needed
-make ELF_NULL_ADDR the default, so that probe() functions dont need
 to set it explicitely
-allocate buffer for interpreter name only if needed
2003-10-31 14:00:52 +00:00
simonb 183066a619 Remove some assigned-to but otherwise unused variables. 2003-10-31 03:32:19 +00:00
simonb 6d85c5e0d5 Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.
2003-10-31 03:28:12 +00:00
cl 68a0d153d2 Don't grab the sched lock in lwp_continue() because lwp_continue() is
called from kpsignal2() with the sched lock held.  Get the lock in
sys__lwp_continue() instead.
2003-10-30 23:31:21 +00:00
jdolecek 5a9f1cf173 ksiginfo_put(): only copy what's needed of ksiginfo_t, to slightly optimize
the operation, and improve code readability at the same time
2003-10-30 16:32:58 +00:00
provos 4b425670af use a two-level bitmap as suggested by mogul and banga for fdalloc;
approved thorpej@
2003-10-30 07:27:02 +00:00
thorpej 67f69c1c63 Make callout_setfunc() a CPP macro. Suggested by enami. 2003-10-30 04:32:56 +00:00
simonb b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
thorpej db71356cd1 - Change callout_setfunc() to require that the callout handle is already
initialized.  Update the txp(4) to compensate.
- Statically initialize the TCP timer callout handles in the tcpcb
  template.  We still use callout_setfunc(), but that call is now much
  less expensive.  Add a comment that the compiler is likely to unroll
  the loop (so don't sweat that it's there).
2003-10-27 16:52:01 +00:00
fvdl 404fa205d1 Fix (bogus) unitialized variable warning. 2003-10-26 20:55:57 +00:00
jdolecek ad67de5ad8 move ALLOCSYS() macro from <sys/systm.h> to kern_alloc.c - it's the
only place which uses it
2003-10-26 10:45:03 +00:00
jdolecek 2e59e9ae06 allocate virtual memory for SYSV shm, msg and semaphore structures
separately from the bufpages, so that it would be possible to eventually
make their limits changeable in runtime

make static all local variables which do not need to be exported to other
kernel parts
2003-10-26 10:32:24 +00:00