Commit Graph

3710 Commits

Author SHA1 Message Date
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
matt d97fd7e0ed In setrunnable, give more infomrmation in the panic message so we can
figure out WTF went wrong.
2003-05-08 02:04:11 +00:00
ragge 4f432cf54f Remove useless entries from the symbol table at load.
Add patricia-tree-style lookup code for symbols (for fast lookups).
2003-05-07 21:28:16 +00:00
fvdl 65770cf2e9 In the KMEMSTATS && DIAGNOSTIC case, add a check for inuse already being 0
at free() time. This will at least catch an alloc/free mismatch early in
boot, rather than having it hang hard because of a wrapped ks_limit.
2003-05-06 18:07:57 +00:00
yamt b2479414be export some of sosend loan routines for nfsd. 2003-05-03 17:53:17 +00:00
fvdl c5b60c55a3 Make gcc3 happy ("label at end of compound statement"). 2003-05-03 15:02:54 +00:00
yamt d056e8ce9a get pointer to v_interlock directly
as we are not interested in the rest of the vnode here.
2003-05-03 11:19:05 +00:00
yamt 7b589d5ebc fix locking. 2003-05-02 12:43:01 +00:00
ragge 87c706341d #ifdef KSYMS_DEBUG should be #if NKSYMS. 2003-05-02 09:34:57 +00:00
tron 74905fd4b6 Fix build problems for kernel configurations without the "ksyms"
pseudo-device.
2003-05-02 09:19:51 +00:00
ragge b16f870314 Enable the ioctl's. 2003-05-01 20:46:20 +00:00
yamt 300627c9c0 - KNF.
- remove unneeded caddr_t casts.
2003-05-01 15:25:06 +00:00
yamt 8565905ff8 use FREE instead of free for MALLOC'ed memory. 2003-05-01 14:59:51 +00:00
yamt 99411362c0 MP locking. 2003-05-01 14:36:43 +00:00
yamt a2e9a85481 remove a part of comment that isn't true anymore. 2003-05-01 13:14:49 +00:00
yamt 31dc0f47c6 ANSIfy. 2003-05-01 13:06:59 +00:00
yamt 4d5238a439 don't export lockf internal functions. 2003-05-01 12:49:16 +00:00
thorpej 8e8114bf55 Fix a logic botch that would cause some unwanted messages in the
AB_SILENT case.
2003-04-29 00:56:52 +00:00
ragge 520c93de28 Make ksymms_init() take void * parameters instead of caddr_t. 2003-04-26 10:24:58 +00:00
ragge cddfd23e42 Mobe the SYMTAB_SPACE stuff to ksyms_init, so that it can be used without
DDB compiled-in.
2003-04-25 20:30:57 +00:00
ragge 0bd41108c4 Explicitly cast printf arg to long, from Tom Spindler. 2003-04-25 07:35:21 +00:00
ragge f5cb3ec885 Teach the lkm code to add loaded module symbols to the in-kernel symbol table.
XXX - The way this works is clumsy, at least. It will be fixed as soon as
the in-kernel linker is in place.
2003-04-24 20:09:43 +00:00
ragge 44305abd0b Basic implementation of in-kernel symbol table manager + /dev/ksyms. 2003-04-24 19:56:43 +00:00
nathanw 68b16f8c13 Patch from Nick Hudson to clean up a couple of cases in proc_unstop(),
as well as improving the comments a bit. Addresses PR kern/20159.
2003-04-23 21:32:10 +00:00
matt 13bf20997a Need to include <sys/sa.h> for <sys/syscall.h> 2003-04-23 17:50:51 +00:00
christos 8906603597 fix wrong calculation. pointed by enami. 2003-04-22 13:11:23 +00:00
manu 0fd8402c80 Some Mach-O libraries do not have a load base address. The Darwin
kernel seems to skip them, letting the dirty job to dyld.
2003-04-21 14:32:25 +00:00
provos 14ea3a1c62 better performance for fast path; simplify for future lwp support. 2003-04-20 20:30:34 +00:00
yamt 9cb95972fa add simple_locks that are missed in the previous. 2003-04-20 07:06:33 +00:00
christos 62d7b4df25 PR/5458: Andrew Brown: acct(2) bug accounting to files marked sappnd 2003-04-20 03:20:18 +00:00
christos cd174e0605 make the copy_statfs_args() function copy all the fields that are not
set by the filesystems. Before my changes, the statfs code depended
on calling it with mp->mnt_stat, and did not explicitly initialize
anything!
2003-04-18 22:44:45 +00:00
simonb 3a00c85d38 Add a KASSERT to make sure that "sizeof(struct mbuf)" is MSIZE.
Extra insurance for Steve Woodford's recent <sys/mbuf.h> patch.
2003-04-18 01:24:20 +00:00
fvdl 2807f6e56a A bit of an ugly workaround to avoid a warning for a larger MSIZE.
Shouldn't make a difference in the generated code.
2003-04-17 13:12:39 +00:00
christos 80ecd573c0 PR/1796: John Kohl: statfs misbehaves under chrooted environments.
- Under chroot it displays only the visible filesystems with appropriate paths.
- The statfs f_mntonname gets adjusted to contain the real path from root.
- While was there, fixed a bug in ext2fs, locking problems with vfs_getfsstat(),
  and factored out some of the vfsop statfs() code to copy_statfs_info(). This
  fixes the problem where some filesystems forgot to set fsid.
