Commit Graph

6553 Commits

Author SHA1 Message Date
ad fbc0e2e6d3 Redo 1.169 correctly (dsl's fix doesn't do what I intended, either!). 2008-10-10 11:20:15 +00:00
pooka 6dbf67cea1 Atomic ops are unnecessary here. pointed out by ad 2008-10-09 12:14:06 +00:00
pooka 225570303b Rewrite once to use global locks and atomic ops to get rid of the
static simplelock initializer (and simplelock too).  The fastpath
is still lockless, so doesn't make a difference in terms of
performance.

Also fixes a hanging bug if the once routine returned an error.
It does not retry after an error occurs, as I can't really imagine
fruitful semantics for that.
2008-10-09 10:48:21 +00:00
rmind 337b081fed - Replace lwp_t::l_sched_info with union: pointer and timeslice.
- Change minimal time-quantum to ~20 ms.
- Thus remove unneeded pool in M2, and unused sched_lwp_exit().
- Do not increase l_slptime twice for SCHED_4BSD (regression fix).
2008-10-07 09:48:27 +00:00
rmind 68121d6afa - Allow changing of kern.ipc.shmmax, just to avoid confusion.
- Change type of kern.ipc.shmmax to CTLTYPE_QUAD.
2008-10-07 09:35:03 +00:00
ad 139d645eee PR kern/39681 ddb doesn't work with new MODULAR modules
Complete initialization of new symbol table record.
2008-10-06 11:49:44 +00:00
ad 1b31761afa kobj_read: plug a leak. 2008-10-06 10:46:58 +00:00
pooka b9a8d2f75a hardclock() itself doesn't schedule callout softintrs any more,
so update comment - less is more.
2008-10-05 21:57:20 +00:00
njoly ab896e4008 Small fix to make setpriority(2) with PRIO_PROCESS return ESRCH when
no valid process can be found.
2008-09-30 17:28:47 +00:00
rmind ae626d791a - Schedule bound threads even if CPU is offline. Might be revisited later,
when decision what to do with already bound threads will be made.
- Do not allow to assign offline CPU to the processor-set.

Quick fix for PR/39349.
2008-09-30 16:28:45 +00:00
njoly 6d60715500 Make setpriority(2) return EINVAL for incorrect which values. 2008-09-29 21:30:12 +00:00
rmind 03fe669395 - Fix message queue permissions problems.
- Rake into account umask when creating mqueue.
- Restore DDB command, which was accidentally lost (hi martin).
- Misc.
2008-09-29 10:27:53 +00:00
pooka a709cdbf1f RCS Id polizei 2008-09-27 16:58:03 +00:00
reinoud fec4bb5bba Add generic FS agnostic directory hashing support. Currently only in use by
UDF. Future users could be msdosfs, ufs, nilfs2 (when ready), cd9660 etc.

Note that its not the same as UFS's DIRHASH support; UFS would need a good
cleanup/splitout of directory operations to adopt to this new directory
hashing support since most directory operations are interweaved with the
vnops itself. This is a TODO.
2008-09-27 13:01:07 +00:00
wrstuden 53908c9c0a Pull in a fix from wrstuden-revivesa:
Let's look for threads in the TARGET process, not in the
debugger process (gdb). Noticed when a KASSERT fired while
running gdb on a threaded app.

I will adjust wrstuden-revivesa-base-3 to include this change.
2008-09-27 03:52:24 +00:00
pooka 44367b7199 Split rate-checking routines into their own module for easier reuse. 2008-09-25 17:17:10 +00:00
pooka dd1721fa8d Move global malloc types from kern_malloc into a separate module. 2008-09-25 16:23:45 +00:00
wiz 43a9cced05 Fix typo in comment. 2008-09-25 14:37:30 +00:00
ad 43f2119341 PR kern/39307 (mfs will sometimes panic at umount time)
Change dounmount() so that it never drops the caller provided reference.
Garbage collecting 'struct mount' is up to the caller.
2008-09-25 14:17:29 +00:00
ad c63b8853fe PR kern/30525 remounting ffs read-only (mount -ur) does not sync metadata
Prevent r/w to r/o downgrade until such time as someone has verified all
the relevant file system code.
2008-09-24 10:07:19 +00:00
ad b72735bab2 PR kern/39307 mfs will sometimes panic at umount time
Don't drop reference to the mount if VFS_START() fails - that's for unmount
to do.
2008-09-24 09:44:09 +00:00
ad edd4d8eda9 PR kern/39307 mfs will sometimes panic at umount time
In vfs_destroy, assert that the refcount is not dropping below zero.
2008-09-24 09:33:40 +00:00
hannken bc62834f44 Resolve a race when physio_done signals completion before it tries to
free a buffer.  This will fail if the buffer owner has a chance to
modify the BC_DONTFREE flag before putphysbuf() examines it.

