Commit Graph

252 Commits

Author SHA1 Message Date
ad 59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
ad c147748d84 - Make the proclist_lock a mutex. The write:read ratio is unfavourable,
and mutexes are cheaper use than RW locks.
- LOCK_ASSERT -> KASSERT in some places.
- Hold proclist_lock/kernel_lock longer in a couple of places.
2007-03-09 14:11:22 +00:00
ad 0261e46854 - proc_unstop: adjust p_nrlwps correctly. Should fix PR kern/35657.
- LOCK_ASSERT -> KASSERT
- Update a couple of comments.
2007-03-05 20:29:14 +00:00
thorpej 4f3d5a9cc0 TRUE -> true, FALSE -> false 2007-02-22 06:34:42 +00:00
thorpej dd962f8680 Pick up some additional files that were missed before due to conflicts
with newlock2 merge:

Replace the Mach-derived boolean_t type with the C99 bool type.  A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 23:48:10 +00:00
ad 67323d2552 When sending signals, only boost the priority of the receiving LWP if
the process is being killed.
2007-02-20 17:47:03 +00:00
pavel 934634a18c Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
2007-02-17 22:31:36 +00:00
ad 2b011d2fa7 sigswitch(): don't blat the kernel_lock count that sleepq_block() saved
earlier.
2007-02-16 00:35:20 +00:00
yamt d972f83ff5 sigswitch: fix a deadlock. 2007-02-15 15:10:44 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
enami b840f8c9d7 Plug another memory leak in __sigtimedwait1() which is introduced
by rev. 1.208: free `waitset' and ksiginfo on success.
2007-01-10 07:58:27 +00:00
enami 93a9d5d355 Plug memory leak in __sigtimedwait1(): make sure to free `waitset'
on error return path.
2007-01-10 07:53:26 +00:00
elad a84fee7faf Initial implementation of PaX Segvguard (this is still work-in-progress,
it's just to get it out of my local tree).
2006-11-22 02:02:51 +00:00
drochner b1af2cb9b9 -SUS says that a successful call to setcontext(2) does not return. This
implies that _UC_CPU must be set in the context passed. Check for this
 and return EINVAL if not; this gives a cheap test for corrupted
 ucontexts eg on a signal handler stack which would go unnoticed otherwise.
-Don't ckeck for NULL ucontext pointers explicitely. This is an error,
 except in the swapcontext() case where it can be easily caught in
 userland.
2006-11-08 20:18:32 +00:00
ad 1cffc415cb - issignal(): acquire the kernel lock before inspecting signal state
- lwp_exit2(): don't drop the kernel lock until after doing wakeup()
2006-11-03 19:46:03 +00:00
yamt 0ae566badc fix deadlocks due to ksiginfo_pool spl problems. 2006-11-03 12:18:41 +00:00
yamt 1cd3142c15 make siginfo_pool and ksiginfo_pool static. 2006-11-03 11:41:07 +00:00
yamt 1a7bc55dcc remove some __unused from function parameters. 2006-11-01 10:17:58 +00:00
yamt caa14e011b kill signal "dolock" hacks.
related to PR/32962 and PR/34895.  reviewed by matthew green.
2006-11-01 09:46:14 +00:00
yamt 60392d9383 kill sched_psignal.
related to PR/32962 and PR/34895.  reviewed by matthew green.
2006-11-01 09:33:45 +00:00
mrg 8f3077c34d avoid allocating from ksiginfo_pool when we know we aren't going to
use it.  idea partly from yamt.  assert SCHED_ASSERT_UNLOCKED() in
all the places we call ksiginfo_queue() without a ksiginfo.

fixes recent panics detected by LOCKDEBUG.
2006-10-28 08:09:31 +00:00
mrg a37172bb09 avoid a problem in kpsignal2() holding sched_lock while wanting to call
pool_get().  pre-allocate the ksiginfo_t before taking sched_lock and
use it if necessary, or freeing it if it is unused.

rename ksiginfo_{get,put}() to ksiginfo_{dequeue,queue}() (idea from chuq.)


this fixes PR#32962.  thanks to christos, chuq and go for help/ideas.
2006-10-22 20:48:45 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
dogcow aaaf91526d add braces for if-else statement, in the event that SCHED_ASSERT_LOCKED is an
empty statement; shuts gcc up about 'empty statement in if-else'.
2006-10-04 23:10:42 +00:00
christos 4e2f7e29cf - fix initializer
- comment out unused code
2006-09-02 06:29:13 +00:00
matt 894d299a2b Regen. (add __weak_alias(sys_ptrace, sys_nosys) when PTRACE is off) 2006-09-01 21:04:45 +00:00
cube c09480be6c Let those compile under "no options COREDUMP". 2006-08-30 13:55:03 +00:00
matt 9e0ec4816e Make PTRACE and COREDUMP optional. Make the default (status quo) by putting
them in conf/std.
2006-08-29 23:34:48 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
yamt f755e9e9b8 remove unnecessary arguments from kauth_authorize_process.
ie. make it similar to the one found in apple TN.
2006-06-13 13:56:50 +00:00
rjs 4ba88d2489 Add includes of opt_multiprocessor.h and opt_lockdebug.h where missing. 2006-06-11 07:32:18 +00:00
kardel de4337ab21 merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
2006-06-07 22:33:33 +00:00
elad 215bd95ba4 integrate kauth. 2006-05-14 21:15:11 +00:00
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
christos 40a6c72b1d KNF: brace and parenthesis usage 2006-03-12 18:36:58 +00:00
matt 044257a109 Add a diagnostic printf if a write fails during a coredump. 2006-03-06 21:53:29 +00:00
christos a4495f4cec implement PT_SYSCALL 2006-03-05 07:21:37 +00:00
yamt 5a3e361753 for some random places, use PNBUF_GET/PUT rather than
- on-stack buffer
	- malloc(MAXPATHLEN)
2006-02-04 12:09:50 +00:00
elad 4a302fa004 implement a security.setid_core node as discussed on tech-kern@ and
tech-security@.
2006-02-02 17:48:51 +00:00
perry a2cd732268 Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 19:12:23 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
chs 0221acd545 in kpsignal2(), do not try to wake up a cached LWP for SA processes
in the case where we're sending SIGKILL but all LWPs are not signalable.
some LWP will wake up soon enough to process the signal, and there may
not be any LWPs in the cache to wake up anyway.  fixes PR 28886 and PR 26771.
also, add a missing "break" pointed out by yamt.
2005-11-12 02:27:48 +00:00
cube 388b97e039 Implement a few changes needed to properly resolve PR#30924, as
discussed in the PR.

- introduce sys/timevar.h to hold kernel-specific stuff relevant to
  sys/time.h.  Ideally, timevar.h would contain all (or almost) of the
  #ifdef _KERNEL part of time.h, but that's a pretty big and tedious
  change to make.  For now, it will contain only the prototypes I
  introduced when working on COMPAT_NETBSD32.

- split copyinout_t into copyin_t and copyout_t, it makes prototypes more
  explicit about the meaning of a given argument.  Suggested by yamt@.

- move copyinout_t definition in sys/time.h to systm.h as copyin_t and
  copyout_t

- make everything uses the new types and include the proper headers at
  the proper places.
2005-10-23 00:09:14 +00:00
chs 7c02feca68 avoid calling into the pool code while holding sched_lock
since both pool_get() and pool_put() can call wakeup().
instead, allocate the struct sadata_upcall before taking
sched_lock in mi_switch() and free it after releasing sched_lock.

clean up some modularity warts by adding a callback to
struct sadata_upcall for freeing sa_arg.
2005-10-02 17:51:27 +00:00
cube 875e65cda6 Introduce __sigtimedwait1 which will help adding COMPAT_NETBSD32 support
for __sigtimedwait(2).
2005-07-23 22:02:13 +00:00
matt e1245a3c46 Rework the coredump code to have no explicit knownledge of how coredump
i/o is done.  Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o.  This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.
2005-06-10 05:10:12 +00:00
christos efb6943313 - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
2005-05-29 22:24:14 +00:00
christos 92987fed44 Reset SIGCHLD handler if it is ignored, and clear the P_CLDSIGIGN bit. It
does not make sense to inherit this across execs. From FreeBSD.
2005-04-09 16:07:52 +00:00
yamt 6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
christos f9a341d1f6 PR/19837: Stephen Ma: signal(SIGCHLD, SIG_IGN) should not create zombies. 2005-03-30 17:07:50 +00:00