Commit Graph

3903 Commits

Author SHA1 Message Date
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
lukem f85d2d1c14 Use ${HOST_SH} instead of `sh'.
If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
2003-10-26 07:25:33 +00:00
christos 2017bf9a94 Fix uninitialized variable warning 2003-10-25 18:31:59 +00:00
jdolecek 0c303462c5 modify sigtimedwait(2) to return full siginfo if available, and pass the wait
set using a pointer, to save couple bytes in struct sigctx

also fix fallout from recent lwp_wakeup() change, where we failed to properly
detect if tsleep() returned as result of lwp_wakeup() or signal outside
our wait set; could have caused problems for threaded apps using sigwait(2)
et.al.
2003-10-25 16:50:37 +00:00
yamt 01de53d5f4 don't assume the order of upcall stacks in the array from userland.
(it's reversed in the case of topdown vm.)

kern/23266 from Kouichirou Hiratsuka and tested by him.
2003-10-25 12:08:45 +00:00
christos cb02efca51 fix uninitialized variable 2003-10-25 09:06:51 +00:00
christos 9ff8e797c6 fix uninitialized variables. one of them is a compiler bug. 2003-10-25 09:03:59 +00:00
kleink 661f76699f POSIX: when attempting to fdatasync(2) a file which is not open for
writing, fail with EBADF.
2003-10-25 01:18:01 +00:00
yamt a526db13df sa_unblockyield:
don't assert that syscall arguments are sane.
return an appropriate error instead.
2003-10-24 16:11:21 +00:00
yamt 3f32c6ab70 don't use NULL as vaddr_t. 2003-10-24 00:53:43 +00:00
thorpej 4011fcfefd Cache the "adjusted" value of sb_max when sb_max is changed, in order
to avoid doing quad math in sbreserve().

Change suggested by Simon Burge, and code inspired by a similar change
in FreeBSD.
2003-10-21 22:55:47 +00:00
manu a591d65ec7 One more section type in the Mach-O format. Now /usr/X11R6/bin/quartz-wm links
and run (it aborts because the dock is not launched).
2003-10-20 22:42:40 +00:00
wiz 48f28cea9e sa_vp_faultaddr, sa_vp_ofaultaddr, sa_vp_stacks_low, and sa_vp_stacks_high
are vaddr_t (and thus unsigned long).
Initialize them with 0 instead of NULL.
Closes PR 23204 by Dheeraj Reddy.
2003-10-20 07:15:26 +00:00
manu d77ec799a5 Support Darwin static binaries (I should say: support the only Darwin
static binary: otool). Dynamic binaires have a pointer to the Mach-O
header on the top of the stack, static binaries don't have this, and
having it produced a crash.

One bugfix: the EXEC_MACHO code assumes that entry = NULL means that
the entry point has not been found in the load commands seen so far.
Therefore we need to initialized entry to NULL if we want a static binary
to discover it. (dynamic binaries were forced to iscover it because when
the intepreter load command is found, entry is updated whatever its
value was before).

One hack: Both COMPAT_MACH and COMPAT_DARWIN are willing to run Mach-O
binaries. COMPAT_MACH fails for dynamic binaries because it cannot find
the interpreter in /emul/mach. For static binaires, it will accept them
(and for Darwin static binaries, this will cause a failure). Until we
rite a test for matchinf Darwin static binaries, just swap the order of
COMPAT_MACH and COMPAT_DARWIN in the exec switch so that COMPAT_DARWIN
is tried first (this will have the advantage of speeding up program
startup). EXECSW_PRIO_{FIRST_LAST} does not seem to work...
2003-10-19 07:52:22 +00:00
simonb 59fb31d7cc Remove unreachable break after return and goto statements. 2003-10-19 01:44:48 +00:00
thorpej eea31306c8 Remove the superuser check for MNT_FORCE on new mounts. It's been
pointed out by several people that it offers no real protection.
2003-10-15 17:26:38 +00:00
hannken a3a898ff0f Add the gating of system calls that cause modifications to the underlying
file system.
The function vfs_write_suspend stops all new write operations to a file
system, allows any file system modifying system calls already in progress
to complete, then sync's the file system to disk and returns. The
function vfs_write_resume allows the suspended write operations to
complete.

From FreeBSD with slight modifications.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-10-15 11:28:59 +00:00
dbj fe7c786886 add mnt_iflag field to struct mount for internal flags
mv MNT_GONE, MNT_UNMOUNT and MNT_WANTRDWR to this field
additonally add mnt_writeopcountupper and mnt_writeopcountlower fields
in preparation for pending write suspension support work
bump kernel version to 1.6ZD
2003-10-14 14:02:56 +00:00
thorpej a58b40631e * Shuffle some flags to make it easier to visually compare lists
of flags.
* In the new mount case, make sure to clear the mount "action" flags.
* Allow MNT_FORCE to be set by root on new mounts.
2003-10-13 18:02:20 +00:00
pk db855cea5a ksiginfo_get/exit hook: protect queue operations with splsoftclock() (noted
by Christos).
2003-10-12 20:09:50 +00:00
pk a749472593 ksiginfo_put: protect queue operation with splsoftclock(), since it can
be called from timer interrupts.
2003-10-12 14:32:05 +00:00
chs d2835f509a use "poll" as the wmesg for poll. 2003-10-10 15:24:28 +00:00
lukem 1c33b4e6a4 Overhaul MBR handling (part 1):
<sys/bootblock.h>:
    *	Added definitions for the Master Boot Record (MBR) used by
	a variety of systems (primarily i386), including the format
	of the BIOS Parameter Block (BPB).
	This information was cribbed from a variety of sources
	including <sys/disklabel_mbr.h> which this is a superset of.

	As part of this, some data structure elements and #defines
	were renamed to be more "namespace friendly" and consistent
	with other bootblocks and MBR documentation.
	Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
    *	Deprecated in favor of <sys/bootblock.h> (the latter is more
	"host tool" friendly).

amd64 & i386:
    *	Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
	be consistent with the naming convention of the msdosfs tools.

    *	Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
	and it's confusing to have two functionally equivalent bootblocks,
	especially given that "ufs" has multiple meanings (it could be
	a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

    *	Rework pbr.S (the first sector of bootxx_*):
	    +	Ensure that BPB (bytes 11..89) and the partition table
		(bytes 446..509) do not contain code.
	    +	Add support for booting from FAT partitions if BOOT_FROM_FAT
		is defined.  (Only set for bootxx_msdos).
	    +	Remove "dummy" partition 3; if people want to installboot(8)
		these to the start of the disk they can use fdisk(8) to
		create a real MBR partition table...
	    +	Compile with TERSE_ERROR so it fits because of the above.
		Whilst this is less user friendly, I feel it's important
		to have a valid partition table and BPB in the MBR/PBR.

    *	Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
	with other platforms.

    *	Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
    	we can boot off FAT partitions.

    *	Crank version of /usr/mdec/boot to 3.1, and fix some of the other
	entries in the version file.

installboot(8) (i386):
    *	Read the existing MBR of the filesystem and retain the BIOS
    	Parameter Block (BPB) in bytes 11..89 and the MBR partition
	table in bytes 446..509.  (Previously installboot(8) would
	trash those two sections of the MBR.)

mbrlabel(8):
    *	Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
	to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
2003-10-08 04:25:43 +00:00
thorpej 68723a995b * Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
  result of a trap.  Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap.  Expands to 0 if the ksiginfo_t was
  not the result of a trap.  This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
  Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
  the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern.  Reviewed and OK's by Christos.
2003-10-08 00:28:40 +00:00
thorpej bcf389773b Whitespace nits. 2003-10-07 00:23:17 +00:00
christos e59ff2cb68 Don't look for file descriptor matches when a process is exiting. From
Andrey Petrov.
2003-10-04 03:45:49 +00:00
itojun 98d5598feb when dropping M_PKTHDR, need to free m_tag associated with it. 2003-10-03 20:56:11 +00:00
christos 754bffb7e7 Fix problem with signal trampoline version checking that did not take into
account that emulations usually use version 0 and provide their own in kernel
trampolines.
2003-10-03 17:51:13 +00:00
christos 1f6ab188f9 If the user passes enough space, output the per cpu states instead of
aggregating them.
2003-10-03 15:33:42 +00:00
kleink cad1622bfb Need opt_posix.h for P1003_1B_SEMAPHORE. 2003-10-02 09:30:16 +00:00
itojun d104a1a89a make debug_sysctl() sysctl MIB check more strict. from smak.
attack similar to NetBSD-SA2003-014 can be mounted due to this flaw.
2003-10-01 21:45:14 +00:00
cl 1453f2ca48 make sa_vp_donate update p_nrlwps when it retires an LWP 2003-10-01 14:50:06 +00:00
christos 7bd9c302eb Regen 2003-09-30 20:36:40 +00:00
christos 4420def0dc #ifdef _LIBC the semid_t syscalls since we don't define semid_t in userland
except in the libc case.
XXX: Should we define __semid_t instead and make those visible from userland
again? Only ktrace and syscall() get affected.
2003-09-30 20:36:10 +00:00
christos a474dc2106 Keep track of which prototypes we declared already so that we don't
declare them again.
2003-09-30 20:34:28 +00:00
cb 93491c15d3 fix O_NOFOLLOW for non-O_CREAT case.
Reviewed by: christos@ (some time ago)
2003-09-29 10:04:03 +00:00
dsl eed203ed54 Simod has persuaded me to remove the 'sizeof (struct kinfo_drivers)' field. 2003-09-28 13:24:48 +00:00
mycroft ad3b20a692 A nit I ran into while copying this code for something else... 2003-09-27 23:10:47 +00:00
dsl 84577b4fe4 Add kern.root_partition (sysinst needs to know it)
Add kern.drivers - reports driver names and major numbers
Remove some redundant caddr_t casts.
2003-09-27 07:58:55 +00:00
matt 3ce59aebf3 Deal with signal trampoline being const. 2003-09-27 00:57:45 +00:00
matt 2546f51a33 Regen. 2003-09-26 23:11:16 +00:00
matt ebb8ea4c89 Constify __sigaction_sigtramp argument 'void * tramp'. 2003-09-26 23:08:24 +00:00
matt 6986092cfe Add a machine-dependent SIGTRAMP_VALID macro which is used to test whether
a trampoline version is valid or not.
2003-09-26 22:14:19 +00:00
christos b2ceab3824 constify sendsig/trapsignal 2003-09-25 21:59:18 +00:00
scw a3b1a08d1e Fix for PR kern/22933
Avoid gcc3 pointer alias bugs caused by casting between struct callout
and struct callout_circq.
2003-09-25 10:44:11 +00:00
yamt 4e746c95f7 in getblk(), don't call allocbuf() for B_LOCKED buffers.
LFS misses total size of B_LOCKED buffer (locked_queue_bytes) when
getblk() re-size them.

XXX maybe needs a better fix.
2003-09-24 10:44:44 +00:00
nathanw b1a13994b7 When the syscall was made a compat syscall and the function name
changed to compat_16_sys___sigaction14, the name of the _args
structure chaged as well.
2003-09-23 17:59:48 +00:00
thorpej f0d728e698 Avoid a type punning warning in the MALLOC_DEBUG case. 2003-09-23 16:36:59 +00:00
christos 643e2f262c Regen 2003-09-23 14:34:38 +00:00
christos b601ca6ba8 __sigaction14 should have been COMPAT_16 a while ago. GC it now. 2003-09-23 14:34:07 +00:00
christos 6edc0e184e - pass signo to fownsignal [ok by jd]
- make urg signal handling use fownsignal
- remove out of band detection in sowakeup
2003-09-22 12:59:55 +00:00
jdolecek 7cea8a1389 cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
  the owner of descriptor, according to appropriate sematics
  of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
  these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
  properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
  in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
  pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
2003-09-21 19:16:48 +00:00
manu b01f5cf127 Extra sanity checks: all char devices won't have an associated tty. 2003-09-21 18:40:38 +00:00
christos 8cf3af3092 - support for siginfo_t in ktrace
- make sure allocation for ksiginfo_t worked
2003-09-19 22:51:31 +00:00
christos 070899d51e support for siginfo_t in ktrace 2003-09-19 22:50:02 +00:00
christos 59294d6a54 fix typo (ktr -> ksi) 2003-09-16 15:59:28 +00:00
drochner 3e287f891b Take into account the possibility that the ktrace flags can change
during a read(v)/write(v). If that happeded, we either passed a NULL
pointer or a pointer to something uninitialized as iov to ktrace,
or we got a memory leak. In read/write (w/o -v) we zero-initialize
the iov now to limit damage, in the -v calls the (dynamically allocated)
pointer is checked after the I/O.
2003-09-16 15:55:26 +00:00
cl 52a920b5da add comments to the pagefault code 2003-09-16 15:28:45 +00:00
cl d973127f38 Regen. 2003-09-16 13:49:23 +00:00
cl c08e54b26b fix SA/pthread pagefault failure:
- prevent BLOCKED upcalls on double page faults and during upcalls
- make libpthread handle blocked threads which hold locks
- prevent UNBLOCKED upcalls from overtaking their BLOCKED upcall
this adds a new syscall sa_unblockyield
see also http://mail-index.netbsd.org/tech-kern/2003/09/15/0020.html
2003-09-16 13:46:24 +00:00
christos 1f73cefd27 - convert to circleq
- add simple lock for the list
- make get function remove the item from the list
- eliminate superfluous functions
thanks to enami and matt for the feedback.
2003-09-16 12:07:11 +00:00
christos 5501eeaa6b add siginfo lock and siginfo queue initialization. 2003-09-16 12:06:07 +00:00
christos 31663f15a1 add initialization of siginfo lock and queue.
Also initialize the lock for lwps, although it is not used for proc0 for
code consistency.
2003-09-16 12:05:49 +00:00
christos 048fedf253 include opt_compat_netbsd.h, otherwise we don't get the right signal
trampoline code in compat code.
2003-09-15 00:33:35 +00:00
christos bed9693362 include <sys/poll.h> 2003-09-15 00:22:20 +00:00
christos e8ae1a44db ksiginfo_t support. 2003-09-14 23:47:09 +00:00
christos cc39a7a050 remove variable name from prototype. 2003-09-14 23:45:53 +00:00
christos ccb1345dde provide some more ksiginfo info. 2003-09-14 23:45:16 +00:00
christos ab8558b680 - don't trash the linked list pointers in the ksiginfo_t reuse case
[thanks enami]
- fix uninitialized variable in the exit hook.
  [thanks yamt]
2003-09-14 17:39:03 +00:00
yamt 966ada0097 assert that uio passed to uiomove() has valid uio_iovcnt. 2003-09-14 11:12:14 +00:00
yamt 0a4f15d329 when allocating a new vnode,
increment numvnodes before releasing vnode_free_list_slock.
2003-09-14 11:09:48 +00:00
christos 9970fc6a83 handle siginfo for deferred signals. Allocate a ksiginfo pool, and store
the information there.
TODO:
1. since timer stuff gets called from an interrupt context, we could
   preallocate ksiginfo_t's from the pool, so we don't need a kmem
   pool.
2. probably the sa signal delivery syscall can be changed to take
   a ksiginfo_t so we can use only one pool.
3. maybe when we add realtime signal support, add a resource limit
   on the number of ksiginfo_t's a process can allocate.
2003-09-14 06:59:13 +00:00
christos 24045725fc set the sigval in the setitimer case. 2003-09-14 06:56:22 +00:00
christos 35a41eaf06 enable SI_TIMER notification. 2003-09-13 22:39:18 +00:00
christos 4148967f74 provide siginfo_t in for SIGCHLD 2003-09-13 15:32:40 +00:00
jdolecek a034152027 move dupfd from struct proc to struct lwp - it's per-LWP, not per-process; we
use curlwp where the lwp is not directly available, i.e. in device open
routines

briefly discussed on tech-kern
2003-09-13 08:32:10 +00:00
christos 136f9cd821 PR/15397: Jason Thorpe: directory operations on pathnames that refer to
directories and have trailing slashes should succeed. Ok'd by kjk.
Fix provided by enami.
2003-09-11 17:33:42 +00:00
yamt ec0f99a001 acquire bqueue_slock around bremfree(). 2003-09-11 15:34:26 +00:00
christos 6b4bd0dc1b regen. 2003-09-11 14:00:21 +00:00
christos 71ee0b2991 - print comment in compat syscalls too.
- print ifdef's in the header files.
2003-09-11 13:59:49 +00:00
cl 96b4f15141 KNF and use f instead of s to temporarily save l_flag 2003-09-11 01:32:09 +00:00
drochner 6fb02278a3 Fix the "COW" case if a process does a detach() between fork()
and exit(): we have to lookup the entry in the private copy
again, otherwise the wrong list is manipulated.
should fix a panic on postgres shutdown reported by Marc Recht

being here, improve sone debug messages
2003-09-10 17:01:04 +00:00
christos cbd4e9f601 Regen 2003-09-10 16:44:12 +00:00
christos 883b4b0369 we don't need sigreturn and sigcode glue if we are not compat_16 anymore. 2003-09-10 16:43:34 +00:00
kleink 5c5edae988 sigaction1(): if SA_SIGINFO is set but not supported, fail early.
As discussed with Christos.
2003-09-10 16:41:26 +00:00
yamt 50401b2019 use curcpu() rather than curlwp->l_cpu. 2003-09-10 10:55:50 +00:00
cl f8a1f76075 fix timerupcall breakage after SA_SIGINFO changes:
- sa_upcall only stores a pointer to the `arg'
2003-09-09 15:16:30 +00:00
drochner 00c27c6064 Make per-process shm segment descriptor magement scale better for large
shminfo.shmseg, in view of the fact that only few processes utilize a
significant fraction of it:
-turn the table into a linked list, elements allocated from a pool(9)
-On fork(), just bump a refcount instead of copying the list; it will
 be decremented on exit() and exec(). Only copy if an attach or detach
 takes place in between, which is rarely the case.
