aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_prf.c
Commit message (Collapse)AuthorAgeFilesLines
* Move instantiation of msgbufp from 9 MD files to subr_prf.c.Bruce Evans2017-12-071-0/+1
| | | | | | | | | | | | | | | This variable should be pure MI except possibly for reading it in MD dump routines. Its initialization was pure MD in 4.4BSD, but FreeBSD changed this in r36441 in 1998. There were many imperfections in r36441. This commit fixes only a small one, to simplify fixing the others 1 arch at a time. (r47678 added support for special/early/multiple message buffer initialization which I want in a more general form, but this was too fragile to use because hacking on the msgbufp global corrupted it, and was only used for 5 hours in -current...) Notes: svn path=/head/; revision=326656
* sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326023
* kvprintf %b enhancementsRyan Libby2017-07-121-24/+29
| | | | | | | | | | | | | | Make the %b formatter accept number formatting flags. It will now accept alternate form, precision, and length modifiers. It also now partially supports field width (but forces left justification). Reviewed by: markj Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11284 Notes: svn path=/head/; revision=320908
* Remove stray return.Konstantin Belousov2017-06-131-1/+0
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=319916
* Provide a comment on why stdio.h needs to be included.Scott Long2017-02-281-0/+7
| | | | Notes: svn path=/head/; revision=314420
* Include stdio.h to fix libsbuf build.Jung-uk Kim2017-02-281-0/+1
| | | | | | | Reviewed by: scottl Notes: svn path=/head/; revision=314419
* Implement sbuf_prf(), which takes an sbuf and outputs itScott Long2017-02-281-12/+34
| | | | | | | | | | | | | | | | | to stdout in the non-kernel case and to the console+log in the kernel case. For the kernel case it hooks the putbuf() machinery underneath printf(9) so that the buffer is written completely atomically and without a copy into another temporary buffer. This is useful for fixing compound console/log messages that become broken and interleaved when multiple threads are competing for the console. Reviewed by: ken, imp Sponsored by: Netflix Notes: svn path=/head/; revision=314397
* Include <stdarg.h> instead of <machine/stdarg.h> when compiled asMarcel Moolenaar2016-10-241-0/+4
| | | | | | | | part of libsbuf. The former is the standard header, and allows us to compile libsbuf on macOS/linux. Notes: svn path=/head/; revision=307873
* Renumber license clauses in sys/kern to avoid skipping #3Ed Maste2016-09-151-1/+1
| | | | Notes: svn path=/head/; revision=305832
* Hide counted_warning(9) under #ifdef _KERNEL braces, to allow buildingKonstantin Belousov2016-07-211-0/+2
| | | | | | | | | | subr_prf.c in userspace for libsbuf. Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=303155
* Provide counter_warning(9) KPI which allows to issue limited number ofKonstantin Belousov2016-07-211-0/+19
| | | | | | | | | | | | | | | warnings for some kernel events, mostly intended for the use of obsoleted or otherwise undersired interfaces. This is an abstracted and race-expelled code from compat pty driver. Requested and reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D7270 Notes: svn path=/head/; revision=303151
* kvprintf: Pad %*c to width, like %*sConrad Meyer2016-06-091-0/+8
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=301750
* Add vlog(9).Mark Johnston2015-11-191-1/+7
| | | | | | | | | Reviewed by: cem, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D4183 Notes: svn path=/head/; revision=291058
* Add support for reading MAM attributes to camcontrol(8) and libcam(3).Kenneth D. Merry2015-06-091-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MAM is Medium Auxiliary Memory and is most commonly found as flash chips on tapes. This includes support for reading attributes and decoding most known attributes, but does not yet include support for writing attributes or reporting attributes in XML format. libsbuf/Makefile: Add subr_prf.c for the new sbuf_hexdump() function. This function is essentially the same function. libsbuf/Symbol.map: Add a new shared library minor version, and include the sbuf_hexdump() function. libsbuf/Version.def: Add version 1.4 of the libsbuf library. libutil/hexdump.3: Document sbuf_hexdump() alongside hexdump(3), since it is essentially the same function. camcontrol/Makefile: Add attrib.c. camcontrol/attrib.c: Implementation of READ ATTRIBUTE support for camcontrol(8). camcontrol/camcontrol.8: Document the new 'camcontrol attrib' subcommand. camcontrol/camcontrol.c: Add the new 'camcontrol attrib' subcommand. camcontrol/camcontrol.h: Add a function prototype for scsiattrib(). share/man/man9/sbuf.9: Document the existence of sbuf_hexdump() and point users to the hexdump(3) man page for more details. sys/cam/scsi/scsi_all.c: Add a table of known attributes, text descriptions and handler functions. Add a new scsi_attrib_sbuf() function along with a number of other related functions that help decode attributes. scsi_attrib_ascii_sbuf() decodes ASCII format attributes. scsi_attrib_int_sbuf() decodes binary format attributes, and will pass them off to scsi_attrib_hexdump_sbuf() if they're bigger than 8 bytes. scsi_attrib_vendser_sbuf() decodes the vendor and drive serial number attribute. scsi_attrib_volcoh_sbuf() decodes the Volume Coherency Information attribute that LTFS writes out. sys/cam/scsi/scsi_all.h: Add a number of attribute-related structure definitions and other defines. Add function prototypes for all of the functions added in scsi_all.c. sys/kern/subr_prf.c: Add a new function, sbuf_hexdump(). This is the same as the existing hexdump(9) function, except that it puts the result in an sbuf. This also changes subr_prf.c so that it can be compiled in userland for includsion in libsbuf. We should work to change this so that the kernel hexdump implementation is a wrapper around sbuf_hexdump() with a statically allocated sbuf with a drain. That will require a drain function that goes to the kernel printf() buffer that can take a non-NUL terminated string as input. That is because an sbuf isn't NUL-terminated until it is finished, and we don't want to finish it while we're still using it. We should also work to consolidate the userland hexdump and kernel hexdump implemenatations, which are currently separate. This would also mean making applications that currently link in libutil link in libsbuf. sys/sys/sbuf.h: Add the prototype for sbuf_hexdump(), and add another copy of the hexdump flag values if they aren't already defined. Ideally the flags should be defined in one place but the implemenation makes it difficult to do properly. (See above.) Sponsored by: Spectra Logic Corporation MFC after: 1 week Notes: svn path=/head/; revision=284192
* Always send log(9) messages to the message buffer.Eric van Gyzen2015-04-201-1/+1
| | | | | | | | | | | | | | | | | | It is truer to the semantics of logging for messages to *always* go to the message buffer, where they can eventually be collected and, in fact, be put into a log file. This restores the behavior prior to r70239, which seems to have changed it inadvertently. Submitted by: Eric Badger <eric@badgerio.us> Reviewed by: jhb Approved by: kib (mentor) Obtained from: Dell Inc. MFC after: 1 week Notes: svn path=/head/; revision=281785
* Add a nulterm byte to the returned sysctl string.Ian Lepore2015-03-151-1/+1
| | | | | | | PR: 195668 Notes: svn path=/head/; revision=280016
* Fix usage example in kvprintf(9) and its copy in libstand(3): trailing '\n'Alexey Dokuchaev2015-01-231-2/+2
| | | | | | | | | | | | | | | | in bitfield argument is wrong, as it will be treated as bit 10, causing any code printing >=10 bits with bit 10 on as having a trailing comma. Newline (intended one) should be part of the format string (already present in the examples). Also fix grammar and kill EOL whitespace in comment while here. PR: 195005 Approved by: bdrewery Notes: svn path=/head/; revision=277560
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-281-13/+10
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-271-10/+13
| | | | | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky2014-06-271-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
* Fix grammar error and trailing newline.Bryan Drewery2014-04-231-2/+1
| | | | | | | | Submitted by: danfe MFC after: 3 days Notes: svn path=/head/; revision=264795
* Combine similar code from vprintf(9) and log(9).Bryan Drewery2014-03-141-39/+25
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=263129
* Rework the EARLY_PRINTF mechanism. Instead of defining a special eprintf()Ian Lepore2014-02-121-22/+0
| | | | | | | | | | | | | | | | | routine, now a platform can provide a pointer to an early_putc() routine which is used instead of cn_putc(). Control can be handed off from early printf support to standard console support by NULLing out the pointer during standard console init. This leverages all the existing error reporting that uses printf calls, such as panic() which can now be usefully employed even in early platform init code (useful at least to those who maintain that code and build kernels with EARLY_PRINTF defined). Reviewed by: imp, eadler Notes: svn path=/head/; revision=261786
* Implement generic support for early printf. Thought I can't find theWarner Losh2014-01-221-0/+22
| | | | | | | | | | paper trail now, this patch is similar to one posted for one of the preliminary versions of a new armv6 port. I took them and made them more generic. Option not enabled by default since each board/port has to provide its own eputc, and possibly do other things as well... Notes: svn path=/head/; revision=261038
* Reduce the scope of the proctree_lock. If several processes causeKonstantin Belousov2013-09-131-7/+6
| | | | | | | | | | | | | | | | | | continuous calls to the uprintf(9), the proctree_lock could be shared-locked for indefinite amount of time, starving exclusive requests. Since proctree_lock is needed for fork() and exit(), this effectively stops the machine. While there, do the similar reduction for tprintf(9). Reported and tested by: pho Reviewed by: ed Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (glebius) Notes: svn path=/head/; revision=255509
* Add a vtprintf. It is to tprintf what vprintf is to printf.Navdeep Parhar2013-09-071-5/+12
| | | | | | | Reviewed by: kib Notes: svn path=/head/; revision=255351
* Fix double vision syndrome (read: double output) when in theMarcel Moolenaar2011-10-161-13/+7
| | | | | | | debugger without a panic. Notes: svn path=/head/; revision=226435
* Set pca.p_bufr to NULL when we haven't allocated a buffer.Kenneth D. Merry2011-06-071-0/+3
| | | | | | | | | | | | | | | | | | Otherwise, p_bufr is set to garbage on the stack, and if that garbage happens to be non-NULL, and the TOLOG or TOCONS flag is set, putbuf() will get called and attempt to fill the non-existent buffer. This is really only relevant for tprintf() (and only when the priority is not -1), but set it in uprintf() and ttyprintf() for completeness. The next step, to avoid log buffer scrambling, would be to add the PRINTF_BUFR_SIZE code to tprintf(), but this should prevent panics. Submitted by: rmacklem Found by: pho Notes: svn path=/head/; revision=222804
* Fix apparent garbage in the message buffer.Kenneth D. Merry2011-05-311-33/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While we have had a fix in place (options PRINTF_BUFR_SIZE=128) to fix scrambled console output, the message buffer and syslog were still getting log messages one character at a time. While all of the characters still made it into the log (courtesy of atomic operations), they were often interleaved when there were multiple threads writing to the buffer at the same time. This fixes message buffer accesses to use buffering logic as well, so that strings that are less than PRINTF_BUFR_SIZE will be put into the message buffer atomically. So now dmesg output should look the same as console output. subr_msgbuf.c: Convert most message buffer calls to use a new spin lock instead of atomic variables in some places. Add a new routine, msgbuf_addstr(), that adds a NUL-terminated string to a message buffer. This takes a priority argument, which allows us to eliminate some races (at least in the the string at a time case) that are present in the implementation of msglogchar(). (dangling and lastpri are static variables, and are subject to races when multiple callers are present.) msgbuf_addstr() also allows the caller to request that carriage returns be stripped out of the string. This matches the behavior of msglogchar(), but in testing so far it doesn't appear that any newlines are being stripped out. So the carriage return removal functionality may be a candidate for removal later on if further analysis shows that it isn't necessary. subr_prf.c: Add a new msglogstr() routine that calls msgbuf_logstr(). Rename putcons() to putbuf(). This now handles buffered output to the message log as well as the console. Also, remove the logic in putcons() (now putbuf()) that added a carriage return before a newline. The console path was the only path that needed it, and cnputc() (called by cnputs()) already adds a carriage return. So this duplication resulted in kernel-generated console output lines ending in '\r''\r''\n'. Refactor putchar() to handle the new buffering scheme. Add buffering to log(). Change log_console() to use msglogstr() instead of msglogchar(). Don't add extra newlines by default in log_console(). Hide that behavior behind a tunable/sysctl (kern.log_console_add_linefeed) for those who would like the old behavior. The old behavior led to the insertion of extra newlines for log output for programs that print out a string, and then a trailing newline on a separate write. (This is visible with dmesg -a.) msgbuf.h: Add a prototype for msgbuf_addstr(). Add three new fields to struct msgbuf, msg_needsnl, msg_lastpri and msg_lock. The first two are needed for log message functionality previously handled by msglogchar(). (Which is still active if buffering isn't enabled.) Include sys/lock.h and sys/mutex.h for the new mutex. Reviewed by: gibbs Notes: svn path=/head/; revision=222537
* Use type-specific inline function imax() instead of deprecated macro MAX().Jung-uk Kim2010-07-121-1/+1
| | | | | | | Prodded by: bde Notes: svn path=/head/; revision=209949
* Implement optional 'precision' for numbers. Previously, it was parsed butJung-uk Kim2010-07-081-11/+14
| | | | | | | | ignored. Some third-party modules (e.g., APCICA) prefer this format over zero padding flag '0'. Notes: svn path=/head/; revision=209836
* Make /dev/klog and kern.msgbuf* MPSAFE.Ed Schouten2009-11-031-5/+16
| | | | | | | | | | | | | | | | | Normally msgbufp is locked using Giant. Switch it to use the msgbuf_lock. Instead of changing the tsleep() calls to msleep(), just convert it to condvar(9). In my opinion the locking around msgbuf_peekbytes() still remains questionable. It looks like locks are dropped while performing copies of multiple blocks to userspace, which may cause the msgbuf to be reset in the mean time. At least getting it underneath from Giant should make it a little easier for us to figure out how to solve that. Reminded by: rdivacky Notes: svn path=/head/; revision=198860
* Remove redundant code in printf() and vprintf().Ed Schouten2009-02-271-28/+1
| | | | | | | | | | | printf() and vprintf() are exactly the same, except the way arguments are passed. Just like we see in other pieces of code (i.e. libc's printf()), implement printf() using vprintf(). Submitted by: Christoph Mallon <christoph mallon gmx de> Notes: svn path=/head/; revision=189104
* Revert previous commit to subr_prf.c and make it more tidy.Ed Schouten2009-02-271-3/+5
| | | | | | | | | | As mentioned by bz and bde, the change I made wasn't the proper way to fix. Inspired by bde's patch, perform some small cleanups to uprintf(). Reviewed by: bz Notes: svn path=/head/; revision=189102
* Remove redundant assignment of `p'.Ed Schouten2009-02-261-1/+0
| | | | | | | | | | `p' is already initialized with `td->td_proc'. Because td is always curthread, it is safe to initialize it without any locks. Found by: LLVM's scan-build Notes: svn path=/head/; revision=189066
* Use NULL in preference to 0 for pointers.Warner Losh2009-02-031-1/+1
| | | | Notes: svn path=/head/; revision=188057
* Revert r185891.Ed Schouten2008-12-211-2/+10
| | | | | | | | | | | | | | | In r185891 I removed the newlines from messages written to /dev/console, because it made startup messages from rc-scripts harder to read. This, unfortunately, causes the kernel message that is printed after a non-terminated log message to be concatenated. This could be fixed, but on short term it's better to just revert the change. Reported by: Jaakko Heinonen <jh saunalahti fi> Notes: svn path=/head/; revision=186383
* Remove added newlines from logged messages written to /dev/console.Ed Schouten2008-12-101-10/+2
| | | | | | | | | | | | | | | | | | The /dev/console device node logs all strings that are written to it. When the string does not contain a trailing newline, it appends one. I can imagine this was useful a long time ago, but with our current rc-scripts, it generates a whole bunch of messages that look like: | Configuring syscons: | blanktime | . By not appending the newlines, the output of `dmesg -a' is now (almost?) exactly the same as what the user will see on the console device (syscons, uart). Notes: svn path=/head/; revision=185891
* Obey signedness flag in %z case.Xin LI2008-11-171-1/+1
| | | | | | | MFC after: 2 months Notes: svn path=/head/; revision=185036
* Integrate the new MPSAFE TTY layer to the FreeBSD operating system.Ed Schouten2008-08-201-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The last half year I've been working on a replacement TTY layer for the FreeBSD kernel. The new TTY layer was designed to improve the following: - Improved driver model: The old TTY layer has a driver model that is not abstract enough to make it friendly to use. A good example is the output path, where the device drivers directly access the output buffers. This means that an in-kernel PPP implementation must always convert network buffers into TTY buffers. If a PPP implementation would be built on top of the new TTY layer (still needs a hooks layer, though), it would allow the PPP implementation to directly hand the data to the TTY driver. - Improved hotplugging: With the old TTY layer, it isn't entirely safe to destroy TTY's from the system. This implementation has a two-step destructing design, where the driver first abandons the TTY. After all threads have left the TTY, the TTY layer calls a routine in the driver, which can be used to free resources (unit numbers, etc). The pts(4) driver also implements this feature, which means posix_openpt() will now return PTY's that are created on the fly. - Improved performance: One of the major improvements is the per-TTY mutex, which is expected to improve scalability when compared to the old Giant locking. Another change is the unbuffered copying to userspace, which is both used on TTY device nodes and PTY masters. Upgrading should be quite straightforward. Unlike previous versions, existing kernel configuration files do not need to be changed, except when they reference device drivers that are listed in UPDATING. Obtained from: //depot/projects/mpsafetty/... Approved by: philip (ex-mentor) Discussed: on the lists, at BSDCan, at the DevSummit Sponsored by: Snow B.V., the Netherlands dcons(4) fixed by: kan Notes: svn path=/head/; revision=181905
* Instead of doing comparisons using the pcpu area to see ifJulian Elischer2007-03-081-1/+1
| | | | | | | | | | a thread is an idle thread, just see if it has the IDLETD flag set. That flag will probably move to the pflags word as it's permenent and never chenges for the life of the system so it doesn't need locking. Notes: svn path=/head/; revision=167327
* Flushing the buffer is conditional on actually using the buffer. Oops.John Birrell2006-11-301-0/+4
| | | | Notes: svn path=/head/; revision=164764
* Turn console printf buffering into a kernel option and only onJohn Birrell2006-11-301-14/+23
| | | | | | | | | | | | | | | | | | | | by default for sun4v where it is absolutely required. This change moves the buffer from struct pcpu to the stack to avoid using the critical section which created a LOR in a couple of cases due to interaction with the tty code and kqueue. The LOR can't be fixed with the critical section and the pcpu buffer can't be used without the critical section. Putting the buffer on the stack was my initial solution, but it was pointed out that the stress on the stack might cause problems depending on the call path. We don't have a way of creating tests for those possible cases, so it's best to leave this as an option for the time being. In time we may get enough data to enable this option more generally. Notes: svn path=/head/; revision=164760
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningRobert Watson2006-11-061-1/+2
| | | | | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net> Notes: svn path=/head/; revision=164033
* Add a cnputs() function to write a string to the console withJohn Birrell2006-11-011-17/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a lock to prevent interspersed strings written from different CPUs at the same time. To avoid putting a buffer on the stack or having to malloc one, space is incorporated in the per-cpu structure. The buffer size if 128 bytes; chosen because it's the next power of 2 size up from 80 characters. String writes to the console are buffered up the end of the line or until the buffer fills. Then the buffer is flushed to all console devices. Existing low level console output via cnputc() is unaffected by this change. ithread calls to log() are also unaffected to avoid blocking those threads. A minor change to the behaviour in a panic situation is that console output will still be buffered, but won't be written to a tty as before. This should prevent interspersed panic output as a number of CPUs panic before we end up single threaded running ddb. Reviewed by: scottl, jhb MFC after: 2 weeks Notes: svn path=/head/; revision=163858
* Declare security and security.bsd sysctl hierarchies in sysctl.h alongRobert Watson2006-09-171-2/+0
| | | | | | | | | | | with other commonly used sysctl name spaces, rather than declaring them all over the place. MFC after: 1 month Sponsored by: nCircle Network Security, Inc. Notes: svn path=/head/; revision=162383
* Simplify the pager support in DDB. Allowing different db commands toJohn Baldwin2006-07-121-5/+2
| | | | | | | | | | | | | | | | | | | install custom pager functions didn't actually happen in practice (they all just used the simple pager and passed in a local quit pointer). So, just hardcode the simple pager as the only pager and make it set a global db_pager_quit flag that db commands can check when the user hits 'q' (or a suitable variant) at the pager prompt. Also, now that it's easy to do so, enable paging by default for all ddb commands. Any command that wishes to honor the quit flag can do so by checking db_pager_quit. Note that the pager can also be effectively disabled by setting $lines to 0. Other fixes: - 'show idt' on i386 and pc98 now actually checks the quit flag and terminates early. - 'show intr' now actually checks the quit flag and terminates early. Notes: svn path=/head/; revision=160312
* Implement printf 'X' conversion for both libstand and kernel.Jung-uk Kim2006-03-091-10/+13
| | | | Notes: svn path=/head/; revision=156518
* Always print a newline char at the end of the line.Scott Long2006-02-251-1/+2
| | | | Notes: svn path=/head/; revision=156001
* Acquire Giant in uprintf() and tprintf() rather than asserting it. InRobert Watson2005-09-261-6/+11
| | | | | | | | | | | | | | the vast majority of cases, these functions are called without mutexes held, meaning that in all but two cases, there will be no ordering issues with doing this, and it will eliminate the need for changes in the caller. In two cases, mutexes are held, so Giant must be acquired before those mutexes such that uprintf() and tprintf() recurse Giant rather than generating a lock order reversal. Suggested by: bde Notes: svn path=/head/; revision=150560