Fix by removing get/putphysbuf() and BC_DONTFREE.  Physio_done() now
has an explicit test for a buffer coming from the call of physio().

Observed by Lars Nordlund when writing a DVD with growisofs, see PR kern/39536.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
2008-09-24 08:19:19 +00:00
pooka 2134732d08 Move [hH][eE][xX][dD][iI][gG][iI][tT][sS](*) from subr_prf to subr_prf2
for use with rumps.

*) yes, I just had to.  Notably though, there were only two
   symbols instead of 128.
2008-09-23 22:20:24 +00:00
christos 93aed8f8e3 fix half-assed change usec -> nsec that broke non-real timers. 2008-09-23 16:44:49 +00:00
rmind ea71ae9284 Fix the aligning of memory blocks again, finally...
Tested by <martin> on his sparc64 box.
2008-09-19 11:21:33 +00:00
hannken 8de1a273e1 Replace the fss unmount hook with a vfs_hook.
fssvar.h:       struct device * -> device_t.
fss.c:          establish unmount hook on first attach, remove on last detach.
vfs_syscalls.c: remove the call of fss_umount_hook().
vfs_trans.c:    destroy cow handlers on unmount as fstrans_unmount() will be
                called before vfs_hooks.
2008-09-17 14:49:25 +00:00
pooka 66523e99f5 remove M_PIPE (hi rmind!) 2008-09-17 14:00:41 +00:00
rmind ffb8ec88e1 Replace intptr_t with uintptr_t in few more places.
OK by <matt>.
2008-09-15 18:12:56 +00:00
rmind 38d7b7ba2e Replace intptr_t in few places to uintptr_t. 2008-09-15 10:43:29 +00:00
christos 0ff103ebea - remove dup code
- make sure that sigput always initializes ksi
- initialize si_code with SI_NOINFO instead of lying (SI_USER)
- if a process is being ktraced, make siginfo available
- always pass the available siginfo to ktrace, even if it has SI_NOINFO
2008-09-12 21:33:39 +00:00
hannken 3034f37f42 nestiobuf_setup(): Initialize b_dev from master buffer. 2008-09-11 09:14:46 +00:00
blymn 6a3775d153 * Fix from Elad to correct a couple of places where functions exited
without releasing locks.
* Corrected a panic caused by veriexec_file_verify() not setting the
  returned struct veriexec_file_entry **vfep in all cases.