2003-09-09 15:02:45 +00:00
itojun 311078a035 truncated output from pty problem. fix by enami
http://mail-index.netbsd.org/tech-kern/2003/09/06/0002.html
2003-09-08 11:14:18 +00:00
scw 20fb5a9f59 Cast from pointer type to db_addr_t via intptr_t. 2003-09-07 21:28:16 +00:00
yamt 02b67863b8 assert mbuf chains m_cat'ed are of the same type. 2003-09-07 12:04:13 +00:00
yamt 1c9095a5b6 buffer with B_CALL shouldn't be brelse'ed. assert it. 2003-09-07 11:59:40 +00:00
yamt 059404deaf bremfree needs bqueue_slock held. assert it. 2003-09-07 11:57:43 +00:00
manu 83798d2727 Correctly check Mach-O fat header so that fat binaries get launched. 2003-09-07 11:16:59 +00:00
jdolecek 671a5964fa one more sc_pgid change 2003-09-07 09:31:47 +00:00
jdolecek 0eb65eb6f2 for logsoftc.sc_pgid, use negative value for process group and positive
for process ID, to match e.g. how socket code sets things up
2003-09-07 09:30:20 +00:00
christos 1dc335c017 SA_SIGINFO changes. 2003-09-06 22:03:09 +00:00
jdolecek 465f95a5ec Embed information about kernel version and some of used kernel options
into compiled LKMs. Check this information when LKM is loaded into kernel
and refuse LKMs not matching currently running kernel. Provide LMFORCE
ioctl to skip this check for those feeling adventurous.

