Commit Graph

6553 Commits

Author SHA1 Message Date
erh 75072b1c6f Change the order of error checks in shmget so EEXIST is returned before
EINVAL or EACCESS so callers have a more reliable way to tell if a
 shared memory segment already exists.
2008-10-27 15:40:56 +00:00
blymn 811c38a41c Extend the information that MALLOCLOG outputs to include the preceding
buffer.  This can be helpful in the case where a buffer overrun in the
preceding region stomps on the following regions data.
2008-10-26 12:23:28 +00:00
apb a02cace51f Use ${TOOL_SED} instead of plain "sed" in "!=" assignments.
This may need more work to prevent warning messages during
"make cleandir" when the commands in "!=" assignments are executed
even though tools may not have been built.
2008-10-25 22:35:36 +00:00
tsutsui f6cc315b29 - if no usable init(8) program (listed in *initpaths[]) can be found,
set the RB_ASKNAME flag and prompt users for the init path, rather than
  panicking with "no init".
- when prompting for the init path, support the special strings
  "halt", "reboot", and "ddb", as well as a prompt for the root device.

Dissussed and no objection on tech-kern.  Changes summary by apb@.
2008-10-25 15:40:59 +00:00
yamt ea8f5a99d5 cache_lookup_raw: update "goodhits" statistics to be less confused.
add an XXX comment.
2008-10-25 14:20:17 +00:00
yamt 2fb0334ca1 add assertions. 2008-10-25 14:18:18 +00:00
yamt fab66c36d6 exit1: update a comment. 2008-10-25 14:10:26 +00:00
dyoung 37dcd495a0 Change 'return (expr);' to 'return expr;'. Change (type *)0 to
NULL.  No functional change intended.
2008-10-24 22:23:20 +00:00
wrstuden 0a30ab777e toall signals really are toall. The fact we're sa doesn't matter.
They are start/stop signals, and need to impact more than just
blessed lwps.
2008-10-24 18:07:36 +00:00
christos bc44c7d780 don't hold locks in ddb (call ksyms_getval_unlocked()), pointed out by ad. 2008-10-24 13:55:42 +00:00
christos ff0507541f don't expose ksyms_lock 2008-10-23 20:41:13 +00:00
blymn 57614abcf2 Conditionalise bypass of veriexec routines on veriexec_strict to prevent
loophole if tables fail to load and strict is then raised.
2008-10-23 13:18:14 +00:00
ad 71781b4471 Set kern.posix_semaphores are runtime so it can be a module.
(Picked wrong header the last time.)
2008-10-22 11:25:19 +00:00
ad 52e9644b6b Make MODCTL_LOAD_FORCE do something. 2008-10-22 11:19:15 +00:00
ad c81717a5e1 Set kern.posix_semaphores are runtime so it can be a module. 2008-10-22 11:17:08 +00:00
ad 7b228b5a9c - Be clear about whether module load is explicit or system initiated (auto).
- Require that module_lock is held to autoload, so that any preconditions
  can be safely checked.
2008-10-22 11:16:29 +00:00
matt 8f23ec634b Only define/use saemul_netbsd if KERN_SA is defined. (maybe this should be
moved to compat_sa.c)
2008-10-21 20:52:11 +00:00
matt 6e1d2d17ef Only init ksyms mutex if ksyms is present in the kernel 2008-10-21 20:51:11 +00:00
ad a9327b33e2 Undo revivesa damage to userret(). 2008-10-21 11:51:23 +00:00
ad 19463db480 Correct an error message. 2008-10-20 20:07:35 +00:00
ad ee66516bfd PR kern/38814 ksyms needs locking
- Make ksyms MT safe.
- Fix deadlock from an operation like "modload foo.lkm < /dev/ksyms".
- Fix uninitialized structure members.
- Reduce memory footprint for loaded modules.
- Export ksyms structures for kernel grovellers like savecore.
- Some KNF.
2008-10-20 10:24:18 +00:00
christos 90b563e4cb rename proc_representative_lwp to proc_active_lwp and clarify it is for
ps display purposes. suggested by rmind.
2008-10-19 03:10:09 +00:00
christos 6b9261b24b Select a "representative" lwp instead of the first lwp in the list. The
first lwp in the list is the last created and in the firefox and gtk-gnash
case this is usually a zombie, so the status in ps was ZLl. This now picks
the lwp in order ONPROC > RUN > SLEEP > STOP > SUSPENDED > IDL > DEAD > ZOMB
and breaks ties using cpticks.
2008-10-19 01:43:25 +00:00
rmind a8552a3a74 Obviously intention was to check for SCHED_OTHER, not SCHED_FIFO. 2008-10-18 19:24:04 +00:00
rmind b5eb577d50 - Initialize pool subsystem and kmem(9) earlier, when UVM is up enough.
- Remove uao_hashinit() workaround used for anon-objects.
- Replace malloc with kmem.

OK by <yamt>.
2008-10-18 03:46:22 +00:00
rmind 65af07bb0c Make SCHED_M2 nice with nice(1). Closes PR/38048. 2008-10-18 03:44:04 +00:00
rmind d5ea013e1d Disallow user priority adjustments for SCHED_OTHER policy, simplify
convert_pri().  Sync schedctl(8) with the change.  Closes PR/38009.
2008-10-18 03:40:18 +00:00
wrstuden 7e10f527c2 Regen syscall tables. I forgot to do it after revivesa. While pooka
did some, not all are regenerated. Do them all at once for consistency.
2008-10-16 20:12:23 +00:00
pooka e3b0fcf963 One more rump syscall: ioctl (required for interface configuration) 2008-10-16 19:30:49 +00:00
wrstuden 27724c38ae Adjust locking on the sadata::sa_vps list. The main time we
walk the list, we're looking for a vp to do something with. We do
this in the signal code and in the timer code. The signal code already
runs with proc::p_lock held, so it's a very natural lock to use. The
timer code, however, calls into the sa timer code with a spinlock held.
Since proc::p_lock is an adaptable mutex, we can sleep to get it. Sleeping
with a spinlock is BAD. So proc::p_lock is _not_ the right lock there,
and something like sadata::sa_mutex would be best.

