enclose code smaples/structure defns/etc in ".in +4n / .in"

This commit is contained in:
Michael Kerrisk 2007-12-19 06:16:04 +00:00
parent 28f6564486
commit bd19142309
33 changed files with 94 additions and 96 deletions

View File

@ -44,7 +44,7 @@ structure, updates kernel parameters from field values,
and returns the same structure with current kernel values.
This structure is declared as follows:
.PP
.RS 4
.in +4n
.nf
struct timex {
int modes; /* mode selector */
@ -61,7 +61,7 @@ struct timex {
long tick; /* usecs between clock ticks */
};
.fi
.RE
.in
.PP
The
.I modes
@ -70,7 +70,7 @@ It may contain a
.RI bitwise- or
combination of zero or more of the following bits:
.PP
.RS 4
.in +4n
.nf
#define ADJ_OFFSET 0x0001 /* time offset */
#define ADJ_FREQUENCY 0x0002 /* frequency offset */
@ -81,7 +81,7 @@ combination of zero or more of the following bits:
#define ADJ_TICK 0x4000 /* tick value */
#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime() */
.fi
.RE
.in
.PP
Ordinary users are restricted to a zero value for
.IR mode .
@ -93,7 +93,7 @@ On success,
.BR adjtimex ()
returns the clock state:
.PP
.RS 4
.in +4n
.nf
#define TIME_OK 0 /* clock synchronized */
#define TIME_INS 1 /* insert leap second */
@ -102,7 +102,7 @@ returns the clock state:
#define TIME_WAIT 4 /* leap second has occurred */
#define TIME_BAD 5 /* clock not synchronized */
.fi
.RE
.in
.PP
On failure,
.BR adjtimex ()

View File

@ -77,7 +77,7 @@ The
.I sigaction
structure is defined as something like
.sp
.RS 4
.in +4n
.nf
struct sigaction {
void (*sa_handler)(int);
@ -87,7 +87,7 @@ struct sigaction {
void (*sa_restorer)(void);
}
.fi
.RE
.in
.PP
On some architectures a union is involved: do not assign to both
.I sa_handler
@ -140,7 +140,7 @@ flag is used.
specifies a set of flags which modify the behavior of the signal handling
process.
It is formed by the bitwise OR of zero or more of the following:
.RS
.RS 4
.TP
.B SA_NOCLDSTOP
If
@ -206,7 +206,7 @@ parameter to
.I sa_sigaction
is a struct with the following elements
.sp
.RS 4
.in +4n
.nf
siginfo_t {
.\" FIXME si_tid and si_overrun are not documented.
@ -227,7 +227,7 @@ siginfo_t {
int si_fd; /* File descriptor */
}
.fi
.RE
.in
.IR si_signo ", " si_errno " and " si_code
are defined for all signals.

View File

@ -75,7 +75,7 @@ If we are interested in performing just one
of these tasks then the other argument can be specified as NULL.
Each of these arguments is a structure of the following type:
.sp
.RS 4
.in +4n
.nf
typedef struct {
void *ss_sp; /* Base address of stack */
@ -83,7 +83,7 @@ typedef struct {
size_t ss_size; /* Number of bytes in stack */
} stack_t;
.fi
.RE
.in
To establish a new alternate signal stack,
\fIss.ss_flags\fP is set to zero, and \fIss.ss_sp\fP and
@ -202,7 +202,7 @@ had to know the direction of stack growth.
The following code segment demonstrates the use of
.BR sigaltstack ():
.RS
.in +4n
.nf
stack_t ss;
@ -214,7 +214,7 @@ ss.ss_flags = 0;
if (sigaltstack(&ss, NULL) == \-1)
/* Handle error */;
.fi
.RE
.in
.SH "SEE ALSO"
.BR execve (2),
.BR setrlimit (2),

View File

@ -96,7 +96,7 @@ All of these system calls return a
.I stat
structure, which contains the following fields:
.PP
.RS 4
.in +4n
.nf
struct stat {
dev_t st_dev; /* ID of device containing file */
@ -114,7 +114,7 @@ struct stat {
time_t st_ctime; /* time of last status change */
};
.fi
.RE
.in
.PP
The
.I st_dev
@ -194,7 +194,7 @@ is changed by writing or by setting inode information
The following POSIX macros are defined to check the file type using the
.I st_mode
field:
.RS
.RS 4
.TP 1.2i
.BR S_ISREG (m)
is it a regular file?
@ -221,7 +221,7 @@ socket? (Not in POSIX.1-1996.)
The following flags are defined for the
.I st_mode
field:
.RS 4
.in +4n
.TS
lB l l.
S_IFMT 0170000 bit mask for the file type bit fields
@ -248,7 +248,7 @@ S_IROTH 00004 others have read permission
S_IWOTH 00002 others have write permission
S_IXOTH 00001 others have execute permission
.TE
.RE
.in
.P
The set-group-ID bit
.RB ( S_ISGID )

View File

@ -43,7 +43,7 @@ is a pointer to a
.I statfs
structure defined approximately as follows:
.RS 4
.in +4n
.nf
struct statfs {
long f_type; /* type of filesystem (see below) */
@ -104,7 +104,7 @@ File system types:
XFS_SUPER_MAGIC 0x58465342
_XIAFS_SUPER_MAGIC 0x012FD16D
.fi
.RE
.in
.PP
Nobody knows what
.I f_fsid

View File

@ -70,14 +70,14 @@ The
.I utimbuf
structure is:
.RS 4
.in +4n
.nf
struct utimbuf {
time_t actime; /* access time */
time_t modtime; /* modification time */
};
.fi
.RE
.in
The function
.BR utime ()
@ -92,14 +92,14 @@ The
.I timeval
structure is:
.RS 4
.in +4n
.nf
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
.fi
.RE
.in
.PP
.IR times [0]
specifies the new access time, and

View File

@ -160,7 +160,7 @@ This code looks for the
.B IP_TTL
option in a received ancillary buffer:
.PP
.RS 4
.in +4n
.nf
struct msghdr msgh;
struct cmsghdr *cmsg;
@ -185,12 +185,12 @@ if (cmsg == NULL) {
*/
}
.fi
.RE
.in
.PP
The code below passes an array of file descriptors over a Unix socket using
.BR SCM_RIGHTS :
.PP
.RS 4
.in +4n
.nf
struct msghdr msg = {0};
struct cmsghdr *cmsg;
@ -210,7 +210,7 @@ memcpy(fdptr, myfds, NUM_FD * sizeof(int));
/* Sum of the length of all control messages in the buffer: */
msg.msg_controllen = cmsg\->cmsg_len;
.fi
.RE
.in
.SH "SEE ALSO"
.BR recvmsg (2),
.BR sendmsg (2)

View File

@ -91,7 +91,7 @@ separated into year, month, day, etc.
Broken-down time is stored
in the structure \fItm\fP which is defined in \fI<time.h>\fP as follows:
.sp
.RS 4
.in +4n
.nf
struct tm {
int tm_sec; /* seconds */
@ -105,7 +105,7 @@ struct tm {
int tm_isdst; /* daylight saving time */
};
.fi
.RE
.in
.PP
The members of the \fItm\fP structure are:
.TP

View File

@ -79,7 +79,7 @@ and
are the reentrant versions.
They use the following
structure to hold the key data:
.RS 4
.in +4n
.nf
struct crypt_data {
@ -95,7 +95,7 @@ struct crypt_data {
int initialized;
};
.fi
.RE
.in
.PP
Before calling
.BR setkey_r ()

View File

@ -55,7 +55,7 @@ The file \fIstream\fP must have the same format as \fI/etc/group\fP.
.PP
The \fIgroup\fP structure is defined in \fI<grp.h>\fP as follows:
.sp
.RS 4
.in +4n
.nf
struct group {
char *gr_name; /* group name */
@ -64,7 +64,7 @@ struct group {
char **gr_mem; /* group members */
};
.fi
.RE
.in
.SH "RETURN VALUE"
The
.BR fgetgrent ()

View File

@ -66,7 +66,7 @@ The \fIgroup\fP structure is defined in
.I <grp.h>
as follows:
.sp
.RS 4
.in +4n
.nf
struct group {
char *gr_name; /* group name */
@ -76,7 +76,7 @@ struct group {
};
.ta
.fi
.RE
.in
.sp
The non-reentrant functions return a pointer to static storage,
where this static storage contains further pointers to group

View File

@ -88,7 +88,7 @@ was found or an error occurred) is stored in
.PP
The \fIgroup\fP structure is defined in \fI<grp.h>\fP as follows:
.sp
.RS 4
.in +4n
.nf
struct group {
char *gr_name; /* group name */
@ -97,7 +97,7 @@ struct group {
char **gr_mem; /* group members */
};
.fi
.RE
.in
.PP
The maximum needed size for
.I buf

View File

@ -51,7 +51,7 @@ The returned buffer contains a line of format
.PP
The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
.sp
.RS 4
.in +4n
.nf
struct passwd {
char *pw_name; /* user name */
@ -63,7 +63,7 @@ struct passwd {
char *pw_shell; /* shell program */
};
.fi
.RE
.in
.SH "RETURN VALUE"
The
.BR getpw ()

View File

@ -78,7 +78,7 @@ after all processing has been performed.
.PP
The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
.sp
.RS 4
.in +4n
.nf
struct passwd {
char *pw_name; /* user name */
@ -90,7 +90,7 @@ struct passwd {
char *pw_shell; /* shell program */
};
.fi
.RE
.in
.SH "RETURN VALUE"
The
.BR getpwent ()

View File

@ -65,7 +65,7 @@ The \fIpasswd\fP structure is defined in
.I <pwd.h>
as follows:
.sp
.RS 4
.in +4n
.nf
struct passwd {
char *pw_name; /* user name */
@ -77,7 +77,7 @@ struct passwd {
char *pw_shell; /* shell program */
};
.fi
.RE
.in
.sp
The non-reentrant functions return a pointer to static storage,
where this static storage contains further pointers to user

View File

@ -99,7 +99,7 @@ was found or an error occurred) is stored in
.PP
The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
.sp
.RS 4
.in +4n
.nf
struct passwd {
char *pw_name; /* user name */
@ -111,7 +111,7 @@ struct passwd {
char *pw_shell; /* shell program */
};
.fi
.RE
.in
.PP
The maximum needed size for
.I buf

View File

@ -39,7 +39,7 @@ following structure
containing the broken-out
fields of a line in the rpc program number data base,
.IR /etc/rpc .
.RS 4
.in +4n
.LP
.nf
struct rpcent {
@ -48,7 +48,7 @@ struct rpcent {
long r_number; /* rpc program number */
};
.fi
.RE
.in
.LP
The members of this structure are:
.TP 10

View File

@ -86,7 +86,7 @@ function closes \fI/etc/services\fP.
.PP
The \fIservent\fP structure is defined in \fI<netdb.h>\fP as follows:
.sp
.RS 4
.in +4n
.nf
struct servent {
char *s_name; /* official service name */
@ -95,7 +95,7 @@ struct servent {
char *s_proto; /* protocol to use */
}
.fi
.RE
.in
.PP
The members of the \fIservent\fP structure are:
.TP

View File

@ -188,7 +188,7 @@ often with different prototypes.
.SS Structure
The shadow password structure is defined in \fI<shadow.h>\fP as follows:
.sp
.RS 4
.in +4n
.nf
struct spwd {
char *sp_namp; /* Login name */
@ -205,7 +205,7 @@ struct spwd {
unsigned long sp_flag; /* Reserved */
};
.fi
.RE
.in
.SH "RETURN VALUE"
The functions that return a pointer return NULL if no more entries
are available or if an error occurs during processing.

View File

@ -77,14 +77,14 @@ the hash table so that a new table can be constructed.
.PP
The argument \fIitem\fP is of type \fBENTRY\fP, which is a typedef defined in
\fI<search.h>\fP and includes these elements:
.RS 4
.in +4n
.sp
.nf
typedef struct entry {
char *key;
void *data;
} ENTRY;
.RE
.in
.fi
.sp
The field \fIkey\fP points to the null-terminated string which is the

View File

@ -137,7 +137,7 @@ is defined in
.I <netinet/in.h>
as:
.sp
.RS 4
.in +4n
.nf
typedef uint32_t in_addr_t;
@ -145,7 +145,7 @@ struct in_addr {
in_addr_t s_addr;
};
.fi
.RE
.in
.PP
Note that on the i80x86 the host byte order is Least Significant Byte
first (little endian), whereas the network byte order, as used on the

View File

@ -72,7 +72,7 @@ Traditionally (e.g., SunOS, Linux libc 4,5) the parameters of these
functions were of type \fIstruct qelem *\fP, where the struct
is defined as
.RS 4
.in +4n
.nf
struct qelem {
struct qelem *q_forw;
@ -80,7 +80,7 @@ struct qelem {
char q_data[1];
};
.fi
.RE
.in
This is still what you will get if
.B _GNU_SOURCE

View File

@ -83,7 +83,7 @@ This ceiling is an absolute timeout in seconds and nanoseconds
since the Epoch (midnight on the morning of 1 January 1970),
specified in the following structure:
.sp
.RS 4
.in +4n
.nf
struct timespec {
time_t tv_sec; /* seconds */
@ -91,7 +91,7 @@ struct timespec {
};
.fi
.RE
.in
If no message is available,
and the timeout has already expired by the time of the call,
.BR mq_timedreceive ()

View File

@ -89,7 +89,7 @@ This ceiling is an absolute timeout in seconds and nanoseconds
since the Epoch (midnight on the morning of 1 January 1970),
specified in the following structure:
.sp
.RS 4
.in +4n
.nf
struct timespec {
time_t tv_sec; /* seconds */
@ -97,7 +97,7 @@ struct timespec {
};
.fi
.RE
.in
If the message queue is full,
and the timeout has already expired by the time of the call,
.BR mq_timedsend ()

View File

@ -187,21 +187,21 @@ of `%' and `*m$' instead of `*', where the decimal integer m denotes
the position in the argument list of the desired argument, indexed starting
from 1.
Thus,
.RS
.in +4n
.nf
printf("%*d", width, num);
printf("%*d", width, num);
.fi
.RE
.in
and
.RS
.in +4n
.nf
printf("%2$*1$d", width, num);
printf("%2$*1$d", width, num);
.fi
.RE
.in
are equivalent.
The second style allows repeated references to the
same argument.
@ -927,14 +927,14 @@ call to write to memory and creating a security hole.
.br
.if \w'\*(Pi'=0 .ds Pi pi
To print \*(Pi to five decimal places:
.RS
.in +4n
.nf
#include <math.h>
#include <stdio.h>
fprintf(stdout, "pi = %.5f\en", 4 * atan(1.0));
.fi
.RE
.in
.PP
To print a date and time in the form `Sunday, July 3, 10:02',
where
@ -942,19 +942,19 @@ where
and
.I month
are pointers to strings:
.RS
.in +4n
.nf
#include <stdio.h>
fprintf(stdout, "%s, %s %d, %.2d:%.2d\en",
weekday, month, day, hour, min);
.fi
.RE
.in
.PP
Many countries use the day-month-year order.
Hence, an internationalized version must be able to print
the arguments in an order specified by the format:
.RS
.in +4n
.nf
#include <stdio.h>
@ -962,21 +962,20 @@ fprintf(stdout, format,
weekday, month, day, hour, min);
.fi
.RE
.in
where
.I format
depends on locale, and may permute the arguments.
With the value
.RS
.in +4n
.nf
"%1$s, %3$d. %2$s, %4$d:%5$.2d\en"
.fi
.RE
.in
one might obtain `Sonntag, 3. Juli, 10:02'.
.PP
To allocate a sufficiently large string and print into it
(code correct for both glibc 2.0 and glibc 2.1):
.RS 4
.nf
#include <stdio.h>
@ -1016,7 +1015,6 @@ make_message(const char *fmt, ...)
}
}
.fi
.RE
.SH "SEE ALSO"
.BR printf (1),
.BR asprintf (3),

View File

@ -54,7 +54,7 @@ On Linux, the
.I dirent
structure is defined as follows:
.PP
.RS 4
.in +4n
.nf
struct dirent {
ino_t d_ino; /* inode number */
@ -64,7 +64,7 @@ struct dirent {
char d_name[256]; /* filename */
};
.fi
.RE
.in
.PP
According to POSIX, the
.I dirent

View File

@ -182,14 +182,14 @@ structure which is the type of
is defined in
.IR <regex.h> .
.RS 4
.in +4n
.nf
typedef struct {
regoff_t rm_so;
regoff_t rm_eo;
} regmatch_t;
.fi
.RE
.in
Each
.I rm_so

View File

@ -74,7 +74,7 @@ are provided:
.B HDIO_GETGEO
.RS
Returns the BIOS disk parameters in the following structure:
.RS 4
.in +4n
.nf
struct hd_geometry {
@ -84,7 +84,7 @@ struct hd_geometry {
unsigned long start;
};
.fi
.RE
.in
A pointer to this structure is passed as the
.BR ioctl (2)

View File

@ -74,7 +74,7 @@ They take a pointer to a
.I struct arpreq
as their parameter.
.RS 4
.in +4n
.nf
struct arpreq {
struct sockaddr arp_pa; /* protocol address */
@ -84,7 +84,7 @@ struct arpreq {
char arp_dev[16];
};
.fi
.RE
.in
.BR SIOCSARP ", " SIOCDARP " and " SIOCGARP
respectively set, delete and get an ARP mapping.

View File

@ -61,7 +61,7 @@ capability.
An Appletalk socket address is defined as a combination of a network number,
a node number, and a port number.
.PP
.RS 4
.in +4n
.nf
struct at_addr {
u_short s_net;
@ -75,7 +75,7 @@ struct sockaddr_atalk {
};
.ta
.fi
.RE
.in
.PP
.I sat_family
is always set to

View File

@ -62,7 +62,7 @@ or packet to a IPv6 socket its source address will be mapped
to v6 and it will be mapped to v6.
.SS "Address Format"
.sp
.RS 4
.in +4n
.nf
struct sockaddr_in6 {
u_int16_t sin6_family; /* AF_INET6 */
@ -76,7 +76,7 @@ struct in6_addr {
unsigned char s6_addr[16]; /* IPv6 address */
};
.fi
.RE
.in
.sp
.I sin6_family
is always set to

View File

@ -27,7 +27,7 @@ They pass an
.I ifreq
structure:
.RS 4
.in +4n
.nf
struct ifreq {
char ifr_name[IFNAMSIZ]; /* Interface name */
@ -56,7 +56,7 @@ struct ifconf {
};
};
.fi
.RE
.in
Normally, the user specifies which device to affect by setting
.I ifr_name

View File

@ -47,14 +47,14 @@ socket address family uses the
for representing network addresses as defined in ITU-T
recommendation X.121.
.PP
.RS 4
.in +4n
.nf
struct sockaddr_x25 {
sa_family_t sx25_family; /* must be AF_X25 */
x25_address sx25_addr; /* X.121 Address */
};
.fi
.RE
.in
.PP
.I sx25_addr
contains a char array