as discussed on tech-kern@, thanks to feedback from Bill Studenmund and others
2003-09-06 19:08:53 +00:00
wrstuden d9f694842d Adjust struct sockbuf and sorflush() so that we don't zero out
every field; some need to stay around.

Fixes a bug where by calling shutdown() on a socket with knotes
will cause the kernel to panic when the kernel closes the socket.
Other access, such as calling kevent() may also trigger the panic.

Debugged with help from Jason and Allen. Patch reviewed by same plus
Itojun and Matt Thomas.

This problem seems to be the same one that FreeBSD saw in their PR
number 54331.

Kernel version _not_ bumped as we will piggyback the bump earlier today.
2003-09-04 16:44:05 +00:00
matt 12588bd8b6 Adapt to the new calling conventions of unp_connect2 2003-09-04 04:33:49 +00:00
itojun 119a24cbdd clarify comment on m_cat(). 2003-09-04 04:10:32 +00:00
matt d7506a7151 Fix typo. 2003-09-03 22:20:34 +00:00
matt ecf95073f1 Change the behavor of AF_LOCAL connect() to sleep until the server has
accepted the connection.  This can prevent a client from overwhelming a
server.
2003-09-03 21:30:12 +00:00
ragge 412d4e7d1b Use correct basic types when addresses are given in function calls. 2003-09-03 11:36:52 +00:00
ragge 76d3da2d68 Do correct pointer casts. 2003-09-03 11:13:14 +00:00
ragge d13eca2ef5 long -> unsigned long. 2003-09-03 10:55:22 +00:00
drochner 98cfd7bc8b also feed getdents/readdir data to KTRACE 2003-09-02 12:31:35 +00:00
yamt b3d9c9a976 remove an obsolete comment. pointed by enami@ 2003-09-01 12:13:55 +00:00
fvdl 6c4d7c0fee Fix error in previous commit: the first vaddr_t argument to uvm_km_suballoc
is in/out, so it must be zeroed out before passing it, otherwise the
uvm_km_suballoc call would get stack garbage, and fail randomly.
2003-08-31 12:59:05 +00:00
ragge b20fe4bd92 Do not cast a pointer to a pointer with different basic type when given
as function argument. It makes assumptions about pointer internals
that do not necessarily have to be true.
2003-08-30 07:54:32 +00:00
enami 02a34f5f66 Use VM_DEFAULT_ADDRESS as a hint to map sigcode instead of an equivalent
value of !TOPDOWN_VM case.
2003-08-29 13:29:32 +00:00
junyoung d532b6f4e6 Expand NEW_VMCMD() macro to a real function new_vmcmd() for the
non-debugging case as well, rather than expanding it inline. This saves
a bunch of kernel bits, e.g. 4kB from GENERIC on i386.
2003-08-29 01:44:02 +00:00
enami 2340975258 Use vm_map_{min,max}() rather than accessing struct vm_map.header.{start,end}
directly.
2003-08-28 14:54:32 +00:00
manu e3ce76f536 Added a malloc freelist sanity check function, for debugging purposes 2003-08-26 21:48:53 +00:00
cb 5f734a1850 fix a race condition between path resolution in userland
and the subsequent namei(): inform the kernel portion of
valid filenames and then disallow symlink lookups for
those filenames by means of a hook in namei().
with suggestions from provos@