Thanks to Stathis Kamperis for finding the issues and testing the fixes.
2008-09-10 16:36:54 +00:00
cube 1e807cbeed Remove what seems to be a debug printf committed by accident. 2008-09-07 22:36:36 +00:00
pooka 23bef54996 For rumpsyscalls, properly return -1 in case of error. 2008-09-07 19:27:58 +00:00
tron b7cced0000 Remove duplicate definition of "specfs_lock".
Patch provided by Juan RP in PR kern/39493.
2008-09-07 13:09:36 +00:00
rmind b37999b4b5 Add few KASSERTs. 2008-09-06 23:08:54 +00:00
rmind 7e456140b3 Replace malloc with kmem. 2008-09-06 23:05:52 +00:00
drochner 6d1cbe3695 Make ioctl(FIONREAD) on the master side of a pty return the amount of
data which can be read, as expected. Before, the call fell through a
"case" statement and was forwarded to the slave side, returning the
data which can be read by the slave.
The new behaviour also matches Linux and OSF/1.
2008-09-03 16:47:34 +00:00
drochner 0fd378606e fix the logics of device memory deallocation
(non-split devices paniced a diagnostic kernel)
2008-09-01 19:44:05 +00:00
njoly 1215ed4c88 Make dup(2) return the correct error value, not 0. 2008-08-31 20:55:55 +00:00
reinoud 031c718bd6 Revert previous change and clarify meaning of RNG 2008-08-30 09:20:13 +00:00
reinoud bd424bd73b Accidental commit, but asserts buffer cache lock held 2008-08-30 08:55:53 +00:00
reinoud c68a9bd2ec Fix simple typo:
-       rnd_init();             /* initialize RNG */
+       rnd_init();             /* initialize RND */
2008-08-30 08:55:52 +00:00
yamt 75734d288f process_stoptrace: fix a locking botch. 2008-08-28 06:23:42 +00:00
yamt 52bfe81965 cpu_xc_offline: fix races with eg. sleepq_remove. 2008-08-28 06:18:26 +00:00
christos f4f1ff39a4 Writing 0 bytes on an O_APPEND file should not affect the offset 2008-08-27 06:28:09 +00:00
christos 520c3612c2 better debugging messages. 2008-08-27 05:40:25 +00:00
pooka 3e7c7228f4 Release vnode in cache_lookup() error branch if locking fails. 2008-08-20 15:34:59 +00:00
pooka 0f85a5be83 Remove my development ifdefs. (hi simon!) 2008-08-20 14:06:35 +00:00
matt 6ba7748097 Don't call null handlers 2008-08-15 03:14:20 +00:00
matt 78ab21fced Change subr_autoconf.c to use kmem_{*alloc,free}.
in pmf_deregister, don't constantly realloc.  just shift everything closer
to the front.  and then if empty, free.  When adding, add space for 4 more
entries.
Instead of n * sizeof(type) use C99 sizeof(type [n]).
2008-08-15 03:08:26 +00:00
matt 726d1181a8 Use __arraycount when appropriate 2008-08-15 01:31:02 +00:00
matt e79910d9d4 Only deallocate dv_private if we had allocated it. 2008-08-14 21:51:08 +00:00
thorpej 8d9a49fc0e turnstile_block(): When an LWP puts its turnstile onto a sync object's
turnstile chain, assert that its turnstile's free list pointer is NULL.
2008-08-12 14:13:34 +00:00
yamt a5cd2e50c6 make pcg_dummy const to catch bugs earlier. 2008-08-11 02:48:42 +00:00
yamt 53d1c25e34 add some KASSERTs. 2008-08-11 02:46:40 +00:00
yamt ae231875d3 fix a comment. 2008-08-11 02:45:27 +00:00
yamt eee9e229a0 lf_setlock: g/c dead code. 2008-08-11 02:44:28 +00:00
yamt 6198e821cb sleepq_block: fix a bug to lose biglocks in the case of recursive calls.
this fixes pf rb-tree corruption on my box.
2008-08-11 02:36:25 +00:00
skrll e7901782b3 Comment whitespace. 2008-08-08 16:58:01 +00:00
christos f6e1114503 Fix broken setitimer(). (Sverre Froyen) 2008-08-08 16:44:52 +00:00
uebayasi 714c16bc3e ttywrite: g/c an unused variable (cnt). 2008-08-08 07:18:03 +00:00
skrll 371a852414 memcpy'ing a sleepq (TAILQ) doesn't work.
Re-init the condvar after memcpy'ing so that the TAILQ is valid.

regress/sys/kern/lockf now completes rather than failing in cv_wait_sig
with KASSERT(cv_has_waiters()).
2008-08-07 07:42:06 +00:00
matt 13d044e16f Pages mapped by debug_malloc are PMAP_KMPAGE so tell the pmap that. 2008-08-07 01:40:21 +00:00
plunky fd7356a917 Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
2008-08-06 15:01:23 +00:00
tls 717f903a98 Add accept filters, ported from FreeBSD by Coyote Point Systems. Add inetd
support for specifying an accept filter for a service (mostly as a usage
example, but it can be handy for other things).  Manual pages to follow
in a day or so.

OK core@.
2008-08-04 03:55:47 +00:00
pooka bcfb021366 rumpify sys___sysctl 2008-08-01 19:32:35 +00:00
pooka b629cd421b expose module_compatible() 2008-08-01 14:05:15 +00:00
skrll 6fd21ccbbf Improve the debug output ever so slightly. 2008-08-01 07:11:24 +00:00
simonb 2a3d67b697 Remove needless white-space change that crept in through wapbl branch
merge.
2008-07-31 08:42:01 +00:00
simonb 36d65f1138 Merge the simonb-wapbl branch. From the original branch commit:
Add Wasabi System's WAPBL (Write Ahead Physical Block Logging)
   journaling code.  Originally written by Darrin B. Jewell while
   at Wasabi and updated to -current by Antti Kantee, Andy Doran,
   Greg Oster and Simon Burge.

OK'd by core@, releng@.
2008-07-31 05:38:04 +00:00
uebayasi d1dfd4fec7 Display t_outcv* channels as "ttyout*", not "ttycan*". 2008-07-31 01:46:40 +00:00
thorpej 261002c777 rw_vector_exit(): When doing direct hand-off to a writer, only set
RW_WRITE_WANTED if there are additional writers waiting.
2008-07-29 16:13:39 +00:00
drochner a17262c3e3 Avoid NULL pointer dereference on power handler deregistration if
it was not registered before. I assume that a lot of drivers do not
proper bookkeeping in the case the attach() exits early due to
errors. This is hard to fix and to test, so just be generous here.
2008-07-28 14:22:14 +00:00
pooka f06b295c56 Adjust comment location to make it make sense.
no functional change
2008-07-27 15:08:37 +00:00
dsl c43281ec80 Remove all the pending connections in soclose().
'continue' in 'do .. while (0)' doesn't do what ad@ intended.
2008-07-25 22:45:58 +00:00
uwe 4691dacd78 Declare lwp_exit_switchaway() __dead. Add infinite loop at the end of
lwp_exit_switchaway() to convince gcc that cpu_switchto(NULL, ...) is
really not going to return in that case.  Exposed by gcc4.3.

