summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_prf.c
Commit message (Collapse)AuthorAgeFilesLines
* When DDB is active, always send printf() output directly to theiedowse2003-06-221-1/+5
| | | | | | console, even if there is a TIOCCONS console tty. We were already doing this after a panic, but it's also useful when entering DDB for some other reason too.
* Use a new message buffer `consmsgbuf' to forward messages to aiedowse2003-06-221-13/+13
| | | | | | | | | | | | | | | TIOCCONS console (e.g. xconsole) via a timeout routine instead of calling into the tty code directly from printf(). This fixes a number of cases where calling printf() at the wrong time (such as with locks held) would cause a panic if xconsole is running. The TIOCCONS message buffer is 8k in size by default, but this can be changed with the kern.consmsgbuf_size sysctl. By default, messages are checked for 5 times per second. The timer runs and the buffer memory remains allocated only at times when a TIOCCONS console is active. Discussed on: freebsd-arch
* Replace the code for reading and writing the kernel message bufferiedowse2003-06-221-94/+26
| | | | | | | | | | | | | | | | | with a new implementation that has a mostly reentrant "addchar" routine, supports multiple message buffers in the kernel, and hides the implementation details from callers. The new code uses a kind of sequence number to represend the current read and write positions in the buffer. This approach (suggested mainly by bde) permits the read and write pointers to be maintained separately, which reduces the number of atomic operations that are required. The "mostly reentrant" above refers to the way that while it is now always safe to have any number of concurrent writers, readers could see the message buffer after a writer has advanced the pointers but before it has witten the new character. Discussed on: freebsd-arch
* Use __FBSDID().obrien2003-06-111-1/+3
|
* Remove unused variable(s).phk2003-05-311-5/+2
| | | | | | Remove break after goto Found by: FlexeLint
* Don't assume that p_session hasn't changed out from under us after unlockingjhb2003-04-171-12/+11
| | | | | | the process and session. Instead, cache a true reference to the session when we do the hold and release our reference on that session. This avoids the need for the proc lock when dropping the reference.
* Add a checksum to the kernel message buffer, and update it everyiedowse2003-03-281-4/+24
| | | | | | | | | | | | time a character is written. Use this at boot time to reject the existing buffer contents if they are corrupt. This fixes a problem seen on some hardware (especially laptops) where the message buffer gets partially corrupted during a short power cycle or reset, but the msgbuf structure is left intact so it gets reused, resulting in random junk and control characters appearing in dmesg and /var/log/messages. PR: kern/28497
* Including <sys/stdint.h> is (almost?) universally only to be able to usephk2003-03-181-1/+0
| | | | | %j in printfs, so put a newsted include in <sys/systm.h> where the printf prototype lives and save everybody else the trouble.
* Back out M_* changes, per decision of the TRB.imp2003-02-191-2/+2
| | | | Approved by: trb
* Add vsnrprintf() which is just like vsnprintf() but takes a "radix"phk2003-02-041-0/+17
| | | | argument for the kernel-special %r format.
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-2/+2
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Cast the integer read as the first argument for %b to an unsigned integerjhb2003-01-071-1/+1
| | | | | | | | | so it's value is not sign extended when assigned to the uintmax_t variable used internally by printf. For example, if bit 31 is set in the cpuid feature word, then %b would print out the initial value as a 16 character hexadecimal value. Now it only prints out an 8 character value. Reviewed by: bde
* Move #include of ddb/ddb.h up with the rest.phk2003-01-041-2/+6
|
* Make the msg_size, msg_bufx and msg_bufr memebers of struct msgbuftmm2002-11-141-2/+3
| | | | | | | | | | | signed, since they describe a ring buffer and signed arithmetic is performed on them. This avoids some evilish casts. Since this changes all but two members of this structure, style(9) those remaining ones, too. Requested by: bde Reviewed by: bde (earlier version)
* Add support for the C99 %t format modifier.mux2002-11-131-2/+11
|
* - Rename the DDB specific %z printf format to %y.mux2002-10-251-3/+12
| | | | | | | | | | - Make DDB use %y instead of %z. - Teach GCC about %y. - Implement support for the C99 %z format modifier. Approved by: re@ Reviewed by: peter Tested on: i386, sparc64
* Fix %z to always print values as signed like it is supposed to.jhb2002-10-111-2/+2
| | | | | Reviewed by: bde Tested on: i386 in ddb
* Change a return to a break so the local buffers get properly freeed.phk2002-09-281-1/+1
| | | | | | Spotte by: FlexeLint Reviewed by: rwatson
* Make kern.log_console_output a tuneable aswell as a sysctl.dwmalone2002-08-111-0/+1
| | | | MFC after: 1 week
* dd %i as an alias for %d for greater compatibility with our *BSD bretherenimp2002-07-051-0/+1
| | | | | Obtained from: NetBSD Reviewed by: jake, rwatson, bosko
* More caddr_t removal.alfred2002-06-291-1/+1
| | | | Change struct knote's kn_hook from caddr_t to void *.
* ANSIfy the one remaining K&R function.des2002-06-021-4/+1
|
* Whitespace nits.des2002-06-021-2/+2
|
* Add support for 'j' flag. Simplify the size modifier code and reduce codedes2002-06-021-100/+71
| | | | | | duplication. Also add support for 'n' specifier. Reviewed by: bde
* Add a sysctl which disables the logging of console output.dwmalone2002-04-291-0/+7
| | | | | Approved by: phk MFC after: 2 weeks
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-1/+1
| | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
* Remove __P.alfred2002-03-191-4/+4
|
* Stop abusing the pgrpsess_lock.tanimura2002-03-111-4/+2
|
* Lock struct pgrp, session and sigio.tanimura2002-02-231-15/+45
| | | | | | | | | | | | | | | | | | | | | | | | | New locks are: - pgrpsess_lock which locks the whole pgrps and sessions, - pg_mtx which protects the pgrp members, and - s_mtx which protects the session members. Please refer to sys/proc.h for the coverage of these locks. Changes on the pgrp/session interface: - pgfind() needs the pgrpsess_lock held. - The caller of enterpgrp() is responsible to allocate a new pgrp and session. - Call enterthispgrp() in order to enter an existing pgrp. - pgsignal() requires a pgrp lock held. Reviewed by: jhb, alfred Tested on: cvsup.jp.FreeBSD.org (which is a quad-CPU machine running -current)
* Style(9) nits.phk2002-02-101-9/+9
| | | | Obtained from: ~bde/sys.dif.gz
* - Attempt to help declutter kern. sysctl by moving security out fromarr2002-01-161-2/+2
| | | | | | beneath it. Reviewed by: rwatson
* o Introduce kern.security.bsd.unprivileged_read_msgbuf, which allowsrwatson2001-11-301-0/+13
| | | | | | | | | | | the administrator to restrict access to the kernel message buffer. It defaults to '1', which permits access, but if set to '0', requires that the process making the sysctl() have appropriate privilege. o Note that for this to be effective, access to this data via system logs derived from /dev/klog must also be limited. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Properly sanity-check the old msgbuf structure before we accept itiedowse2001-11-091-3/+6
| | | | | | | | | | | | | as being valid. Previously only the magic number and the virtual address were checked, but it makes little sense to require that the virtual address is the same (the message buffer is located at the end of physical memory), and checks on the msg_bufx and msg_bufr indices were missing. Submitted by: Bodo Rueskamp <br@clabsms.de> Tripped over during a kernel debugging tutorial given by: grog Reviewed by: grog, dwmalone MFC after: 1 week
* KSE Milestone 2julian2001-09-121-2/+3
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Make the code to read the kernel message buffer via sysctl machine-tmm2001-07-031-0/+45
| | | | | independent and rename the corresponding sysctls from machdep.msgbuf and machdep.msgbuf_clear (i386 only) to kern.msgbuf and kern.msgbuf_clear.
* Use PCPU_GET, PCPU_PTR and PCPU_SET to access all per-cpu variablesjake2001-01-101-1/+1
| | | | other then curproc.
* Make sure we have a non-null proc pointer before referring to fieldsmjacob2000-12-231-1/+1
| | | | off of it.
* A last minute brucification resulted in syntax errors in the previous commit.phk2000-12-201-4/+4
|
* Replace logwakeup() with "int msgbuftrigger". There is littlephk2000-12-201-52/+110
| | | | | | | | | | | point in calling a function just to set a flag. Keep better track of the syslog FAC/PRI code and try to DTRT if they mingle. Log all writes to /dev/console to syslog with <console.info> priority. The formatting is not preserved, there is no robust, way of doing it. (Ideas with patches welcome).
* Simplify the tprintf() API.phk2000-11-261-34/+18
| | | | Loose the special <sys/tprintf.h> #include file.
* Make log(-1, ...) do what addlog(...) did.phk2000-11-261-38/+15
| | | | | | | | Replace all uses of addlog(...) with log(-1, ...) Remove bogus "register" keywords in subr_prf.c Make log() return void.
* Treat %X the same as %x (not entirely correct, but close enough).msmith2000-10-021-0/+1
|
* Major update to the way synchronization is done in the kernel. Highlightsjasone2000-09-071-1/+2
| | | | | | | | | | | | | | | include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
* Do not fault if curproc is null.peter2000-04-291-1/+1
|
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Merge the cons.c and cons.h to the best of my ability. alpha may orphk1999-08-091-2/+2
| | | | may not compile, I can't test it.
* Make long longs ("%ll" format) work.green1999-08-071-2/+6
| | | | Reviewed by: msmith
* This makes the in kernel printf routines conform to the documenteddfr1999-07-241-13/+24
| | | | | | behavior of their userland counterparts with respect to return values. Submitted by: Matthew N. Dodd <winter@jurai.net>
* Oops, missed out one chunk of the last patch. (*blush*)peter1999-07-141-2/+2
| | | | | Submitted by: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> Submitted by: "Matthew N. Dodd" <winter@jurai.net>
* Fixes for a couple of problems in last commit:peter1999-07-101-8/+8
| | | | | | | | | | | | | | | | | 1. Printing large quads in small bases overflowed the buffer if sizeof(u_quad_t) > sizeof(u_long). 2. The sharpflag checks had operator precedence bugs due to excessive parentheses in all the wrong places. 3. The explicit 0L was bogus in the quad_t comparison and useless in the long comparision. 4. There was some more bitrot in the comment about ksprintn(). Our ksprintn() handles bases up to 36 as well as down to 2. Bruce has other complaints about using %q in kernel and would rather we went towards using the C9X style %ll and/or %j. (I agree for that matter, as long as gcc/egcs know how to deal with that.) Submitted by: bde
OpenPOWER on IntegriCloud