summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorJoerg Wunsch <joerg@FreeBSD.org>2004-08-10 09:19:08 +0000
committerJoerg Wunsch <joerg@FreeBSD.org>2004-08-10 09:19:08 +0000
commit0da40ab229272ebbe5469525c56cb51ba8ba716c (patch)
treeb21d34fd0697ec151d0d7194ef94849949fc34c3 /share
parent2454aaf51cd2189147701ef40e88d1e2e3be27a2 (diff)
downloadsrc-test2-0da40ab229272ebbe5469525c56cb51ba8ba716c.tar.gz
src-test2-0da40ab229272ebbe5469525c56cb51ba8ba716c.zip
Notes
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/Makefile3
-rw-r--r--share/man/man9/printf.948
2 files changed, 46 insertions, 5 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index fb4bb653422e..ee6a34ef9d6e 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -676,7 +676,8 @@ MLINKS+=pmap_resident_count.9 pmap_wired_count.9
MLINKS+=pmap_zero_page.9 pmap_zero_area.9 \
pmap_zero_page.9 pmap_zero_idle.9
MLINKS+=printf.9 tprintf.9 \
- printf.9 uprintf.9
+ printf.9 uprintf.9 \
+ printf.9 log.9
MLINKS+=psignal.9 gsignal.9 \
psignal.9 pgsignal.9
MLINKS+=random.9 arc4rand.9 \
diff --git a/share/man/man9/printf.9 b/share/man/man9/printf.9
index b3b31898e9b8..8a8d34044978 100644
--- a/share/man/man9/printf.9
+++ b/share/man/man9/printf.9
@@ -1,5 +1,6 @@
.\"
.\" Copyright (c) 2001 Andrew R. Reiter
+.\" Copyritht (c) 2004 Joerg Wunsch
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -25,11 +26,11 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 25, 2001
+.Dd August 10, 2004
.Dt PRINTF 9
.Os
.Sh NAME
-.Nm printf , uprintf , tprintf
+.Nm printf , uprintf , tprintf, log
.Nd formatted output conversion
.Sh SYNOPSIS
.In sys/types.h
@@ -40,13 +41,15 @@
.Fn tprintf "struct proc *p" "int pri" "const char *fmt" "..."
.Ft int
.Fn uprintf "const char *fmt" "..."
+.Ft void
+.Fn log "int pri" "const char *fmt" "..."
.Sh DESCRIPTION
The
.Xr printf 9
family of functions are similar to the
.Xr printf 3
family of functions.
-The three functions each use a different output stream.
+The different functions each use a different output stream.
The
.Fn uprintf
function outputs to the current process' controlling tty, while
@@ -59,6 +62,11 @@ function outputs to the tty associated with the process
and the logging facility if
.Fa pri
is not \&-1.
+The
+.Fn log
+function sends the message to the kernel logging facility, using
+the log level as indicated by
+.Fa pri .
.Pp
Each of these related functions use the
.Fa fmt
@@ -102,6 +110,28 @@ a time.
The string is used as a delimiter between individual bytes.
If present, a width directive will specify the number of bytes to display.
By default, 16 bytes of data are output.
+.Pp
+The
+.Fn log
+function uses
+.Xr syslog 3
+level values
+.Dv LOG_DEBUG
+through
+.Dv LOG_EMERG
+for its
+.Fa pri
+parameter (mistakenly called
+.Sq priority
+here).
+Alternatively, if a
+.Fa pri
+of \&-1 is given, the message will be appended to the last log message
+started by a previous call to
+.Fn log .
+As these messages are generated by the kernel itself, the facility will
+always be
+.Dv LOG_KERN .
.Sh RETURN VALUES
The
.Fn printf
@@ -126,5 +156,15 @@ will produce the following output:
reg=3<BITTWO,BITONE>
out: 41:41:41:41
.Ed
+.Pp
+The call
+.Bd -literal -offset indent
+log(LOG_DEBUG, "%s%d: been there.\\n", sc->sc_name, sc->sc_unit);
+.Ed
+.Pp
+will add the appropriate debug message at priority
+.Em kern.debug
+to the system log.
.Sh SEE ALSO
-.Xr printf 3
+.Xr printf 3 ,
+.Xr syslog 3