- Made coda look more like a normal fs.
2003-04-16 21:44:18 +00:00
dsl 8a94d0064f Remember if ntp has adjusted clock rate, hardware RTC may be wrong. 2003-04-16 21:35:07 +00:00
dsl 8eefc5d061 Flag that adjtime has happened, hardware RTC might be wrong 2003-04-16 21:34:15 +00:00
christos c0d7b8d87a move declaration of getcwd_common and constant to the header file. 2003-04-16 20:00:03 +00:00
skrll ab7df78c6d ANSIfy proc_unstop 2003-04-15 12:11:25 +00:00
dsl 6ff706ac19 CONSTCONT should have been CONSTCOND 2003-04-13 09:08:04 +00:00
dsl b757e31c2a Fix error message for 64bit daddr_t 2003-04-13 07:51:30 +00:00
thorpej 9b3ce45b2a Add two new mbuf routines:
* m_apply(), which applies a function to each mbuf in chain
  starting at a specified offset, for a specified length.
* m_getptr(), which returns a pointer to the mbuf, as well as
  the offset into that mbuf, corresponding to an offset from
  the beginning of an mbuf chain.

From OpenBSD, cleaned up slightly by me.
2003-04-12 02:49:25 +00:00
christos cf6014f0ed use VREAD instead of VWRITE, this ioctl is used to redirect console output. 2003-04-10 22:35:00 +00:00
christos c4d28a0983 PR/732: Matt Green: TIOCCONS should work if the user owns /dev/console. 2003-04-10 22:05:57 +00:00
manu 8cb79c1cc6 typo 2003-04-10 20:57:01 +00:00
jdolecek c157f669ac regen:
'tvp' in vop_rename needs to be vput(), not vrele()d, so adjust the
definition here to match current reality
okayed by Bill Studenmund
2003-04-10 20:38:12 +00:00
jdolecek c645a7c61f 'tvp' in vop_rename needs to be vput(), not vrele()d, so adjust the
description here to match current reality
okayed by Bill Studenmund
2003-04-10 20:35:36 +00:00
jdolecek c20afe0ef8 Use 'void *' instead of 'caddr_t' in prototypes of VOP_IOCTL, VOP_FCNTL
and VOP_ADVLOCK
2003-04-10 20:26:57 +00:00
manu 15adb29427 Prefer C comments instead of C++ like comments 2003-04-10 19:38:26 +00:00
jdolecek 075efbb3db desupport LMRESERV_O, anything using it doesn't have chance of working
anyway due to numerous kernel structure changes
2003-04-10 19:06:04 +00:00
christos 6dbb5081d5 RP/21088: Jesse Off: Return ENOBUFS instead of EINVAL when sbappend fails. 2003-04-10 18:55:11 +00:00
erh 52bbca5b58 Make sure the directory is still mounted before looking things up in it.
Fixes PR kern/5683.
2003-04-10 07:26:52 +00:00
thorpej f775de9f61 * Use a pool_cache constructor to record the physical address of mbufs
in the mbuf header.
* Use the new cached paddr feature of the pool_cache API to record
  the physical address of mbuf clusters.  (We cannot use a ctor for
  clusters, since clusters have no constructed form; they are merely
  buffers).

Bus_dma back-ends may use the cached physical addresses to save having to
extract the physical address from virtual.

* Provide space in m_ext recording the vm_page *'s for an SOSEND_LOAN_CHUNK-
  sized non-cluster external buffer.  Use this in the sosend_loan code to
  save having to extract the physical address from virtual and then look
  up the vm_page *'s.

* Provide an indication that an external buffer is mapped read-only at
  the MMU.  Set this flag for the external buffer in the sosend_loan
  case, since loaned pages are always mapped read-only.  Bus_dma back-ends
  may use this information to save cache flushing, since a cache flush of
  a read-only mapping is redundant on some architectures (the cache would
  have already been flushed when making the mapping read-only).

