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

View File

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

View File

@ -56,29 +56,29 @@ Each of the macros
and
.Fn islessgreater
take arguments
.Va x
.Fa x
and
.Va y
.Fa y
and return a non-zero value if and only if its nominal
relation on
.Va x
.Fa x
and
.Va y
.Fa y
is true.
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.
.Pp
The
.Fn isunordered
macro takes arguments
.Va x
.Fa x
and
.Va y
.Fa y
and returns non-zero if and only if neither
.Va x
.Fa x
nor
.Va y
.Fa y
are NaNs.
For any pair of floating-point values, one
of the relationships (less, greater, equal, unordered) holds.
@ -93,7 +93,7 @@ The
.Fn isless ,
.Fn islessequal ,
.Fn islessgreater ,
and
and
.Fn isunordered
macros conform to
.St -isoC-99 .

View File

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

View File

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

View File

@ -83,7 +83,7 @@ If
.Fa mode
is
.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
is sent when all operations have completed.
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;
in particular, there is no guarantee that they will be executed in
the order 0, 1, ...,
.Fa nent Ns \&-1 .
.Fa nent Ns \-1 .
.Sh RETURN VALUES
If
.Fa mode
@ -104,7 +104,7 @@ is
the
.Fn lio_listio
function returns 0 if the operations completed successfully,
otherwise -1.
otherwise \-1.
.Pp
If
.Fa mode
@ -113,7 +113,7 @@ is
the
.Fn lio_listio
function 0 if the operations are successfully queued,
otherwise -1.
otherwise \-1.
.Sh ERRORS
The
.Fn lio_listio
@ -152,8 +152,7 @@ and
If
.Fn lio_listio
succeeds, or fails with an error code of
.Er EAGAIN ,
.Er EINTR ,
.Er EAGAIN , EINTR ,
or
.Er EIO ,
some of the requests may have been initiated.