also, add (currently unused) seqnr field to struct
systrace_replace, from provos@
2003-08-25 09:12:42 +00:00
atatat 2768d776d4 Use pfind() in proc_sysctl() to find the target process instead of a
home-grown routine.  Remove defcorenamelen, since it's not used
anywhere.
2003-08-24 19:20:40 +00:00
chs 939df36e55 add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default.  the changes
fall into two basic catagories:

 - pmap and trap-handler changes.  these are all MD:
   = alpha: we already track per-page execute permission with the (software)
	PG_EXEC bit, so just have the trap handler pay attention to it.
   = i386: use a new GDT segment for %cs for processes that have no
	executable mappings above a certain threshold (currently the
	bottom of the stack).  track per-page execute permission with
	the last unused PTE bit.
   = powerpc/ibm4xx: just use the hardware exec bit.
   = powerpc/oea: we already track per-page exec bits, but the hardware only
	implements non-exec mappings at the segment level.  so track the
	number of executable mappings in each segment and turn on the no-exec
	segment bit iff the count is 0.  adjust the trap handler to deal.
   = sparc (sun4m): fix our use of the hardware protection bits.
	fix the trap handler to recognize text faults.
   = sparc64: split the existing unified TSB into data and instruction TSBs,
	and only load TTEs into the appropriate TSB(s) for the permissions.
	fix the trap handler to check for execute permission.
   = not yet implemented: amd64, hppa, sh5

 - changes in all the emulations that put a signal trampoline on the stack.
   instead, we now put the trampoline into a uvm_aobj and map that into
   the process separately.

