Commit Graph

148 Commits

Author SHA1 Message Date
christos 947906bba8 - fixed signed/unsigned comparison
- don't write/increment sbuf if NULL
2011-11-24 01:45:39 +00:00
christos 2413151944 - don't let arguments in macros have side effects
- nul terminate properly
2011-11-24 01:14:19 +00:00
christos 32c78aacbc Increment the source buffer when we overflow so that we don't get stuck in
an infinite loop.
2011-11-22 21:25:04 +00:00
christos 9873d290d6 - use va_copy where needed
- always nul terminate vsnprintf()
- make snprintf() call vsnprintf()
2011-11-21 01:44:26 +00:00
christos 3f19719796 snprintf/vsnprintf can accept NULL/0 buffers and work properly as expected.
Before they used to return incorrect length on short buffers. Remove unused
error path.
2011-11-20 23:01:18 +00:00
christos 01035c71fc Add vpanic() 2011-09-29 20:52:39 +00:00
jym 9ce680e4f1 Use a scratch space in panic(9) so we can store a more meaningful
message for panicstr instead of just the format string.

Keep setting the panicstr to fmt beforehand though for safety precaution.

ok joerg@.
2011-09-08 18:15:56 +00:00
joerg 3eb244d801 Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
2011-07-17 20:54:30 +00:00
rmind bd5b92d68b - Replace few malloc(9) uses with kmem(9).
- Rename buf_malloc() to buf_alloc(), fix comments.
- Remove some unnecessary inclusions.
2011-04-24 18:46:22 +00:00
dyoung 56f6a5a11c Move device_printf() from ath_netbsd.c to subr_prf.c for reuse in a new
driver.
2011-01-21 17:46:19 +00:00
he ce1061323d On a recursive panic(), don't try to take a dump, as that may very
well have triggered the recursive panic.
Fix the comment for panic() to reflect now-current reality: the code
was already changed never to sync() on panic(), now we avoid dumping
core on a recursive panic.
2010-01-26 12:59:50 +00:00
dyoung e48f8429d1 Add a kernel configuration flag, SPLDEBUG, that activates a per-CPU log
of transitions to IPL_HIGH from lower IPLs.  SPLDEBUG is only available
on i386 and Xen kernels, today.

'options SPLDEBUG' adds instrumentation to spllower() and splraise() as
well as routines to start/stop debugging and to record IPL transitions:
spldebug_start(), spldebug_stop(), spldebug_raise(), spldebug_lower().
2009-11-03 05:23:27 +00:00
rmind fe55ad324c panic: use MI cpu_index(), instead of cpu_number(), which could be sparse. 2009-06-28 15:30:30 +00:00
cegger 4765113ada Return type of cpu_number(9) is cpuid_t which is effectively unsigned long.
So cast return type to unsigned long.
Fixes build for alpha GENERIC kernel.
2009-06-20 11:10:40 +00:00
mrg 8520c31093 when printing a ddb stack trace when entering ddb, include the cpu number 2009-06-18 06:26:58 +00:00
rmind 440e5485e0 - Rearrange pg_delete() and pg_remove() (renamed pg_free), thus
proc_enterpgrp() with proc_leavepgrp() to free process group and/or
  session without proc_lock held.
- Rename SESSHOLD() and SESSRELE() to  to proc_sesshold() and
  proc_sessrele().  The later releases proc_lock now.

Quick OK by <ad>.
2009-04-25 15:06:31 +00:00
cegger b8817e4aed ansify function definitions 2009-03-15 17:14:40 +00:00
mlelstv 046c06b035 Make curlwp accesses conditional on wether the data structures
have been initialized. Fixes PR kern/38599.
2009-03-10 10:48:09 +00:00
pooka 42356a10b5 Quote PR number in XXX comment. No functional change. 2009-01-30 21:16:51 +00:00
pooka 3c58d5b25f My clever hack was not enough. Disable DELAY via ifndef _RUMPKERN in
subr_prf until I manage to get all archs in line with a proper MI
signature.
2009-01-02 22:03:00 +00:00
pooka ff1136dede We use CPU_INFO_FOREACH here -> include sys/cpu.h 2009-01-02 11:08:32 +00:00
pooka 167269d42c Include kernel printf routines in rump instead of relying on the
magic libc symbol.  This also allows to bid farewell to subr_prf2.c
and merge the contents back to subr_prf.c.  The host kernel bridging
is now done via rumpuser_putchar().
2009-01-02 02:54:13 +00:00
pooka 0e983d35cf * unexpose kprintf locking internals
* migrate from simplelock to kmutex