Part 2 in a series of simple patches contributed by Wasabi Systems
to improve network performance.
2003-04-09 18:38:01 +00:00
thorpej a0aee79a1d Add the ability for pool caches to cache the physical address of
objects.  Clients of the pool_cache API must consistently use
the "paddr" variants or not, otherwise behavior is undefined.

Enable this on Alpha, ARM, MIPS, and x86.  Other platforms must
define POOL_VTOPHYS() in the appropriate manner in order to enable
the feature.

Part 1 of a series of simple patches contributed by Wasabi Systems
to improve network performance.
2003-04-09 18:22:13 +00:00
yamt e5655297db remove B_NEEDCOMMIT as it's no longer used. 2003-04-09 12:55:50 +00:00
christos 9850310e2b PR/21030: Naoto Shimazaki: fcntl to accepted socket does not work properly 2003-04-05 16:54:34 +00:00
fvdl 2257bf89d4 Add a bounds_check_with_mediasize function, which is intended
for checking RAW_PART transfers (and later raw disk devices).
2003-04-03 22:20:24 +00:00
christos 4e47272b6b Don't require a file if CLEAR is set [did not work before because we
could have the descend flag too]
2003-04-03 18:54:16 +00:00
fvdl abf2ee00c3 Copy birthtime in vn_stat. 2003-04-03 14:53:38 +00:00
enami 7d8cb58793 Set va_birthtime field in vattr_null(). 2003-04-03 09:13:10 +00:00
perry a6e07c4e35 grow #! line length -- patch from cgd, fixes PR kern/20112 from Todd Vierling 2003-04-02 00:58:56 +00:00
thorpej c53de7dd38 * Use PAGE_SIZE rather than NBPG.
* Use malloc()/free(), rather than MALLOC()/FREE(), since the page size
  might not be a compile-time constant.
2003-04-01 01:41:39 +00:00
provos cb0252af40 avoid a panic due to recent changes in kern_fork.c; prepare for lwp by
keeping messages independent of the process itself
2003-03-30 00:40:05 +00:00
wiz 0acfa3bb9e Consistently spell occurrence with two rs. 2003-03-29 22:48:37 +00:00
jdolecek 5fe02453b5 put back nmaxproc check mistakely changed in rev.1.132
checking against nprocs is wrong in any case btw - we do allow
maxproc higher than number of current processes, it would just mean
no new process could be started until number of processes would
be lower than the new limit
2003-03-27 18:34:18 +00:00
jdolecek 479a3334a4 sys_setreuid(): parenthesize the ruid check in ?: condition, so that
it would be more difficult to mistake == for = when reading it
2003-03-27 17:47:45 +00:00
jdolecek 0be1da3379 switch to LIST_FOREACH() in selrecord() 2003-03-26 17:50:16 +00:00
jdolecek a834690527 use LIST_FOREACH() in selwakeup() for the process's lwp walk loop 2003-03-22 14:13:06 +00:00
dsl 6f803e005b Correct rewinding if FIONBIO or FIOASYNC fail in F_SETFL
(code use to always turn off FIONBIO if FIOASYNC fails)
(approved by christos)
2003-03-22 10:39:47 +00:00
dsl 1f2e35430b Change caddr_t to void * 2003-03-22 10:35:01 +00:00
dsl bd99e3429d Use 'void *' instead of 'caddr_t' in prototypes of VOP_IOCTL, VOP_FCNTL
and VOP_ADVLOCK, delete casts from callers (and some to copyin/out).
2003-03-21 23:11:19 +00:00
dsl 60418b39b7 Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
2003-03-21 21:13:50 +00:00
dsl 9c29dd1922 Indentation fixes 2003-03-19 20:35:04 +00:00
christos a56ea22f68 - use __predict_false for DIAGNOSTIC code.
- #ifdef out a DIAGNOSTIC printf() that was too annoying (rule of thumb,
  don't make DIAGNOSTIC printfs() that print *very* frequently...)
