Add documentation for log(9).

MFC after:	1 week
This commit is contained in:
joerg 2004-08-10 09:19:08 +00:00
parent b109ddffbc
commit fea1ca1479
2 changed files with 46 additions and 5 deletions

View File

@ -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 \

View File

@ -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