Assorted mdoc(7) fixes.

This commit is contained in:
Ruslan Ermilov 2003-06-01 19:19:59 +00:00
parent d8f9e010d2
commit 0e35e492fc
6 changed files with 190 additions and 180 deletions

View File

@ -37,7 +37,7 @@
.In link.h .In link.h
.In dlfcn.h .In dlfcn.h
.Ft int .Ft int
.Fn dlinfo "void * __restrict handle" "int request" "void * __restrict p" .Fn dlinfo "void * restrict handle" "int request" "void * restrict p"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn dlinfo .Fn dlinfo
@ -50,154 +50,168 @@ argument depend on value of the
.Fa request .Fa request
argument provided by caller. argument provided by caller.
.Pp .Pp
A The
.Fa handle .Fa handle
argument is either the value returned from a argument is either the value returned from the
.Fn dlopen .Xr dlopen 3
function call or special handle function call or special handle
.Dv RTLD_SELF . .Dv RTLD_SELF .
If handle is the value returned from If
.Fn dlopen .Fa handle
call, the information returned by the is the value returned from
.Xr dlopen 3 ,
the information returned by the
.Fn dlinfo .Fn dlinfo
function is pertains the specified object. function pertains to the specified object.
If handle is the special handle If handle is the special handle
.Dv RTLD_SELF , .Dv RTLD_SELF ,
the information returned pertains to the caller itself. the information returned pertains to the caller itself.
.Pp .Pp
The following are possible values for Possible values for the
.Fa request .Fa request
argument to be passed into argument are:
.Fn dlinfo : .Bl -tag -width indent
.Bl -tag -width Ds .It Dv RTLD_DI_LINKMAP
.It RTLD_DI_LINKMAP Retrieve the
Retrieve the Link_map (or .Vt Link_map
.Ft struct link_map ) .Pq Vt "struct link_map"
structure pointer for structure pointer for the specified
.Fa handle .Fa handle .
specified. On successful return, the
On successful return the
.Fa p .Fa p
argument is filled with pointer to Link_map structure argument is filled with the pointer to the
.Ft ( Link_map **p ) .Vt Link_map
describing shared object specified by structure
.Pq Fa "Link_map **p"
describing a shared object specified by the
.Fa handle .Fa handle
argument. argument.
.Ft Link_map The
stuctures are maintained as double-linked list by .Vt Link_map
.Xr ld.so 1 stuctures are maintained as a doubly linked list by
in same order as .Xr ld.so 1 ,
.Fn dlopen in the same order as
.Xr dlopen 3
and and
.Fn dlclose .Xr dlclose 3
are called. are called.
See See
.Sx EXAMPLES .Sx EXAMPLES ,
(Example 1.) example 1.
.Pp .Pp
The The
.Ft Link_map .Vt Link_map
structure is defined in <link.h> and have following members: structure is defined in
.Pp .Aq Pa link.h
.Bd -literal and has the following members:
caddr_t l_addr; /* Base Address of library */ .Bd -literal -offset indent
const char *l_name; /* Absolute Path to Library */ caddr_t l_addr; /* Base Address of library */
const void *l_ld; /* Pointer to .dynamic in memory */ const char *l_name; /* Absolute Path to Library */
struct link_map *l_next, /* linked list of of mapped libs */ const void *l_ld; /* Pointer to .dynamic in memory */
*l_prev; struct link_map *l_next, /* linked list of mapped libs */
*l_prev;
.Ed .Ed
.Bl -tag -width Ds .Bl -tag -width ".Va l_addr"
.It l_addr .It Va l_addr
The base address of the object loaded into memory. The base address of the object loaded into memory.
.It l_name .It Va l_name
The full name of loaded shared object. The full name of the loaded shared object.
.It l_ld .It Va l_ld
The address of dynamic linking information segment The address of the dynamic linking information segment
.Dv ( PT_DYNAMIC ) .Pq Dv PT_DYNAMIC
loaded into memory. loaded into memory.
.It l_next .It Va l_next
The next Link_map structure on the link-map list. The next
.It l_prev .Vt Link_map
The previous Link_map structure on the link-map list. structure on the link-map list.
.It Va l_prev
The previous
.Vt Link_map
structure on the link-map list.
.El .El
.It RTLD_DI_SERINFO .It Dv RTLD_DI_SERINFO
Retrieve the library search paths associated with given Retrieve the library search paths associated with the given
.Fa handle .Fa handle
argument. argument.
The The
.Fa p .Fa p
argument should point to argument should point to
.Ft Dl_serinfo .Vt Dl_serinfo
structure buffer structure buffer
.Fa ( Dl_serinfo *p ) . .Pq Fa "Dl_serinfo *p" .
.Ft Dl_serinfo The
structure must be initialized first with a .Vt Dl_serinfo
structure must be initialized first with the
.Dv RTLD_DI_SERINFOSIZE .Dv RTLD_DI_SERINFOSIZE
request. request.
.Pp .Pp
The returned The returned
.Ft Dl_serinfo .Vt Dl_serinfo
structure contains structure contains
.Dv dls_cnt .Va dls_cnt
.Ft Dl_serpath .Vt Dl_serpath
entries. entries.
Each entry's Each entry's
.Dv dlp_name .Va dlp_name
field points to the search path. field points to the search path.
The corresponding The corresponding
.Dv dlp_info .Va dlp_info
field contains one of more flags indicating the origin of the path (see the field contains one of more flags indicating the origin of the path (see the
.Dv LA_SER_* .Dv LA_SER_*
flags defined in <link.h> header file.) flags defined in the
.Aq Pa link.h
header file).
See See
.Sx EXAMPLES .Sx EXAMPLES ,
(Example 2) for usage example. example 2, for a usage example.
.It RTLD_DI_SERINFOSIZE .It Dv RTLD_DI_SERINFOSIZE
Initialize a Initialize a
.Ft Dl_serinfo .Vt Dl_serinfo
structure for use in a structure for use in a
.Dv RTLD_DI_SERINFO .Dv RTLD_DI_SERINFO
request. request.
Both the Both the
.Dv dls_cnt .Va dls_cnt
and and
.Dv dls_size .Va dls_size
fields are returned to indicate the number of search paths applicable fields are returned to indicate the number of search paths applicable
to the handle, and the total size of a to the handle, and the total size of a
.Ft Dl_serinfo .Vt Dl_serinfo
buffer required to hold buffer required to hold
.Dv dls_cnt .Va dls_cnt
.Ft Dl_serpath .Vt Dl_serpath
entries and the associated search path strings. entries and the associated search path strings.
See See
.Sx EXAMPLES .Sx EXAMPLES ,
(Example 2) for usage example. example 2, for a usage example.
.It RTLD_DI_ORIGIN .It Va RTLD_DI_ORIGIN
Retrieve the origin of the dynamic object associated with the handle. Retrieve the origin of the dynamic object associated with the handle.
On successful return On successful return,
.Fa p .Fa p
argument is filled with argument is filled with the
.Ft char .Vt char
pointer pointer
.Ft ( char *p ) . .Pq Fa "char *p" .
.El .El
.Sh EXAMPLES .Sh EXAMPLES
Example 1: Using Example 1: Using
.Fn dlinfo .Fn dlinfo
to retrieve Link_map structure. to retrieve
.Vt Link_map
structure.
.Pp .Pp
The following example shows how dynamic library can detect the list The following example shows how dynamic library can detect the list
of shared libraries loaded after caller's one. of shared libraries loaded after caller's one.
For simplicity, error checking has been omitted. For simplicity, error checking has been omitted.
.Bd -literal .Bd -literal -offset indent
Link_map *map; Link_map *map;
dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map); dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map);
while (map != NULL) { while (map != NULL) {
printf("%p: %s\\n", map->l_addr, map->l_name); printf("%p: %s\\n", map->l_addr, map->l_name);
map = map->l_next; map = map->l_next;
} }
.Ed .Ed
.Pp .Pp
Example 2: Using Example 2: Using
@ -206,37 +220,37 @@ to retrieve the library search paths.
.Pp .Pp
The following example shows how a dynamic object can inspect the library The following example shows how a dynamic object can inspect the library
search paths that would be used to locate a simple filename with search paths that would be used to locate a simple filename with
.Fn dlopen . .Xr dlopen 3 .
For simplicity, error checking has been omitted. For simplicity, error checking has been omitted.
.Bd -literal .Bd -literal -offset indent
Dl_serinfo _info, *info = &_info; Dl_serinfo _info, *info = &_info;
Dl_serpath *path; Dl_serpath *path;
unsigned int cnt; unsigned int cnt;
/* determine search path count and required buffer size */ /* determine search path count and required buffer size */
dlinfo(RTLD_SELF, RTLD_DI_SERINFOSIZE, (void *)info); dlinfo(RTLD_SELF, RTLD_DI_SERINFOSIZE, (void *)info);
/* allocate new buffer and initialize */ /* allocate new buffer and initialize */
info = malloc(_info.dls_size); info = malloc(_info.dls_size);
info->dls_size = _info.dls_size; info->dls_size = _info.dls_size;
info->dls_cnt = _info.dls_cnt; info->dls_cnt = _info.dls_cnt;
/* obtain sarch path information */ /* obtain sarch path information */
dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info); dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info);
path = &info->dls_serpath[0]; path = &info->dls_serpath[0];
for (cnt = 1; cnt <= info->dls_cnt; cnt++, path++) { for (cnt = 1; cnt <= info->dls_cnt; cnt++, path++) {
(void) printf("%2d: %s\\n", cnt, path->dls_name); (void) printf("%2d: %s\\n", cnt, path->dls_name);
} }
.Ed .Ed
.Sh RETURN VALUES .Sh RETURN VALUES
The The
.Fn dlinfo .Fn dlinfo
function returns 0 on success, or -1 if error occured. function returns 0 on success, or \-1 if an error occured.
Whenever an error has been detected, a message detailing it can Whenever an error has been detected, a message detailing it can
be retrieved via a call to be retrieved via a call to
.Fn dlerror . .Xr dlerror 3 .
.Sh SEE ALSO .Sh SEE ALSO
.Xr rtld 1 , .Xr rtld 1 ,
.Xr dladdr 3 , .Xr dladdr 3 ,
@ -247,13 +261,14 @@ The
.Fn dlinfo .Fn dlinfo
function first appeared in the Solaris operating system. function first appeared in the Solaris operating system.
In In
.Fx .Fx ,
it first appeared in it first appeared in
.Fx 4.8 . .Fx 4.8 .
.Sh AUTHORS .Sh AUTHORS
.An -nosplit
The The
.Fx .Fx
implementation of implementation of the
.Fn dlinfo .Fn dlinfo
function was originally written by function was originally written by
.An Alexey Zelkin .An Alexey Zelkin