Reported on tech-kern by Alexander Shishkin.
2008-07-25 00:48:59 +00:00
apb 7cb9e72bbb Avoid using \$ in an awk script. Instead, store '$NetBSD$'
in an awk variable and interpolate it where needed.

Based on the patch by Martin Husemann in PR 38766.
2008-07-23 21:17:25 +00:00
christos 0f5d35d8d1 report local symbols too. 2008-07-22 21:18:35 +00:00
blymn 762e875434 Add locking around veriexec operations to prevent all sorts of badness
happening.  This fixes kern/38646.
2008-07-20 08:50:20 +00:00
kardel ccab995bc6 Initialize timecounter_lock at IPL_HIGH. Prevents a "locking against myself"
when com.c (options PPS_SYNC) delivers a PPS time stamp during clock
interupt processing.
2008-07-19 10:33:58 +00:00
christos dac1180a87 fix debugging printf 2008-07-18 21:29:48 +00:00
rmind a7fc471680 PR/39155: Wolfgang Solfrank: Invalid parameter to turnstile_exit in rw_downgrade. 2008-07-17 23:00:01 +00:00
pooka cc7d901591 vfs_subr2 has lost its will to live. vfs_subr was originally split
into two parts so that some of the routines could be used by rump.
Now that rump uses both vfs_subr and vfs_subr2 and there is no
reason to keep two files lying around, re-unite them.
2008-07-16 20:06:19 +00:00
drochner 8b720093a8 wipe out tty buffer contents after read, to avoid keeping possibly
sensitive information in memory longer than necessary
(We could make this depend on ~ECHO or so, but this would be an API
change and I don't think it is worth the effort.)
2008-07-16 18:27:49 +00:00
pooka b09210ace9 rumpalooza sys_fsync 2008-07-16 15:42:54 +00:00
christos 460ae70d0a make l_flags contain more stuff. Fixes top thread display where system processes
were always displayed.
2008-07-15 22:25:30 +00:00
christos aa389c698d Use more timespecs internally. From Alexander Shishkin and me.
Welcome to 4.99.70, 30 more to go for 100.
2008-07-15 16:18:08 +00:00
hannken 0d6dbadf45 bdwrite(): The COWDONE check may fire for special vnodes with mounted
non-ffs file system.  Remove VBLK vnodes from the check.

Should fix PR kern/38892
2008-07-14 16:22:42 +00:00
rmind 7c330ba82f Fix the locking against oneself, migrate LWPs only from runqueue.
Part of the fix for PR/38882.
2008-07-14 01:27:15 +00:00
rmind 4f91cff093 - Disallow setting of affinity for zombie LWPs.
- Fix the possible NULL dereference when LWP exiting.
- Fix the inhertance of affinity.
2008-07-14 01:19:37 +00:00
rmind d489642431 sched_migratable: add KASSERT since this function cannot be called
without lock held now.  Few cosmetic changes, while here.
2008-07-14 01:18:10 +00:00
yamt e4fb48bcaf pool_do_put: fix a pool corruption bug discovered by
the recent exec_pool changes.
2008-07-09 02:43:53 +00:00
christos 7f6e74c46e Fix to bug reported and tested by Alexander Shishkin. struct ptimer has
a union that contains either a callout [for CLOCK_REALTIME] or a flag
and a list [for other clock types]. Make sure we perform the right actions
on the right union member depending on the clock type. Otherwise this would
result in crashes.
2008-07-08 20:53:02 +00:00
pooka fc6faa2baf Force vrele_thread to run in vflush() only if there is vrele_pending.
Makes unmounting a file system in a forcibly singlethreaded rump
invocation work.
2008-07-07 14:15:41 +00:00
yamt 03bb7555b4 fix pool corruption bugs in subr_pool.c 1.162. 2008-07-07 12:27:19 +00:00
pooka 21730363f8 Expose utimes() and lutimes() to rump.
from Arnaud Ysmal
2008-07-07 09:01:40 +00:00
bouyer 52346627a5 kern/39052: fix broken assertion. We can have a BC_BUSY buffer in the LRU
queue, if it's being flushed. But in this case, we'll also have B_VFLUSH.

While there fix checkfreelist() so that it can be used to check that a
buffer is not in the free lists.
2008-07-06 15:00:45 +00:00
ad 6c6c91b240 Move an assignment later. 2008-07-04 16:41:00 +00:00