Address this difficulty by noting that both uses actually just read
the list. Changing the list of VPs is rare - once one's added, it stays
until the process ends. So make the locking protocol that to write the
list you have to hold both proc::p_lock and sadata::sa_mutex (taken
in that order). Thus holding either one individually grants read access.

This removes a case where we could sleep with timer_lock, a spinlock at
IPL_SCHED (!!), while trying to get p_lock. If that ever happened, we'd
pretty much be dead. So don't do that!

This fixes a merge botch from how I handled our gaining p_lock - p_lock
should not have simply replaced p_smutex.

While here, tweak the sa_unblock_userret() code for the case
when the blessed vp is actually running (on another CPU). Make its
resched RESCHED_IMMED so we whack the CPU. Addresses a hang I've
observed in starting firefox on occasion when I see one thread running
in userland and another thread sitting in lwpublk, which means it's on
the list of threads for which we need an unblocked upcall. This list is
one on which things should NOT linger.
2008-10-16 18:21:45 +00:00
ad ad507e54f8 _lwp_kill: set SI_LWP in the siginfo, not SI_USER. 2008-10-16 08:47:07 +00:00
wrstuden e27861f46e Add a weak alias for ktr_saupcall, so things build w/o KTRACE compiled. 2008-10-15 16:03:29 +00:00
pooka d31071b90c Mark a few network-related calls as RUMP (needs more work) 2008-10-15 13:01:15 +00:00
ad b5ff001c46 Correction to previous. 2008-10-15 08:25:28 +00:00
ad 1ec58d56ef - Rename cpu_lookup_byindex() to cpu_lookup(). The hardware ID isn't of
interest to MI code. No functional change.
- Change /dev/cpu to operate on cpu index, not hardware ID. Now cpuctl
  shouldn't print confused output.
2008-10-15 08:13:17 +00:00
wrstuden fc7511b00e Merge wrstuden-revivesa into HEAD. 2008-10-15 06:51:17 +00:00
pooka 2002727b2c Give maximum level of network softinterrupts a symbolic constant
(which happened to get bumbed from 32 to 33 (AF_MAX) now).
2008-10-14 17:15:20 +00:00
pooka a44cdde52c M_IOV is used all over the place, so stuff it in with malloc_stdtypes 2008-10-14 14:17:49 +00:00
ad 82e3c0b1ac Accept filters:
- Remove remaining #ifdef INET.
- Avoid holding locks so we don't need to do KM_NOSLEEP allocations.
- Use a rwlock to protect the accept filter list.
- Make it safe to unload accept filter modules.
- Minor KNF.
2008-10-14 13:45:26 +00:00
ad a68a7877a5 Correction to previous. 2008-10-14 09:17:23 +00:00
ad a65f991bb4 Redo kern_resource.c:1.146 by pooka@: change ui_sbsize to a u_long. 2008-10-14 09:16:32 +00:00
pooka 3a64aae825 Fix previous: weak symbols work so much better if they are exported
from the object as weak symbols...

There's also something to be said about "cosmetic" tweaks after
testing, but I do think I'll bother.
2008-10-13 18:16:33 +00:00
pooka cf05fbf706 Weak alias all rump system calls to rump_enosys() 2008-10-13 16:25:12 +00:00
plunky c827b856f4 fix problem pointed out by ad where sockopt may end up sleeping
inappropriately with the socket lock held.

    sockopt_init() may sleep

    sockopt_set() will not sleep

    sockopt_getmbuf() for legacy code will not sleep
2008-10-12 09:26:50 +00:00
tls cef30423d3 Address problems with accept filters noted by ad in his source-changes
mail: http://mail-index.netbsd.org/source-changes/2008/10/10/msg211109.html

	* Scary-looking socket locking stubs (changed to KASSERT of locked)

	* depends on INET inappropriately (though now you must add new
	  accept filter names to the uipc_accf.c line in conf/files if
	  you aren't using dataready or httpready)

	* New code uses MALLOC/FREE -- changed to kmem_alloc/kmem_free;
	  could be pool_cache, these are all fixed-size allocations.

We need to verify that this works as expected with protocols with per-socket
locking, like PF_LOCAL.  I'm a little concerned about the case where the
lock on the listen socket isn't the same lock as on the eventual connected
socket.
2008-10-11 16:39:07 +00:00
pooka 7e5aba5af0 Move uidinfo to its own module in kern_uidinfo.c and include in rump.
No functional change to uidinfo.
2008-10-11 13:40:57 +00:00
pooka dc2ebb63b8 Put ui_lock back and use it to modify the socket buffer size.
Typecasting quad_t * to long * and using atomic_add_long can't
possibly be expected to work!

Another fine error caught by the gcc type-punning warning.  That
really really should be on by default in the kernel.
2008-10-11 13:04:39 +00:00
skrll af82972758 RCSID police. 2008-10-10 23:09:19 +00:00
plunky d56f5b8302 use kmem_alloc/kmem_free rather than malloc() for sockokpt 2008-10-10 19:49:49 +00:00
ad 22191248b6 Update CALLOUT_INVOKING correctly, seems to have been lost. 2008-10-10 11:42:58 +00:00