View File

@ -48,41 +48,42 @@
The The
.Fn fpclassify .Fn fpclassify
macro takes an argument of macro takes an argument of
.Va x .Fa x
and returns one of the following manifest constants. and returns one of the following manifest constants.
.Bl -tag -width ".Dv FP_SUBNORMAL" .Bl -tag -width ".Dv FP_SUBNORMAL"
.It Dv FP_INFINITE .It Dv FP_INFINITE
Indicates that Indicates that
.Va x .Fa x
is an infinite number. is an infinite number.
.It Dv FP_NAN .It Dv FP_NAN
Indicates that Indicates that
.Va x .Fa x
is not a number (NaN). is not a number (NaN).
.It Dv FP_NORMAL .It Dv FP_NORMAL
Indicates that Indicates that
.Va x .Fa x
is a normalized number. is a normalized number.
.It Dv FP_SUBNORMAL .It Dv FP_SUBNORMAL
Indicates that Indicates that
.Va x .Fa x
is a denormalized number. is a denormalized number.
.It Dv FP_ZERO .It Dv FP_ZERO
Indicates that Indicates that
.Va x .Fa x
is zero (0 or -0). is zero (0 or \-0).
.El .El
.Pp .Pp
The The
.Fn isfinite .Fn isfinite
macro returns a non-zero value if and only if its argument has macro returns a non-zero value if and only if its argument has
a finite (zero, subnormal, or normal) value. The a finite (zero, subnormal, or normal) value.
The
.Fn isinf , .Fn isinf ,
.Fn isnan , .Fn isnan ,
and and
.Fn isnormal .Fn isnormal
macros return non-zero if and only if macros return non-zero if and only if
.Va x .Fa x
is an infinity, NaN, is an infinity, NaN,
or a non-zero normalized number, respectively. or a non-zero normalized number, respectively.
.Pp .Pp
@ -121,7 +122,7 @@ introduced
and and
.Fn isnan .Fn isnan
functions, which accepted functions, which accepted
.Ft double .Vt double
arguments; these have been superseded by the macros arguments; these have been superseded by the macros
described above. described above.
.Sh BUGS .Sh BUGS