Don't bother to bump kernel version, since nothing outside of subr_prf
used KPRINTF_MUTEX_ENXIT()
2009-01-01 15:10:20 +00:00
ad 7ca206492d Don't try to sync if panicing:
- It doesn't work and a dead system that can't be reset from the console is
  worse than a system that has painced and rebooted. If you can make it work
  reliably please do so.

- If the system is paniced there is every reason to suspect VM structures
  and the contents of the buffer cache.
2008-12-21 10:23:10 +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
dyoung 8f34c216d0 Add printf_tolog(), which writes to the kernel message buffer,
only.  I believe this is the safest way to log serious conditions
indicated by NMI.
2008-05-31 20:27:24 +00:00
ad 245f0726ac Reduce ifdefs due to MULTIPROCESSOR slightly. 2008-05-19 17:06:02 +00:00
ad cefdd6012a In panic, we busy wait if another CPU is already panicking. Don't spl0(),
because we could recurse and run off the end of the stack. Pointed out by
chs@.
2008-05-13 11:54:45 +00:00
ad 27168d9d58 - Rename crit_enter/crit_exit to kpreempt_disable/kpreempt_enable.
DragonflyBSD uses the crit names for something quite different.
- Add a kpreempt_disabled function for diagnostic assertions.
- Add inline versions of kpreempt_enable/kpreempt_disable for primitives.
- Make some more changes for preemption safety to the x86 pmap.
2008-04-27 11:37:48 +00:00
ad 6d70f903e6 Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
  be sent from a hardware interrupt handler. Signal activity must be
  deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
  and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
2008-04-24 15:35:27 +00:00
yamt 69bbf68c6e acquire proclist_lock for SESSHOLD/SESSRELE. 2008-04-17 14:07:31 +00:00
ad b60416c0e2 Move the LW_BOUND flag into the thread-private flag word. It can be tested
by other threads/CPUs but that is only done when the LWP is known to be in a
quiescent state (for example, on a run queue).
2008-04-12 17:16:09 +00:00
dogcow ed79311de3 Always include <sys/cpu.h>, to pick up CPU_INFO_ITERATOR et al. 2008-02-19 07:46:51 +00:00
ad 5408e000be panic: allow only one CPU to panic. Try to make the panicing thread bound
and try take all CPUs offline, in case we can block at some point in the
future.
2008-02-18 14:46:58 +00:00
ad 0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
ad f479e1b23b - Always include kprintf_slock.
- sys/lock.h -> sys/simplelock.h
2008-01-04 18:21:06 +00:00
pooka c7ac51486c tablefull: subr_prf -> subr_prf2 2007-12-30 22:55:21 +00:00
ad c3f5a622f9 Merge from vmlocking. 2007-11-07 00:19:08 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
he 2bf864fe60 Add an explicit include of <sys/device.h> to make sparc64 and sun2
build.  Needed for device_xname() and device_t, use added by previous
change.
2007-09-26 07:40:36 +00:00
joerg f381694bae Extend the aprint family with _dev and _ifnet versions that take
a device_t or struct ifnet * as first argument and prefix the log
message with the corresponding device/interface name.
2007-09-24 20:01:03 +00:00
pooka e97d926940 Move bitmask_snprintf() from subr_prf.c to subr_prf_bitmask.c to permit
standalone compilation.  No functional change.
2007-07-29 09:38:01 +00:00
isaki e7c552f22e Fix format of the combination of 'F\B\L' and ':\V' in
bitmask_snprintf(9).
2007-04-28 13:11:53 +00:00
thorpej 4f3d5a9cc0 TRUE -> true, FALSE -> false 2007-02-22 06:34:42 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
martin e0c4f3147e Fix %X in kernel printf, from Arnaud Degroote in PR kern/34459. 2006-09-03 17:06:36 +00:00
darrenr 5987976cc1 if db_onpanic is -1, do not invoke any ddb functions at all when handling
a panic.  This allows ddb's behaviour on a panic to be controlled via
sysctl rather than just compiling it in/out.
2006-01-28 14:37:31 +00:00
darrenr 76f9e99eec Introduce a new style of behaviour for ddb_onpanic == 2.
When set to 0 or 1, behaviour is normal (today)
When set to 2, kernel will display a stack trace and then enter ddb.
2006-01-28 07:23:37 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
thorpej 2f6855b6ca Use ANSI function decls. 2005-06-23 18:46:17 +00:00