originally from openbsd, adapted for netbsd by me.
2003-08-24 17:52:28 +00:00
itojun e5255bfd47 make proc.curproc.* check more strict. atatat 2003-08-24 06:11:19 +00:00
junyoung d366db246b TNF & remove trailing spaces. 2003-08-22 02:01:32 +00:00
yamt a7f9b1d8e0 don't make zero-sized mappings. 2003-08-21 15:17:03 +00:00
yamt 7847549d35 use LSDEAD instead of SDEAD for lwp state. 2003-08-20 14:04:00 +00:00
yamt 611b0b9f15 don't use a space char in wmesg.
it makes outputs of SIGINFO confusing.
2003-08-20 13:54:48 +00:00
yamt be09ed029e fix indent. 2003-08-20 13:50:53 +00:00
dsl 40bac1084c When writing the disklabel:
- Write label to all netbsd (type 169) mbr partitions (even if they don't
  already have a label).
- Update any label found in sector LABELSECTOR and sector 0.
Latter change makes DIOCWDINFO (etc) work on raidframe (fixing bin/22529).
2003-08-19 11:49:24 +00:00
simonb bc73aa40f5 Return NULL instead of 0 for functions that return pointers.
Sprinkle some KNF whitespace.
2003-08-15 02:59:32 +00:00
itojun 95758d3554 avoid oldlenp mixup (in-kernel pointer and userland pointer). from atatat 2003-08-14 05:14:52 +00:00
fvdl 8655b27bf5 SA fixes from Stephan Uphoff. Quoting him:
The patch below (hopefully) improves some signaling problems
found by Nathan.