View File

@ -56,29 +56,29 @@ Each of the macros
and and
.Fn islessgreater .Fn islessgreater
take arguments take arguments
.Va x .Fa x
and and
.Va y .Fa y
and return a non-zero value if and only if its nominal and return a non-zero value if and only if its nominal
relation on relation on
.Va x .Fa x
and and
.Va y .Fa y
is true. is true.
These macros always return zero if either These macros always return zero if either
argument is a not a number (NaN), but unlike the corresponding C argument is not a number (NaN), but unlike the corresponding C
operators, they never raise a floating point exception. operators, they never raise a floating point exception.
.Pp .Pp
The The
.Fn isunordered .Fn isunordered
macro takes arguments macro takes arguments
.Va x .Fa x
and and
.Va y .Fa y
and returns non-zero if and only if neither and returns non-zero if and only if neither
.Va x .Fa x
nor nor
.Va y .Fa y
are NaNs. are NaNs.
For any pair of floating-point values, one For any pair of floating-point values, one
of the relationships (less, greater, equal, unordered) holds. of the relationships (less, greater, equal, unordered) holds.
@ -93,7 +93,7 @@ The
.Fn isless , .Fn isless ,
.Fn islessequal , .Fn islessequal ,
.Fn islessgreater , .Fn islessgreater ,
and and
.Fn isunordered .Fn isunordered
macros conform to macros conform to
.St -isoC-99 . .St -isoC-99 .