- fix DIAGNOSTIC test that would always get triggered on a new session.
2003-03-19 16:47:36 +00:00
christos 3bd89478f7 make this compile again (-DDIAGNOSTIC) 2003-03-19 16:02:31 +00:00
dsl 9be8ac5294 Alternative pid/proc allocater, removes all searches associated with pid
lookup and allocation, and any dependency on NPROC or MAXUSERS.
NO_PID changed to -1 (and renamed NO_PGID) to remove artificial limit
on PID_MAX.
As discussed on tech-kern.
2003-03-19 11:36:32 +00:00
christos 46bb05bc86 regen 2003-03-18 18:09:48 +00:00
christos 1623253ed2 _lwp_setprivate returns void 2003-03-18 18:08:49 +00:00
jdolecek 46eb0d5bf0 make it possible for UNION fs to be loaded via LKM - instead of
having some #ifdef UNION code in vfs_vnops.c, introduce variable
'vn_union_readdir_hook' which is set to address of appropriate
vn_readdir() hook by union filesystem when it's loaded & mounted
2003-03-17 09:11:29 +00:00
martin 358b4d4e49 When being passed bogus file descriptors make close(2) return EBADF.
From Stephen Ma in PR kern/20762.
2003-03-17 07:57:13 +00:00
jdolecek a0deb3e9c4 move union filesystem code from sys/miscfs/union to sys/fs/union 2003-03-16 08:26:46 +00:00
matt e86e032c61 Make cfroots const. 2003-03-16 08:09:58 +00:00
matt 137a763c9b Only define POOL_LOGSIZE/pool_size if POOL_DIAGNOSTIC is defined. 2003-03-16 08:06:51 +00:00
dsl a8a18df708 cpu times were miscalculated because 'usecs' could go -ve...
There is still a problem that 'st = (u * st) / tot;' can overflow,
but that is harder to fix, and requires cpu times of ~5days.
(approved by christos)
2003-03-14 21:38:26 +00:00
dsl a485005f79 Ensure that the pgid arg to TIOCSPGRP is in the current session.
Correctly treat a +ve value as a pgid and a -ve one as a pid.
2003-03-13 10:20:06 +00:00
dsl 741870b7ef Validate that pgid argument to TIOCSPGRP in part of current session.
Treat +ve numbers as process group ids and -ve as pids (see tcsetpgrp() in part of current session.
Treat +ve numbers as process group ids and -ve as pids - see tcsetpgrp(3).
(approved by christos)
2003-03-12 23:00:03 +00:00
dsl 5786e3a6e8 Add pgid_in_session() for validating TIOCSPGRP requests
(approved by christos)
2003-03-12 22:54:44 +00:00
dsl 8bf20eda9b KNF function prototypes 2003-03-12 16:39:01 +00:00
dsl 4f78d8c26a Need to call calcru while l->l_stat == LSONPROC 2003-03-12 15:26:33 +00:00
nathanw 11aebbf730 Change the contract for timer_settime() (the internal routine, not the
syscall sys_timer_settime()) to take an absolute value for realtime
timers. This avoids a pair of gratiuitous conversions with the
possibility that the timer's intermediate value would be 0.0, which
would signal timer_settime() to cancel the timer.

Adjust callers of timer_settime() to compensate; catch the case where
sys_timer_settime() with an absolute time value of now and a virtual
timer would also be subtracted down to a timer-cancelling 0.0.

This should fix the bug seen in libpthread's nanosleep() where certain
applications, such as xmms, would wedge with unexpired userlevel
alarms.
2003-03-10 21:49:56 +00:00
thorpej 9e7bb2595e Based on the feedback on wasabisystems.com!bsd-api-discuss (sure wish
people would read that list in a more timely fashion!), change the new
64-bit memory reporting sysctl nodes to report bytes.  This should not
be a problem, since it's only a week old, and no applications use the
new nodes yet.
2003-03-06 20:32:59 +00:00
darrenr bacf7b9b2b When unblocking threads, do not call setrunnable() on the thread we will
be returning because the code path that calls is will very likely call
setrunnable() again on the returned thread, leading to a panic because
the thread returned is already at LSRUN.  This fixes a problem where netbsd
would panic when using gdb (5.3) on a process with multiple lwp's like this:
% gdb program
(gdb) run
^C
(gdb) quit
2003-03-06 15:31:14 +00:00
matt 6221ccd63f Make sure to flush each line after printf. 2003-03-06 00:39:42 +00:00
dsl a5de203f9f Add do_setresuid() and do_setresgid() and implement sys_setuid, sys_seteuid,
sys_setreuid (and gid equivs) in terms of them.
2003-03-05 18:42:19 +00:00
mycroft adddd74e0e DANGER WILL ROBINSON!
We cannot store LWP pointers permanently in lock structures, for two reasons:
1) They are somewhat ephemeral.  Dangling pointers are bad.
2) A different LWP may issue the unlock, and in this case, we were not actually
   doing the unlock at all.  This was causing processes to exit without undoing
   fcntl(2) locks.  Furthermore, the locks are process-specific to begin with,
   so the test was just plain wrong.

Instead, we go back to storing a proc pointer for POSIX locks.  In addition, we
add an extra pointer to the LWP, which is used in deadlock detection.  After
the lock is granted, this pointer is 0ed and there is no reference to the LWP.

Now evolution can inc my mail again.
2003-03-05 18:28:22 +00:00