It also contains some cleanup of the sa_upcall_userret() function
removing any sleep calls using PCATCH.

Unblocked threads now only use an upcall stack after they
acquire the virtual CPU.
This prevents unblocked threads from stealing all available
upcall stacks.


Tested by Nick Hudson.
2003-08-11 21:18:18 +00:00
dsl 3530472a3b Rework VTIME calculations so that they don't hit numeric overflow (ok now
for hz < ~200kHz).  Old code failed VTIME > 214 even with hz=100.
Fixes kern/12285.
2003-08-11 10:49:06 +00:00
pk 9f987d0ac0 Workaround to prevent a lockup in pipelock() in the case that signals are
pending while we must wait for the lock.
2003-08-11 10:24:41 +00:00
yamt a01f6f4ea5 - make this a bit MP friendly.
(although no actual changes under the kernel lock)
- remove a test that isn't meaningful anymore.
2003-08-08 20:19:56 +00:00
yamt 1f08924c29 arrange namecache lru before vget (and releasing namecache_slock)
since our namecache entry can go away during we're sleeping on the vnode.

the bug pointed by enami tsugutomo.
tested by Matthias Scheler.
PR/22363.
2003-08-08 20:18:19 +00:00
christos c3c2f78f98 GC: exec_foo_setup_stack; use exec_setup_stack, and provide a way for
emulations to override it.
2003-08-08 18:53:13 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
jonathan 60cc8ce6f9 (FAST_IPSEC): attach PFKEY socket domain when either (KAME) IPSEC or
FAST_IPSEC is configured. Likewise for sysctl.
2003-08-06 20:34:35 +00:00
jonathan 333cceb477 (FAST_IPSEC): Pull in option header-test for FAST_IPSEC (and IPSEC).
If FAST_IPSEC is configured, attach fast-ipsec transforms after
autoconfiguring devices (perhaps including crypto hardware)
but before starting up network-device packet input.
2003-08-06 20:30:38 +00:00
manu d41feb61a6 Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes
2003-08-06 01:02:26 +00:00
drochner a7a51432eb sy_narg isn't very useful where an argument can span two register_t slots
(as off_t on 32-bit platforms)
see PR kern/22297 by myself
2003-08-04 18:53:06 +00:00
he 69f1e70775 On second thought, callout_stop() should not clear the INVOKING flag. 2003-08-03 19:14:59 +00:00
manu 06da3d32ba Build again with MALLOCLOG 2003-08-02 07:08:02 +00:00
yamt 428f108569 remove remaining v_id. 2003-07-31 15:43:06 +00:00
yamt 2dc3c0a90c for NCHASH, obtain bits from the vnode pointer as well
to achieve a better hash distribution.
2003-07-31 15:14:08 +00:00
yamt 378afd773a when casting a pointer to an integer,
cast it to uintptr_t so that 64-bit archs will be happy.

pointed by Juergen Hannken-Illjes.
2003-07-31 15:13:05 +00:00
jonathan 460c06b905 Move the initialization of the crypto framework from the userland
pseudo-device to init_main(), so the framework is ready for
registration requests at autoconfiguration time.

Thanks to Quentin Garnier for confirming the change was required, and
for testing a similar fix.
2003-07-30 18:45:31 +00:00
yamt cc104d0635 eliminate v_id. 2003-07-30 12:10:57 +00:00
yamt b0cdf0a26d maintain the list of namecaches attached to the vnode.
it makes vnodes freeable.
2003-07-30 12:09:46 +00:00
matt 79fccc7527 Improve _lwp_wakeup so when it wakes a thread, the target thread thinks
ltsleep has been interrupted and thus the target will not think it was
a spurious wakeup.  (this makes syscalls cancellable for libpthread).
2003-07-28 23:35:20 +00:00
jdolecek b178c0d519 back rev 1.63 (the linux hack) off - no compat specific code
in generic code, please