View File

@ -36,15 +36,9 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.In wordexp.h .In wordexp.h
.Ft int .Ft int
.Fo wordexp .Fn wordexp "const char * restrict words" "wordexp_t * restrict we" "int flags"
.Fa "const char * restrict words"
.Fa "wordexp_t * restrict we"
.Fa "int flags"
.Fc
.Ft void .Ft void
.Fo wordfree .Fn wordfree "wordexp_t *we"
.Fa "wordexp_t *we"
.Fc
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn wordexp .Fn wordexp
@ -53,16 +47,16 @@ function performs shell-style word expansion on
and places the list of words into the and places the list of words into the
.Va we_wordv .Va we_wordv
member of member of
.Va we , .Fa we ,
and the number of words into and the number of words into
.Va we_wordc . .Va we_wordc .
.Pp .Pp
The The
.Va flags .Fa flags
argument is the bitwise inclusive OR of any of the following constants: argument is the bitwise inclusive OR of any of the following constants:
.Bl -tag -width ".Dv WRDE_SHOWERR" .Bl -tag -width ".Dv WRDE_SHOWERR"
.It Dv WRDE_APPEND .It Dv WRDE_APPEND
Append the words to those generate by a previous call to Append the words to those generated by a previous call to
.Fn wordexp . .Fn wordexp .
.It Dv WRDE_DOOFS .It Dv WRDE_DOOFS
As many As many
@ -70,7 +64,7 @@ As many
pointers as are specified by the pointers as are specified by the
.Va we_offs .Va we_offs
member of member of
.Va we .Fa we
are added to the front of are added to the front of
.Va we_wordv . .Va we_wordv .
.It Dv WRDE_NOCMD .It Dv WRDE_NOCMD
@ -81,7 +75,7 @@ See the note in
before using this. before using this.
.It Dv WRDE_REUSE .It Dv WRDE_REUSE
The The
.Va we .Fa we
argument was passed to a previous successful call to argument was passed to a previous successful call to
.Fn wordexp .Fn wordexp
but has not been passed to but has not been passed to
@ -97,13 +91,13 @@ Report error on an attempt to expand an undefined shell variable.
The The
.Vt wordexp_t .Vt wordexp_t
structure is defined in structure is defined in
.Pa wordexp.h .Aq Pa wordexp.h
as: as:
.Bd -literal -offset indent .Bd -literal -offset indent
typedef struct { typedef struct {
size_t we_wordc; /* count of words matched */ size_t we_wordc; /* count of words matched */
char **we_wordv; /* pointer to list of words */ char **we_wordv; /* pointer to list of words */
size_t we_offs; /* slots to reserve in we_wordv */ size_t we_offs; /* slots to reserve in we_wordv */
} wordexp_t; } wordexp_t;
.Ed .Ed
.Pp .Pp
@ -127,7 +121,7 @@ error codes:
The The
.Fa words .Fa words
argument contains one of the following unquoted characters: argument contains one of the following unquoted characters:
<newline>, .Aq newline ,
.Ql | , .Ql | ,
.Ql & , .Ql & ,
.Ql \&; , .Ql \&; ,
@ -164,8 +158,8 @@ Field separator.
.El .El
.Sh EXAMPLES .Sh EXAMPLES
Invoke the editor on all Invoke the editor on all
.Dq Li \&.c .Pa .c
files in the current directory, files in the current directory
and and
.Pa /etc/motd .Pa /etc/motd
(error checking omitted): (error checking omitted):

