aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorTom Rhodes <trhodes@FreeBSD.org>2003-03-13 18:05:37 +0000
committerTom Rhodes <trhodes@FreeBSD.org>2003-03-13 18:05:37 +0000
commitafb1ff09924bfb33ea82d323b2dd9f57da4c03b3 (patch)
tree504c8a0bdc64d641e472ce610eb4de93b63b1280 /lib/libc
parentce400d217bd528c79e53e0f5901afdd1ce252e8d (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/fmtcheck.334
-rw-r--r--lib/libc/gen/fnmatch.34
-rw-r--r--lib/libc/gen/frexp.310
-rw-r--r--lib/libc/gen/fts.360
-rw-r--r--lib/libc/gen/getcap.312
-rw-r--r--lib/libc/gen/gethostname.315
-rw-r--r--lib/libc/gen/getmntinfo.32
-rw-r--r--lib/libc/gen/getnetgrent.34
-rw-r--r--lib/libc/gen/getobjformat.32
-rw-r--r--lib/libc/gen/getpagesize.36
-rw-r--r--lib/libc/gen/getpeereid.32
-rw-r--r--lib/libc/gen/getttyent.32
-rw-r--r--lib/libc/gen/getusershell.315
-rw-r--r--lib/libc/gen/lockf.33
-rw-r--r--lib/libc/gen/modf.32
-rw-r--r--lib/libc/gen/msgctl.38
-rw-r--r--lib/libc/gen/signal.312
17 files changed, 115 insertions, 78 deletions
diff --git a/lib/libc/gen/fmtcheck.3 b/lib/libc/gen/fmtcheck.3
index e11687dc690f..a414e6e39081 100644
--- a/lib/libc/gen/fmtcheck.3
+++ b/lib/libc/gen/fmtcheck.3
@@ -63,11 +63,11 @@ is a valid format string.
.Pp
The
.Xr printf 3
-family of functions can not verify the types of arguments that they are
+family of functions cannot verify the types of arguments that they are
passed at run-time. In some cases, like
.Xr catgets 3 ,
it is useful or necessary to use a user-supplied format string with no
-guarantee that the format string matches the specified parameters.
+guarantee that the format string matches the specified arguments.
.Pp
The
.Fn fmtcheck
@@ -81,18 +81,6 @@ the field width or precision is an asterisk
.Ql *
instead of a digit string). Also, any text other than the format specifiers
is completely ignored.
-.Pp
-Note that the formats may be quite different as long as they accept the
-same parameters. For example,
-.Qq Li "%p %o %30s %#llx %-10.*e %n"
-is compatible with
-.Qq Li "This number %lu %d%% and string %s has %qd numbers and %.*g floats (%n)" .
-However,
-.Qq Li %o
-is not equivalent to
-.Qq Li %lx
-because
-the first requires an integer and the second requires a long.
.Sh RETURN VALUES
If
.Fa fmt_suspect
@@ -104,5 +92,23 @@ will return
.Fa fmt_suspect .
Otherwise, it will return
.Fa fmt_default .
+.Sh SECURITY CONSIDERATIONS
+Note that the formats may be quite different as long as they accept the
+same arguments. For example,
+.Qq Li "%p %o %30s %#llx %-10.*e %n"
+is compatible with
+.Qq Li "This number %lu %d%% and string %s has %qd numbers and %.*g floats (%n)" .
+However,
+.Qq Li %o
+is not equivalent to
+.Qq Li %lx
+because
+the first requires an integer and the second requires a long.
.Sh SEE ALSO
.Xr printf 3
+.Sh BUGS
+The
+.Fn fmtcheck
+function does not understand all of the conversions that
+.Xr printf 3
+does.
diff --git a/lib/libc/gen/fnmatch.3 b/lib/libc/gen/fnmatch.3
index a6a8b0243bad..c96b1643c376 100644
--- a/lib/libc/gen/fnmatch.3
+++ b/lib/libc/gen/fnmatch.3
@@ -101,7 +101,7 @@ is related to the specification of
A period is always
.Dq leading
if it is the first character in
-.Ar string .
+.Fa string .
Additionally, if
.Dv FNM_PATHNAME
is set,
@@ -110,7 +110,7 @@ leading
if it immediately follows a slash.
.It Dv FNM_LEADING_DIR
Ignore
-.Nm /*
+.Dq Li /*
rest after successful
.Fa pattern
matching.
diff --git a/lib/libc/gen/frexp.3 b/lib/libc/gen/frexp.3
index 8236810a1bd5..9e9c01c30d45 100644
--- a/lib/libc/gen/frexp.3
+++ b/lib/libc/gen/frexp.3
@@ -54,24 +54,24 @@ The
function breaks a floating-point number into a normalized
fraction and an integral power of 2.
It stores the integer in the
-.Em int
+.Vt int
object pointed to by
.Fa exp .
.Sh RETURN VALUES
The
.Fn frexp
function returns the value
-.Em x ,
+.Va x ,
such that
-.Em x
+.Va x
is a
-.Em double
+.Vt double
with magnitude in the interval
.Bo 1/2 , 1 Pc
or zero, and
.Fa value
equals
-.Em x
+.Va x
times 2 raised to the power
.Fa *exp .
If
diff --git a/lib/libc/gen/fts.3 b/lib/libc/gen/fts.3
index 1e40a81f924a..947b23849187 100644
--- a/lib/libc/gen/fts.3
+++ b/lib/libc/gen/fts.3
@@ -32,7 +32,7 @@
.\" @(#)fts.3 8.5 (Berkeley) 4/16/94
.\" $FreeBSD$
.\"
-.Dd April 16, 1994
+.Dd September 15, 2002
.Dt FTS 3
.Os
.Sh NAME
@@ -132,7 +132,7 @@ These fields are defined as follows:
.Bl -tag -width "fts_namelen"
.It Fa fts_info
One of the following values describing the returned
-.Fa FTSENT
+.Vt FTSENT
structure and
the file it represents.
With the exception of directories without errors
@@ -148,11 +148,11 @@ A directory that causes a cycle in the tree.
(The
.Fa fts_cycle
field of the
-.Fa FTSENT
+.Vt FTSENT
structure will be filled in as well.)
.It Dv FTS_DEFAULT
Any
-.Fa FTSENT
+.Vt FTSENT
structure that represents a file type not explicitly described
by one of the other
.Fa fts_info
@@ -174,7 +174,7 @@ which was not specified as a file name to
.It Dv FTS_DP
A directory being visited in post-order.
The contents of the
-.Fa FTSENT
+.Vt FTSENT
structure will be unchanged from when
it was returned in pre-order, i.e. with the
.Fa fts_info
@@ -231,19 +231,19 @@ The length of the string referenced by
The depth of the traversal, numbered from \-1 to N, where this file
was found.
The
-.Fa FTSENT
+.Vt FTSENT
structure representing the parent of the starting point (or root)
of the traversal is numbered
.Dv FTS_ROOTPARENTLEVEL
(\-1), and the
-.Fa FTSENT
+.Vt FTSENT
structure for the root
itself is numbered
.Dv FTS_ROOTLEVEL
(0).
.It Fa fts_errno
Upon return of a
-.Fa FTSENT
+.Vt FTSENT
structure from the
.Fn fts_children
or
@@ -278,7 +278,7 @@ It is initialized to
.Dv NULL .
.It Fa fts_parent
A pointer to the
-.Fa FTSENT
+.Vt FTSENT
structure referencing the file in the hierarchy
immediately above the current file, i.e. the directory of which this
file is a member.
@@ -307,9 +307,9 @@ of a hard link between two directories, or a symbolic link pointing to a
directory, the
.Fa fts_cycle
field of the structure will point to the
-.Fa FTSENT
+.Vt FTSENT
structure in the hierarchy that references the same file as the current
-.Fa FTSENT
+.Vt FTSENT
structure.
Otherwise, the contents of the
.Fa fts_cycle
@@ -332,10 +332,10 @@ fields are guaranteed to be
for the file most recently returned by
.Fn fts_read .
To use these fields to reference any files represented by other
-.Fa FTSENT
+.Vt FTSENT
structures will require that the path buffer be modified using the
information contained in that
-.Fa FTSENT
+.Vt FTSENT
structure's
.Fa fts_pathlen
field.
@@ -374,11 +374,11 @@ is also specified.
This option causes the
.Nm
routines to return
-.Fa FTSENT
+.Vt FTSENT
structures for the targets of symbolic links
instead of the symbolic links themselves.
If this option is set, the only symbolic links for which
-.Fa FTSENT
+.Vt FTSENT
structures
are returned to the application are those referencing non-existent files.
Either
@@ -408,7 +408,7 @@ pathnames were provided as arguments to
.Fn fts_open .
.It Dv FTS_NOSTAT
By default, returned
-.Fa FTSENT
+.Vt FTSENT
structures reference file characteristic information (the
.Fa statp
field) for each file visited.
@@ -426,11 +426,11 @@ field undefined.
This option causes the
.Nm
routines to return
-.Fa FTSENT
+.Vt FTSENT
structures for symbolic links themselves instead
of the target files they point to.
If this option is set,
-.Fa FTSENT
+.Vt FTSENT
structures for all symbolic links in the
hierarchy are returned to the application.
Either
@@ -452,7 +452,7 @@ encountered in the file hierarchy are ignored.
This option causes the
.Nm
routines to return
-.Fa FTSENT
+.Vt FTSENT
structures for them.
.It Dv FTS_XDEV
This option prevents
@@ -467,7 +467,7 @@ specifies a user-defined function which may be used to order the traversal
of the hierarchy.
It
takes two pointers to pointers to
-.Fa FTSENT
+.Vt FTSENT
structures as arguments and
should return a negative value, zero, or a positive value to indicate
if the file referenced by its first argument comes before, in any order
@@ -478,7 +478,7 @@ The
and
.Fa fts_pathlen
fields of the
-.Fa FTSENT
+.Vt FTSENT
structures may
.Em never
be used in this comparison.
@@ -503,7 +503,7 @@ everything else.
The
.Fn fts_read
function returns a pointer to an
-.Fa FTSENT
+.Vt FTSENT
structure describing a file in
the hierarchy.
Directories (that are readable and do not cause cycles) are visited at
@@ -528,14 +528,14 @@ and sets
.Va errno
appropriately.
If an error related to a returned file occurs, a pointer to an
-.Fa FTSENT
+.Vt FTSENT
structure is returned, and
.Va errno
may or may not have been set (see
.Fa fts_info ) .
.Pp
The
-.Fa FTSENT
+.Vt FTSENT
structures returned by
.Fn fts_read
may be overwritten after a call to
@@ -546,7 +546,7 @@ on the same file hierarchy stream unless they represent a file of type
directory, in which case they will not be overwritten until after a call to
.Fn fts_read
after the
-.Fa FTSENT
+.Vt FTSENT
structure has been returned by the function
.Fn fts_read
in post-order.
@@ -554,16 +554,16 @@ in post-order.
The
.Fn fts_children
function returns a pointer to an
-.Fa FTSENT
+.Vt FTSENT
structure describing the first entry in a NULL-terminated linked list of
the files in the directory represented by the
-.Fa FTSENT
+.Vt FTSENT
structure most recently returned by
.Fn fts_read .
The list is linked through the
.Fa fts_link
field of the
-.Fa FTSENT
+.Vt FTSENT
structure, and is ordered by the user-specified comparison function, if any.
Repeated calls to
.Fn fts_children
@@ -578,7 +578,7 @@ will return a pointer to the files in the logical directory specified to
i.e. the arguments specified to
.Fn fts_open .
Otherwise, if the
-.Fa FTSENT
+.Vt FTSENT
structure most recently returned by
.Fn fts_read
is not a directory being visited in pre-order,
@@ -598,7 +598,7 @@ and sets
appropriately.
.Pp
The
-.Fa FTSENT
+.Vt FTSENT
structures returned by
.Fn fts_children
may be overwritten after a call to
diff --git a/lib/libc/gen/getcap.3 b/lib/libc/gen/getcap.3
index d35729e4560d..57072b4aa8ab 100644
--- a/lib/libc/gen/getcap.3
+++ b/lib/libc/gen/getcap.3
@@ -94,7 +94,9 @@ function will first look for files ending in
(see
.Xr cap_mkdb 1 )
before accessing the ASCII file.
-.Fa Buf
+The
+.Fa buf
+argument
must be retained through all subsequent calls to
.Fn cgetmatch ,
.Fn cgetcap ,
@@ -106,7 +108,7 @@ but may then be
.Xr free 3 Ns \&'d .
On success 0 is returned, 1 if the returned
record contains an unresolved
-.Nm tc
+.Ic tc
expansion,
\-1 if the requested record couldn't be found,
\-2 if a system error was encountered (couldn't open/read a file, etc.) also
@@ -251,8 +253,8 @@ comments below).
Upon completion of the database 0 is returned, 1 is returned upon successful
return of record with possibly more remaining (we haven't reached the end of
the database yet), 2 is returned if the record contains an unresolved
-.Nm tc
-expansion, \-1 is returned if an system error occurred, and \-2
+.Ic tc
+expansion, \-1 is returned if a system error occurred, and \-2
is returned if a potential reference loop is detected (see
.Ic tc=
comments below).
@@ -284,7 +286,7 @@ By convention, the last name is usually a comment and is not intended as
a lookup tag. For example, the
.Em vt100
record from the
-.Nm termcap
+.Xr termcap 5
database begins:
.Pp
.Dl "d0\||\|vt100\||\|vt100-am\||\|vt100am\||\|dec vt100:"
diff --git a/lib/libc/gen/gethostname.3 b/lib/libc/gen/gethostname.3
index 7c0275d88a21..78223225746f 100644
--- a/lib/libc/gen/gethostname.3
+++ b/lib/libc/gen/gethostname.3
@@ -48,18 +48,23 @@
.Ft int
.Fn sethostname "const char *name" "int namelen"
.Sh DESCRIPTION
-.Fn Gethostname
+The
+.Fn gethostname
+function
returns the standard host name for the current processor, as
previously set by
.Fn sethostname .
-The parameter
+The
.Fa namelen
+argument
specifies the size of the
.Fa name
array. The returned name is null-terminated unless insufficient
space is provided.
.Pp
-.Fn Sethostname
+The
+.Fn sethostname
+function
sets the name of the host machine to be
.Fa name ,
which has length
@@ -76,7 +81,7 @@ The
.Fa name
or
.Fa namelen
-parameter gave an
+argument gave an
invalid address.
.It Bq Er EPERM
The caller tried to set the hostname and was not the super-user.
@@ -95,5 +100,5 @@ This includes the trailing
.Sh HISTORY
The
.Fn gethostname
-function call appeared in
+function appeared in
.Bx 4.2 .
diff --git a/lib/libc/gen/getmntinfo.3 b/lib/libc/gen/getmntinfo.3
index 16f6fcc94490..7a3cc0261c30 100644
--- a/lib/libc/gen/getmntinfo.3
+++ b/lib/libc/gen/getmntinfo.3
@@ -60,7 +60,7 @@ The
function
passes its
.Fa flags
-parameter transparently to
+argument transparently to
.Xr getfsstat 2 .
.Sh RETURN VALUES
On successful completion,
diff --git a/lib/libc/gen/getnetgrent.3 b/lib/libc/gen/getnetgrent.3
index 689aeb791793..91d0dd3f07ca 100644
--- a/lib/libc/gen/getnetgrent.3
+++ b/lib/libc/gen/getnetgrent.3
@@ -85,7 +85,9 @@ If
is called with a different netgroup than the previous call, an implicit
.Fn endnetgrent
is implied.
-.Fn Setnetgrent
+The
+.Fn setnetgrent
+function
also sets the offset to the first member of the netgroup.
.Pp
The function
diff --git a/lib/libc/gen/getobjformat.3 b/lib/libc/gen/getobjformat.3
index c9fd9b004385..f3c15730c0c7 100644
--- a/lib/libc/gen/getobjformat.3
+++ b/lib/libc/gen/getobjformat.3
@@ -37,7 +37,9 @@
.Ft int
.Fn getobjformat "char *buf" "size_t bufsize" "int *argcp" "char **argv"
.Sh DESCRIPTION
+The
.Fn getobjformat
+function
queries several sources to determine the preferred object file
format, and copies its name into a buffer provided by the caller.
.Pp
diff --git a/lib/libc/gen/getpagesize.3 b/lib/libc/gen/getpagesize.3
index 489246520156..80f2f19cf783 100644
--- a/lib/libc/gen/getpagesize.3
+++ b/lib/libc/gen/getpagesize.3
@@ -45,7 +45,9 @@
.Ft int
.Fn getpagesize void
.Sh DESCRIPTION
-.Fn Getpagesize
+The
+.Fn getpagesize
+function
returns the number of bytes in a page.
Page granularity is the granularity of many of the memory
management calls.
@@ -59,5 +61,5 @@ hardware page size.
.Sh HISTORY
The
.Fn getpagesize
-function call appeared in
+function appeared in
.Bx 4.2 .
diff --git a/lib/libc/gen/getpeereid.3 b/lib/libc/gen/getpeereid.3
index 7b20e5596b7c..12999e501b09 100644
--- a/lib/libc/gen/getpeereid.3
+++ b/lib/libc/gen/getpeereid.3
@@ -95,7 +95,9 @@ socket option.
.Sh RETURN VALUES
.Rv -std getpeereid
.Sh ERRORS
+The
.Fn getpeereid
+function
fails if:
.Bl -tag -width Er
.It Bq Er EBADF
diff --git a/lib/libc/gen/getttyent.3 b/lib/libc/gen/getttyent.3
index 593bef191184..4a8535fca367 100644
--- a/lib/libc/gen/getttyent.3
+++ b/lib/libc/gen/getttyent.3
@@ -183,7 +183,7 @@ The routines
and
.Fn isnettty
return non-zero if the dialup or network flag is set for the
-tty entry relating to the tty named by the parameter, and
+tty entry relating to the tty named by the argument, and
zero otherwise.
.Sh FILES
.Bl -tag -width /etc/ttys -compact
diff --git a/lib/libc/gen/getusershell.3 b/lib/libc/gen/getusershell.3
index f2645fb7b3ec..581d06c1b5b5 100644
--- a/lib/libc/gen/getusershell.3
+++ b/lib/libc/gen/getusershell.3
@@ -1,3 +1,6 @@
+.\" $NetBSD: getusershell.3,v 1.6 1999/03/22 19:44:42 garbled Exp $
+.\" $FreeBSD$
+.\"
.\" Copyright (c) 1985, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -54,18 +57,16 @@
The
.Fn getusershell
function
-returns a pointer to a legal user shell as defined by the
-system manager in the file
-.Pa /etc/shells .
-If
-.Pa /etc/shells
-is unreadable or does not exist,
+returns a pointer to a valid user shell as defined by the
+system manager in the shells database as described in
+.Xr shells 5 .
+If the shells database is not available,
.Fn getusershell
behaves as if
.Pa /bin/sh
and
.Pa /bin/csh
-were listed in the file.
+were listed.
.Pp
The
.Fn getusershell
diff --git a/lib/libc/gen/lockf.3 b/lib/libc/gen/lockf.3
index c728320862ce..abb00ac3b8f7 100644
--- a/lib/libc/gen/lockf.3
+++ b/lib/libc/gen/lockf.3
@@ -171,6 +171,7 @@ locked region is unlocked would cause a deadlock and fails with an
.Er EDEADLK
error.
.Pp
+The
.Fn lockf ,
.Xr fcntl 2
and
@@ -182,7 +183,9 @@ Blocking on a section is interrupted by any signal.
.Rv -std lockf
In the case of a failure, existing locks are not changed.
.Sh ERRORS
+The
.Fn lockf
+function
will fail if:
.Bl -tag -width Er
.It Bq Er EAGAIN
diff --git a/lib/libc/gen/modf.3 b/lib/libc/gen/modf.3
index 9089b002102d..4afd4e6b47c7 100644
--- a/lib/libc/gen/modf.3
+++ b/lib/libc/gen/modf.3
@@ -56,7 +56,7 @@ function breaks the argument
into integral and fractional parts, each of which has the
same sign as the argument.
It stores the integral part as a
-.Em double
+.Vt double
in the object pointed to by
.Fa iptr .
.Sh RETURN VALUES
diff --git a/lib/libc/gen/msgctl.3 b/lib/libc/gen/msgctl.3
index cde32340c2c7..b0264b5428c7 100644
--- a/lib/libc/gen/msgctl.3
+++ b/lib/libc/gen/msgctl.3
@@ -168,11 +168,15 @@ or
.Sh RETURN VALUES
.Rv -std msgctl
.Sh ERRORS
+The
.Fn msgctl
+function
will fail if:
.Bl -tag -width Er
.It Bq Er EPERM
+The
.Fa cmd
+argument
is equal to IPC_SET or IPC_RMID and the caller is not the super-user, nor does
the effective uid match either the
.Va msg_perm.uid
@@ -188,13 +192,17 @@ but the caller is not the super-user.
The command is IPC_STAT
and the caller has no read permission for this message queue.
.It Bq Er EINVAL
+The
.Fa msqid
+argument
is not a valid message queue identifier.
.Pp
.Va cmd
is not a valid command.
.It Bq Er EFAULT
+The
.Fa buf
+argument
specifies an invalid address.
.El
.Sh SEE ALSO
diff --git a/lib/libc/gen/signal.3 b/lib/libc/gen/signal.3
index 24b1c6b4e052..c536cd76141a 100644
--- a/lib/libc/gen/signal.3
+++ b/lib/libc/gen/signal.3
@@ -50,7 +50,7 @@
or in
.Fx Ns 's
equivalent but easier to read typedef'd version:
-.Ft typedef "void \*(lp*sig_t\*(rp \*(lpint\*(rp"
+.Ft typedef "void \*(lp*sig_t\*(rp \*(lpint\*(rp" ;
.Ft sig_t
.Fn signal "int sig" "sig_t func"
.Sh DESCRIPTION
@@ -135,7 +135,7 @@ is possible on a descriptor (see
.Pp
The
.Fa sig
-parameter specifies which signal was received.
+argument specifies which signal was received.
The
.Fa func
procedure allows a user to choose the action upon receipt of a signal.
@@ -211,12 +211,16 @@ Otherwise, SIG_ERR is returned and the global variable
.Va errno
is set to indicate the error.
.Sh ERRORS
-.Fn Signal
+The
+.Fn signal
+function
will fail and no action will take place if one of the
following occur:
.Bl -tag -width Er
.It Bq Er EINVAL
-.Em Sig
+The
+.Fa sig
+argument
is not a valid signal number.
.It Bq Er EINVAL
An attempt is made to ignore or supply a handler for