we need to massage the passed linux cmsg anyway, linux uses different
alignment for CMSG_DATA on at least some architectures
2003-07-24 07:30:48 +00:00
itojun f874ab05b3 backout previous, there was a comment on LINUX_SOL_SOCKET=1 2003-07-23 22:17:54 +00:00
itojun 8e4006214d #define LINUX_SOL_SOCKET 1, so that we can answer "what the hell is this 1?"
at ease.
2003-07-23 21:42:31 +00:00
christos 8c26e4c591 From Todd Vierling: Accept level == 1 for linux compat. 2003-07-23 19:24:48 +00:00
dsl cfb2dd92f0 Fix (and simplify) interaction between check_pty() and pty_maxptys().
Lock setting/clearing of tp->t_oproc to guarantee concurrent opens can't
both suceed and that code in tty.c can't get a NULL t_oproc if the value
is re-read after being checked.
There are still MP issues with pt_flags, pt_send and pt_unctl.
Maybe problems that require TTY_LOCK() to be taken before calling std tty
functions.
2003-07-23 13:10:28 +00:00
nathanw 6b22e87c69 Whitespace. 2003-07-21 22:57:46 +00:00
nathanw f0dee7380d KNF a bit. 2003-07-21 19:21:12 +00:00
he ddef043b97 Temporarily introduce CALLOUT_INVOKING, callout_invoking() and callout_ack()
to make users of the callout facility able to cooperate to work around the
race caused by the callout code lowering interrupt priority level when
invoking callout handlers, something which allows other code to run before
the callout handler gets to it's spl*() call.

This is to enable the workaround for the TCP code found in PR#20390 to be
applied.

This should be backed out once a more comprehensive fix can be put in
place.
2003-07-20 16:25:57 +00:00
fvdl e4f5334745 Unlock kq_lock in the case of a timeout. 2003-07-18 17:34:07 +00:00
matt 0c7a583f3a Add support for storing the priority mask in sched_whichqs in MSB order
(enabled by defining __HAVE_BIGENDIAN_BITOPS in <machine/types.h>).  The
default is still LSB ordering.  This change will allow the powerpc MD
implementations of setrunqueue/remrunqueue to be nuked.
2003-07-18 01:02:31 +00:00
fvdl 091ff13b7b Move nstacks assertion and stack assignment to an earlier time, before
the sa_vp_repossess call. From Stephan Uphoff.
2003-07-17 20:34:41 +00:00
fvdl 84078486a4 Return the value of 'error' instead of always 0. From Christian Limpach. 2003-07-17 19:05:30 +00:00
fvdl 4bd1a8dcf8 Changes from Stephan Uphoff to patch problems with LWPs blocking when they
shouldn't, and MP.
2003-07-17 18:16:58 +00:00
dsl 0e2308c0c0 Add ktrace of env and args during exec. 2003-07-16 22:42:47 +00:00
lukem 09b3191490 add missing __KERNEL_RCSID() 2003-07-14 14:59:01 +00:00
dsl d38f6f3115 MI code to read disklabels from mbr disks. 2003-07-07 13:28:48 +00:00
thorpej 3ce3399c7b Add a dev_propdb to hold device properties. Properties are already being
used in an ad hoc way by a couple of eval board ports, so might as well
tidy it up a little and add some formality.  (And, yes, I need to use it
in another eval board port.)
2003-07-04 00:24:29 +00:00
ragge ef18f28fe4 Make somaxkva modifyable via sysctl (and compile-time) instead of
hardcoding its size.
2003-07-02 20:07:45 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
thorpej a06b275edc Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget().  Turns out
  that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
  and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
  above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
  just to appease the above.