View File

@ -46,7 +46,7 @@
.In stdlib.h .In stdlib.h
.Ft int .Ft int
.Fn grantpt "int fildes" .Fn grantpt "int fildes"
.Ft char * .Ft "char *"
.Fn ptsname "int fildes" .Fn ptsname "int fildes"
.Ft int .Ft int
.Fn unlockpt "int fildes" .Fn unlockpt "int fildes"
@ -71,19 +71,21 @@ The
function is used to establish ownership and permissions function is used to establish ownership and permissions
of the slave device counterpart to the master device of the slave device counterpart to the master device
specified with specified with
.Va fildes . .Fa fildes .
The slave device's ownership is set to the real user ID The slave device's ownership is set to the real user ID
of the calling process, and the permissions are set to of the calling process, and the permissions are set to
user readable-writable and group writable. user readable-writable and group writable.
The group owner of the slave device is also set to the The group owner of the slave device is also set to the
group "tty" if it exists on the system; otherwise, it group
.Dq Li tty
if it exists on the system; otherwise, it
is left untouched. is left untouched.
.Pp .Pp
The The
.Fn ptsname .Fn ptsname
function returns the full pathname of the slave device function returns the full pathname of the slave device
counterpart to the master device specified with counterpart to the master device specified with
.Va fildes . .Fa fildes .
This value can be used This value can be used
to subsequently open the appropriate slave after to subsequently open the appropriate slave after
.Fn posix_openpt .Fn posix_openpt
@ -95,15 +97,17 @@ The
.Fn unlockpt .Fn unlockpt
function clears the lock held on the pseudo-terminal pair function clears the lock held on the pseudo-terminal pair
for the master device specified with for the master device specified with
.Va fildes . .Fa fildes .
.Pp .Pp
The The
.Fn posix_openpt .Fn posix_openpt
function opens the first available master pseudo-terminal function opens the first available master pseudo-terminal
device and returns a descriptor to it. device and returns a descriptor to it.
.Va mode The
.Fa mode
argument
specifies the flags used for opening the device: specifies the flags used for opening the device:
.Bl -tag -width O_NOCTTY .Bl -tag -width ".Dv O_NOCTTY"
.It Dv O_RDWR .It Dv O_RDWR
Open for reading and writing. Open for reading and writing.
.It Dv O_NOCTTY .It Dv O_NOCTTY
@ -111,19 +115,14 @@ If set, do not allow the terminal to become
the controlling terminal for the calling process. the controlling terminal for the calling process.
.El .El
.Sh RETURN VALUES .Sh RETURN VALUES
The .Rv -std grantpt unlockpt
.Fn grantpt
and
.Fn unlockpt
functions return 0 on success; otherwise -1 is returned and
.Va errno
is set to indicate the error.
.Pp .Pp
The The
.Fn ptsname .Fn ptsname
function returns a pointer to the name function returns a pointer to the name
of the slave device on success; of the slave device on success; otherwise a
otherwise a NULL pointer is returned and .Dv NULL
pointer is returned and the global variable
.Va errno .Va errno
is set to indicate the error. is set to indicate the error.
.Pp .Pp
@ -131,7 +130,7 @@ The
.Fn posix_openpt .Fn posix_openpt
function returns a file descriptor to the first function returns a file descriptor to the first
available master pseudo-terminal device on success; available master pseudo-terminal device on success;
otherwise -1 is returned and otherwise \-1 is returned and the global variable
.Va errno .Va errno
is set to indicate the error. is set to indicate the error.
.Sh ERRORS .Sh ERRORS
@ -144,8 +143,8 @@ functions may fail and set
.Va errno .Va errno
to: to:
.Bl -tag -width Er .Bl -tag -width Er
.It EINVAL .It Bq Er EINVAL
.Va fildes .Fa fildes
is not a master pseudo-terminal device. is not a master pseudo-terminal device.
.El .El
.Pp .Pp
@ -155,7 +154,7 @@ function may set
.Va errno .Va errno
to: to:
.Bl -tag -width Er .Bl -tag -width Er
.It EACCES .It Bq Er EACCES
The slave pseudo-terminal device could not be accessed. The slave pseudo-terminal device could not be accessed.
.El .El
.Pp .Pp
@ -165,10 +164,10 @@ function may fail and set
.Va errno .Va errno
to: to:
.Bl -tag -width Er .Bl -tag -width Er
.It EINVAL .It Bq Er EINVAL
.Va mode .Fa mode
consists an an invalid mode bit. consists an an invalid mode bit.
.It EAGAIN .It Bq Er EAGAIN
The system has no available pseudo-terminal devices. The system has no available pseudo-terminal devices.
.El .El
.Pp .Pp
@ -179,15 +178,17 @@ and
.Fn unlockpt .Fn unlockpt
functions may also fail and set functions may also fail and set
.Va errno .Va errno
for any of the errors specified for the routine for any of the errors specified for the
.Xr fstat 2 . .Xr fstat 2
system call.
.Pp .Pp
The The
.Fn posix_openpt .Fn posix_openpt
function may also fail and set function may also fail and set
.Va errno .Va errno
for any of the errors specified for the routine for any of the errors specified for the
.Xr open 2 . .Xr open 2
system call.
.Sh SEE ALSO .Sh SEE ALSO
.Xr open 2 , .Xr open 2 ,
.Xr pty 4 , .Xr pty 4 ,