2003-06-29 18:43:21 +00:00
simonb 2bda3187f5 Fix 'struct lwp *' lossage. 2003-06-29 15:14:11 +00:00
martin f62781d485 Intermediate cast to intptr_t when storing a lwp id in a caddr_t variable
for archs where those have different size.
2003-06-29 09:59:59 +00:00
thorpej 927fffff3d Adjust to ktrace/lwp changes. 2003-06-29 02:56:23 +00:00
enami e946a4baa0 Adjust !LKM case for proc * -> lwp * change. 2003-06-29 02:23:19 +00:00
simonb 02c392e820 Remove an unnecessary local variable (and save a read of the "time"
variable if we don't need to use it).
2003-06-28 15:02:24 +00:00
simonb a357272810 Declare ras_pool in <sys/ras.h> instead of an extern declaration in
the file where it's needed.
2003-06-28 14:52:10 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
nathanw 08cf80dc5c Whitespace police. 2003-06-26 02:09:27 +00:00
nathanw 169a6757eb For now, disable voluntary mid-operation preempt() for SA processes;
it doesn't interact well with SA's idea of what's running.
2003-06-26 02:08:19 +00:00
yamt 200e944501 revert rev.1.28. (free -> FREE changes)
pointed by David Laight on source-changes about similar changes.
2003-06-25 14:34:55 +00:00
christos a378776e5a Limit the number of program headers we accept to avoid resource exhaustion
by a hand-crafted elf binary.
2003-06-25 13:48:06 +00:00
jdolecek 7942f6611a add __KERNEL_RCSID() 2003-06-23 13:14:49 +00:00
martin d505b18964 Make sure to include opt_foo.h if a defflag option FOO is used. 2003-06-23 11:00:59 +00:00
drochner 0256604827 nuke unnecessary #include <sys/dkstat.h> 2003-06-12 14:44:36 +00:00
provos f858b1eac4 allow the kernel to free policies for users; kernel informs userland
which policy has been freed;  replacement is LRU
2003-06-03 05:24:00 +00:00
jdolecek bb940d41a0 Add __KERNEL_RCSID() 2003-06-01 00:03:39 +00:00
nathanw a86930707b Expand the test in itimerfire() to only wake up an idle SA LWP if the
process isn't stopped.
2003-05-28 22:27:57 +00:00
nathanw 998110e1d0 Put the tsleep() call in sa_yield() inside a while loop that tests
whether there is anything to do - almost as if it were a predicate
test outside of a condition wait. This prevents returning to userland
when tsleep() has woken up spuriously, such as from a signal that was
caught and then removed by a tracing process.

Kills off some double-stops in GDB due to signals as well as a couple
of pthread__idle assertions when detaching from a process.

XXX stopping inside tsleep, via CURSIG(), is evil.
2003-05-28 22:17:20 +00:00
dsl cb9a14ea0b Report ioctl read and write the correct way around. 2003-05-28 20:02:59 +00:00
simonb 2a2748044b Fix tyop in a comment. 2003-05-27 09:03:46 +00:00
dbj d225e8e1a7 use %PRIx64 instead of %x to print bp->b_lblkno and bp->b_blkno
in vfs_buf_print
2003-05-23 01:45:07 +00:00
kristerw 7941ff4225 Use 0 instead of NULL for size parameters. 2003-05-21 17:57:21 +00:00
fvdl dd522b0702 Fix a missing namecache_slock unlock. From Stephan Uphoff. 2003-05-21 09:36:06 +00:00
kristerw c71f7e5a4d This program is called genlintstub.awk 2003-05-20 20:25:31 +00:00
nathanw c7ca70e27a Add a ptrace interface for iterating over and collecting information
about LWPs. Loosely inspired by a similar interface in HP-UX ttrace(2).
2003-05-20 18:16:08 +00:00
nathanw 8e02eedcdf Track the LWP ID of a synchronous (trap) signal, and report it in core dumps. 2003-05-20 17:42:51 +00:00
simonb 8ba8e8a81b Sprinkle a little white-space. 2003-05-20 13:48:08 +00:00
nathanw f7905a50d4 Clear L_SA duting sa_upcall_userret(); faults encountered while
reporting an upcall are not of interest and just cause trouble.
2003-05-19 21:02:31 +00:00
dyoung 9d9a86120a Make ppsratecheck conform with its man page, which says, "If maxpps
is set to 0, the function will always return 0 (no packets/events
are permitted)." Before this patch, ppsratecheck returned 1 once
a second when maxpps was 0.
2003-05-19 03:23:37 +00:00
thorpej fcecc153fe Use aprint_normal() for the non-error (and thus non-interative) case
of mounting the root file system.
2003-05-17 22:22:41 +00:00
mjl cf40158777 Typos in comments. 2003-05-17 15:53:42 +00:00
itojun 6213663758 avoid constant, use sizeof
[not sure about string termination here, so leave strncpy untouched]
2003-05-17 03:12:08 +00:00
nakayama b89b148783 Avoid integer constant is too large warnings in gcc 3.3. 2003-05-17 01:50:56 +00:00
itojun 35e21131ac use strlcat 2003-05-16 14:40:41 +00:00
itojun f265a4a4da use strlcpy. [fixed off-by-one in subr_prop.c] 2003-05-16 14:25:02 +00:00
christos 15fab6425c Fix a variety of kernel panics related to unchecked export data:
1. sa_len was not properly checked.
2. sa_family was not properly checked [even used as an array index!]
3. we only know about inet4 and inet6, so make sure that the corresponding
   data is valid before using it.
4. keep reference counts of addresses used (is that necessary?)
2003-05-16 14:01:56 +00:00
christos ade6fba604 add a crcmp() function. 2003-05-16 13:55:18 +00:00
dsl 88b103687c ktrace rval[1] - in order to get both fd numbers for pipe() 2003-05-15 12:56:16 +00:00
dbj 1ce09bdefb fix nits to compile when DEBUG_KGDB is defined 2003-05-13 02:13:14 +00:00
dsl 3a7f8f18f1 ktrace ioctl data buffers
Optimise structure layout for 'struct selinfo' to avoid padding on 64bit
systems.  Use an entire variable for the 'collision' flag for efficiency.
2003-05-12 15:17:36 +00:00
jdolecek d17c485917 make couple ksym functions' arguments const 2003-05-11 08:23:22 +00:00
matt 2de77aeda1 Make we keep track of the file sizes in a size_t, not an int. Also break
out the writing of an lwp's registers to a separate function.  XXX Although
not really the correct way to do this, make the thread that caused the
coredump has it's register set written first so GDB is happy.  (this is a
bridge until TRT is done).
2003-05-08 20:26:40 +00:00