View File

@ -83,7 +83,7 @@ If
.Fa mode .Fa mode
is is
.Dv LIO_NOWAIT , .Dv LIO_NOWAIT ,
the requests are processed asynchronously and the signal specified by the requests are processed asynchronously, and the signal specified by
.Fa sig .Fa sig
is sent when all operations have completed. is sent when all operations have completed.
If If
@ -95,7 +95,7 @@ the calling process is not notified of I/O completion.
The order in which the requests are carried out is not specified; The order in which the requests are carried out is not specified;
in particular, there is no guarantee that they will be executed in in particular, there is no guarantee that they will be executed in
the order 0, 1, ..., the order 0, 1, ...,
.Fa nent Ns \&-1 . .Fa nent Ns \-1 .
.Sh RETURN VALUES .Sh RETURN VALUES
If If
.Fa mode .Fa mode
@ -104,7 +104,7 @@ is
the the
.Fn lio_listio .Fn lio_listio
function returns 0 if the operations completed successfully, function returns 0 if the operations completed successfully,
otherwise -1. otherwise \-1.
.Pp .Pp
If If
.Fa mode .Fa mode
@ -113,7 +113,7 @@ is
the the
.Fn lio_listio .Fn lio_listio
function 0 if the operations are successfully queued, function 0 if the operations are successfully queued,
otherwise -1. otherwise \-1.
.Sh ERRORS .Sh ERRORS
The The
.Fn lio_listio .Fn lio_listio
@ -152,8 +152,7 @@ and
If If
.Fn lio_listio .Fn lio_listio
succeeds, or fails with an error code of succeeds, or fails with an error code of
.Er EAGAIN , .Er EAGAIN , EINTR ,
.Er EINTR ,
or or
.Er EIO , .Er EIO ,
some of the requests may have been initiated. some of the requests may have been initiated.