This commit is contained in:
Michael Kerrisk 2007-04-05 12:36:57 +00:00
parent b9208776db
commit cf0a9ace57
175 changed files with 637 additions and 1238 deletions

21
Changes
View File

@ -12,16 +12,27 @@ been incorporated in changes in this release:
Apologies if I missed anyone!
New pages
---------
Global changes
--------------
This release consists mainly of formatting fixes (to a large
number of pages) to achieve greater consistency across pages.
In addition, a number of example programs were reformatted
to more closely match K&R style.
With the exception of the few individual changes noted below,
no changes were made to content.
Typographical or grammatical errors have been corrected in several
places. (Special thanks to Nicolas François!)
places.
Changes to individual pages
---------------------------
bdflush.2
mtk
Add <sys/kdaemon.h> header file to SYNOPSIS.
select_tut.2
mtk
Make SYNOPSIS match select.2.

View File

@ -45,7 +45,6 @@ accept \- accept a connection on a socket
.sp
.BI "int accept(int " sockfd ", struct sockaddr *" addr ", socklen_t *" addrlen );
.SH DESCRIPTION
The
.BR accept ()
system call is used with connection-based socket types
@ -294,7 +293,6 @@ They shouldn't have touched it in the first place, but once they did
they felt it had to have a named type for some unfathomable reason
(probably somebody didn't like losing face over having done the original
stupid thing, so they silently just renamed their blunder)."
.SH "SEE ALSO"
.BR bind (2),
.BR connect (2),

View File

@ -50,7 +50,6 @@ Modes are specified by
.IR or'ing
the following:
.RS
.sp
.TP 1.0i
S_ISUID
04000 set user ID on execution
@ -87,9 +86,8 @@ S_IWOTH
.TP
S_IXOTH
00001 execute/search by others
.sp
.RE
.PP
The effective UID of the calling process must match the owner of the file,
or the process must be privileged (Linux: it must have the
.B CAP_FOWNER
@ -127,7 +125,6 @@ Depending on the file system, other errors can be returned. The more
general errors for
.BR chmod ()
are listed below:
.TP
.B EACCES
Search permission is denied on a component of the path prefix.

View File

@ -515,7 +515,6 @@ at that address.
The address involved may be changed by the
.BR set_tid_address (2)
system call. This is used by threading libraries.
.SS "sys_clone"
The
.B sys_clone

View File

@ -59,7 +59,6 @@ is set appropriately.
.I size
is not positive.
.TP
.TP
.B ENFILE
The system limit on the total number of open files has been reached.
.TP

View File

@ -42,19 +42,21 @@ The
.I struct epoll_event
is defined as :
.sp
.in +0.5i
.nf
typedef union epoll_data {
void *ptr;
int fd;
__uint32_t u32;
__uint64_t u64;
} epoll_data_t;
typedef union epoll_data {
void *ptr;
int fd;
__uint32_t u32;
__uint64_t u64;
} epoll_data_t;
struct epoll_event {
__uint32_t events; /* Epoll events */
epoll_data_t data; /* User data variable */
};
struct epoll_event {
__uint32_t events; /* Epoll events */
epoll_data_t data; /* User data variable */
};
.fi
.in -0.5i
The
.I events

View File

@ -62,19 +62,21 @@ The
.I struct epoll_event
is defined as :
.sp
.in +0.5i
.nf
typedef union epoll_data {
void *ptr;
int fd;
__uint32_t u32;
__uint64_t u64;
} epoll_data_t;
typedef union epoll_data {
void *ptr;
int fd;
__uint32_t u32;
__uint64_t u64;
} epoll_data_t;
struct epoll_event {
__uint32_t events; /* Epoll events */
epoll_data_t data; /* User data variable */
};
struct epoll_event {
__uint32_t events; /* Epoll events */
epoll_data_t data; /* User data variable */
};
.fi
.in -0.5i
The
.I data

View File

@ -318,7 +318,6 @@ a #! executable shell script.
.\" Linux versions have also had other security holes in \fBexecve\fP(),
.\" that could be exploited for denial of service by a suitably crafted
.\" ELF binary. There are no known problems with 2.0.34 or 2.2.15.
.SH HISTORICAL
With Unix V6 the argument list of an
.BR exec ()
@ -330,7 +329,6 @@ argument list was not directly usable in a further
.BR exec ()
call.
Since Unix V7 both are NULL.
.SH "SEE ALSO"
.BR chmod (2),
.BR fork (2),

View File

@ -71,7 +71,6 @@ performs one of the operations described below on the open file descriptor
.IR fd .
The operation is determined by
.IR cmd .
.P
.SS "Duplicating a file descriptor"
.TP
.B F_DUPFD
@ -89,7 +88,6 @@ On success, the new descriptor is returned.
See
.BR dup (2)
for further details.
.P
.SS "File descriptor flags"
The following commands manipulate the flags associated with
a file descriptor.
@ -108,7 +106,6 @@ Read the file descriptor flags.
.B F_SETFD
Set the file descriptor flags to the value specified by
.IR arg .
.P
.SS "File status flags"
Each open file description has certain associated status flags,
initialized by
@ -153,7 +150,6 @@ flags.
.\" FIXME According to POSIX.1-2001, O_SYNC should also be modifiable
.\" via fcntl(2), but currently Linux does not permit this
.\" See http://bugzilla.kernel.org/show_bug.cgi?id=5994
.P
.SS "Advisory locking"
.BR F_GETLK ", " F_SETLK " and " F_SETLKW
are used to acquire, release, and test for the existence of record
@ -329,7 +325,6 @@ should be avoided; use
and
.BR write (2)
instead.
.P
.SS "Mandatory locking"
(Non-POSIX.)
The above record locks may be either advisory or mandatory,
@ -375,7 +370,6 @@ permission bit (see
.BR chmod (1)
and
.BR chmod (2)).
.P
.SS "Managing signals"
.BR F_GETOWN ", " F_SETOWN ", " F_GETSIG " and " F_SETSIG
are used to manage I/O availability signals:
@ -561,7 +555,6 @@ are Linux specific. POSIX has asynchronous I/O and the
.I aio_sigevent
structure to achieve similar things; these are also available
in Linux as part of the GNU C Library (Glibc).
.P
.SS Leases
.B F_SETLEASE
and
@ -584,7 +577,6 @@ values is specified in the integer
.IR arg :
.RS
.TP
.B F_RDLCK
Take out a read lease.
This will cause the calling process to be notified when
@ -701,7 +693,6 @@ structure as its second argument, and the
field of this argument will hold the descriptor of the leased file
that has been accessed by another process.
(This is useful if the caller holds leases against multiple files).
.P
.SS "File and directory change notification (dnotify)"
.TP
.B F_NOTIFY
@ -713,7 +704,6 @@ The events to be notified are specified in
.IR arg ,
which is a bit mask specified by ORing together zero or more of
the following bits:
.TS
l l
----

View File

@ -107,7 +107,6 @@ If the timer expires while the process is active (always true for
.BR ITIMER_VIRTUAL )
the signal will be delivered immediately when generated. Otherwise the
delivery will be offset by a small time dependent on the system loading.
.LP
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno

View File

@ -41,7 +41,6 @@ and
(both introduced in Linux 2.1.44)
get the real UID, effective UID, and saved set-user-ID (resp. group ID's)
of the current process.
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno

View File

@ -120,12 +120,10 @@ For
.BR setsockopt (),
the parameter should be non-zero to enable a boolean option, or zero if the
option is to be disabled.
.PP
For a description of the available socket options see
.BR socket (7)
and the appropriate protocol man pages.
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno

View File

@ -55,7 +55,6 @@ on when to use one or other mechanism.
A _syscall macro
desired system call
.SS Setup
The important thing to know about a system call is its prototype. You
need to know how many arguments, their types, and the function return type.
@ -83,8 +82,8 @@ These macros create a function called \fIname\fP with the arguments you
specify. Once you include the _syscall() in your source file,
you call the system call by \fIname\fP.
.SH EXAMPLE
.nf
.sp
.nf
#include <stdio.h>
#include <errno.h>
#include <linux/unistd.h> /* for _syscallX macros/related stuff */
@ -95,24 +94,25 @@ _syscall1(int, sysinfo, struct sysinfo *, info);
/* Note: if you copy directly from the nroff source, remember to
REMOVE the extra backslashes in the printf statement. */
int main(void)
int
main(void)
{
struct sysinfo s_info;
int error;
struct sysinfo s_info;
int error;
error = sysinfo(&s_info);
printf("code error = %d\\n", error);
printf("Uptime = %lds\\nLoad: 1 min %lu / 5 min %lu / 15 min %lu\\n"
"RAM: total %lu / free %lu / shared %lu\\n"
"Memory in buffers = %lu\\nSwap: total %lu / free %lu\\n"
"Number of processes = %d\\n",
s_info.uptime, s_info.loads[0],
s_info.loads[1], s_info.loads[2],
s_info.totalram, s_info.freeram,
s_info.sharedram, s_info.bufferram,
s_info.totalswap, s_info.freeswap,
s_info.procs);
return(0);
error = sysinfo(&s_info);
printf("code error = %d\\n", error);
printf("Uptime = %lds\\nLoad: 1 min %lu / 5 min %lu / 15 min %lu\\n"
"RAM: total %lu / free %lu / shared %lu\\n"
"Memory in buffers = %lu\\nSwap: total %lu / free %lu\\n"
"Number of processes = %d\\n",
s_info.uptime, s_info.loads[0],
s_info.loads[1], s_info.loads[2],
s_info.totalram, s_info.freeram,
s_info.sharedram, s_info.bufferram,
s_info.totalswap, s_info.freeswap,
s_info.procs);
return(0);
}
.fi
.SS "Sample Output"

View File

@ -24,9 +24,7 @@
.TH IOCTL_LIST 2 2003-03-30 "Linux 1.3" "Linux Programmer's Manual"
.SH NAME
ioctl_list \- list of ioctl calls in Linux/i386 kernel
.SH DESCRIPTION
This is Ioctl List 1.3.27, a list of ioctl calls in Linux/i386 kernel
1.3.27. It contains 421 ioctls from /usr/include/{asm,linux}/*.h.
For each ioctl, its numerical value, its name, and its argument
@ -43,7 +41,6 @@ separate section.
.PP
This list is very incomplete.
Please e-mail changes and comments to <mec@duracef.shout.net>.
.SH "IOCTL STRUCTURE"
.\" added two sections - aeb
Ioctl command values are 32-bit constants.
@ -79,15 +76,14 @@ sizeof(sizeof(struct)), or because of legacy values.
Thus, it seems that the new structure only gave disadvantages:
it does not help in checking, but it causes varying values
for the various architectures.
.SH "RETURN VALUE"
Decent ioctls return 0 on success and \-1 on error, while
any output value is stored via the argument. However,
quite a few ioctls in fact return an output value.
This is not yet indicated below.
.nf
// Main table.
// <include/asm-i386/socket.h>
@ -568,7 +564,6 @@ This is not yet indicated below.
0x0000560A VT_RESIZEX const struct vt_consize *
// More arguments.
Some ioctl's take a pointer to a structure which contains additional
@ -656,9 +651,6 @@ in 'drivers/char/selection.c'
TIOCLINUX-10 1 + const char *
// Duplicate ioctls
This list does not include ioctls in the range SIOCDEVPRIVATE and

View File

@ -141,7 +141,6 @@ I/O priorities are supported for reads and for synchronous (O_DIRECT,
O_SYNC) writes. I/O priorities are not supported for asynchronous
writes because they are issued outside the context of the program
dirtying the memory, and thus program-specific priorities do not apply.
.SH "RETURN VALUE"
On success,
.BR ioprio_get ()

View File

@ -85,7 +85,6 @@ length and this sysctl setting is ignored.
See
.BR tcp (7)
for more information.
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno

View File

@ -60,7 +60,6 @@ or
respectively.
It returns the resulting file position in the argument
.IR result .
.SH "RETURN VALUE"
Upon successful completion,
.BR _llseek ()

View File

@ -42,7 +42,6 @@ For
.BR lookup_dcookie ()
to return successfully,
the kernel must still hold a cookie reference to the directory entry.
.SH "NOTES"
.BR lookup_dcookie ()
is a special-purpose system call, currently used only by the oprofile profiler.
@ -50,7 +49,6 @@ It relies on a kernel driver to register cookies for directory entries.
The path returned may be suffixed by the string " (deleted)" if the directory
entry has been removed.
.SH "RETURN VALUE"
On success,
.BR lookup_dcookie ()

View File

@ -131,7 +131,6 @@ is incorrect English, but maintained for historical reasons.
When converting old code, substitute values for \fIwhence\fP with the
following macros:
.PP
.TS
c c
l l.

View File

@ -39,7 +39,6 @@ otherwise it will be owned by the effective group ID of the process.
If the parent directory has the set-group-ID bit set then so will the
newly created directory.
.SH "RETURN VALUE"
.BR mkdir ()
returns zero on success, or \-1 if an error occurred (in which case,

View File

@ -64,7 +64,7 @@ and
is set appropriately.
.SH ERRORS
.TP
.SH EFAULT
EFAULT
Problem with getting the
data from userspace.
.SH NOTES

View File

@ -275,7 +275,6 @@ is set appropriately.
The error values given below result from filesystem type independent
errors. Each filesystem type may have its own special errors and its
own special behavior. See the kernel source code for details.
.TP
.B EACCES
A component of a path was not searchable. (See also

View File

@ -260,7 +260,6 @@ For a discussion of the effect of
.BR O_NONBLOCK
in conjunction with mandatory file locks and with file leases, see
.BR fcntl (2).
.TP
.B O_SYNC
The file is opened for synchronous I/O. Any

View File

@ -26,7 +26,6 @@ Unix/Linux path resolution \- find the file referred to by a filename
.SH DESCRIPTION
Some Unix/Linux system calls have as parameter one or more filenames.
A filename (or pathname) is resolved as follows.
.SS "Step 1: Start of the resolution process"
If the pathname starts with the '/' character, the starting lookup directory
is the root directory of the current process. (A process inherits its
@ -49,7 +48,6 @@ system call.)
Pathnames starting with a '/' character are called absolute pathnames.
Pathnames not starting with a '/' are called relative pathnames.
.SS "Step 2: Walk along the path"
Set the current lookup directory to the starting lookup directory.
Now, for each non-final component of the pathname, where a component
@ -86,7 +84,6 @@ exceeded ("Too many levels of symbolic links").
.\" presently: max recursion depth during symlink resolution: 5
.\" max total number of symlinks followed: 40
.\" _POSIX_SYMLOOP_MAX is 8
.SS "Step 3: Find the final entry"
The lookup of the final component of the pathname goes just like
that of all other components, as described in the previous step,
@ -98,7 +95,6 @@ is not necessarily an error if the component is not found \(em
maybe we are just creating it. The details on the treatment
of the final entry are described in the manual pages of the specific
system calls.
.SS ". and .."
By convention, every directory has the entries "." and "..",
which refer to the directory itself and to its parent directory,
@ -109,7 +105,6 @@ their conventional meanings, regardless of whether they are
actually present in the physical filesystem.
One cannot walk down past the root: "/.." is the same as "/".
.SS "Mount points"
After a "mount dev path" command, the pathname "path" refers to
the root of the filesystem hierarchy on the device "dev", and no
@ -118,14 +113,12 @@ longer to whatever it referred to earlier.
One can walk out of a mounted filesystem: "path/.." refers to
the parent directory of "path",
outside of the filesystem hierarchy on "dev".
.SS "Trailing slashes"
If a pathname ends in a '/', that forces resolution of the preceding
component as in Step 2: it has to exist and resolve to a directory.
Otherwise a trailing '/' is ignored.
(Or, equivalently, a pathname with a trailing '/' is equivalent to
the pathname obtained by appending '.' to it.)
.SS "Final symlink"
If the last component of a pathname is a symbolic link, then it
depends on the system call whether the file referred to will be
@ -135,17 +128,14 @@ For example, the system call
will operate on the symlink, while
.BR stat (2)
operates on the file pointed to by the symlink.
.SS "Length limit"
There is a maximum length for pathnames. If the pathname (or some
intermediate pathname obtained while resolving symbolic links)
is too long, an ENAMETOOLONG error is returned ("File name too long").
.SS "Empty pathname"
In the original Unix, the empty pathname referred to the current directory.
Nowadays POSIX decrees that an empty pathname must not be resolved
successfully. Linux returns ENOENT in this case.
.SS "Permissions"
The permission bits of a file consist of three groups of three bits, cf.\&
.BR chmod (1)
@ -178,7 +168,6 @@ Similarly, Linux uses the fsgid ("file system group ID")
instead of the effective group ID. See
.BR setfsgid (2).
.\" FIXME say something about filesystem mounted read-only ?
.SS "Bypassing permission checks: superuser and capabilities"
On a traditional Unix system, the superuser
.RI ( root ,
@ -205,6 +194,5 @@ The CAP_DAC_READ_SEARCH capability grants read and search permission
on directories, and read permission on ordinary files.
.\" FIXME say something about immutable files
.\" FIXME say something about ACLs
.SH "SEE ALSO"
.BR capabilities (7)

View File

@ -115,7 +115,6 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
}
.fi
.SH "SEE ALSO"
.BR fork (2),

View File

@ -80,7 +80,6 @@ On success, zero is returned. On error, \-1 is returned, and
.SH ERRORS
\fBpivot_root\fP() may return (in \fIerrno\fP) any of the errors returned by
\fBstat(2)\fP. Additionally, it may return:
.TP
.B EBUSY
\fInew_root\fP or \fIput_old\fP are on the current root file system,

View File

@ -170,7 +170,6 @@ Priority data may be written.
.PP
Linux also knows about, but does not use
.BR POLLMSG .
.PP
.SS ppoll()
The relationship between
.BR poll ()

View File

@ -167,7 +167,6 @@ Sync disk copy of a filesystem's quota.
.TP
.B Q_GETSTATS
Get collected stats.
.SH "RETURN VALUE"
On success,
.BR quotactl ()

View File

@ -56,7 +56,6 @@ is zero, \fBread\fP() returns zero and has no other results.
If
.I count
is greater than SSIZE_MAX, the result is unspecified.
.PP
.SH "RETURN VALUE"
On success, the number of bytes read is returned (zero indicates end of
file), and the file position is advanced by this number.

View File

@ -90,7 +90,6 @@ is the size of
not counting the null terminator.
.I d_name
is a null-terminated filename.
.PP
.SH "RETURN VALUE"
On success, 1 is returned.
On end of directory, 0 is returned.

View File

@ -84,7 +84,6 @@ The
function works just like
.BR write (2)
except that multiple buffers are written out.
.PP
.SH "RETURN VALUE"
On success, the
.BR readv ()

View File

@ -189,26 +189,29 @@ program would look like:
.nf
int child_events = 0;
void child_sig_handler (int x) {
void
child_sig_handler(int x)
{
child_events++;
signal (SIGCHLD, child_sig_handler);
signal(SIGCHLD, child_sig_handler);
}
int main (int argc, char **argv) {
int
main(int argc, char **argv)
{
sigset_t sigmask, orig_sigmask;
sigemptyset (&sigmask);
sigaddset (&sigmask, SIGCHLD);
sigprocmask (SIG_BLOCK, &sigmask,
&orig_sigmask);
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGCHLD);
sigprocmask(SIG_BLOCK, &sigmask, &orig_sigmask);
signal (SIGCHLD, child_sig_handler);
signal(SIGCHLD, child_sig_handler);
for (;;) { /* main loop */
for (; child_events > 0; child_events\-\-) {
/* do event work here */
}
r = pselect (nfds, &rd, &wr, &er, 0, &orig_sigmask);
r = pselect(nfds, &rd, &wr, &er, 0, &orig_sigmask);
/* main body of program */
}
@ -257,65 +260,61 @@ static int forward_port;
#undef max
#define max(x,y) ((x) > (y) ? (x) : (y))
static int listen_socket (int listen_port) {
static int
listen_socket(int listen_port)
{
struct sockaddr_in a;
int s;
int yes;
if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
perror ("socket");
if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
perror("socket");
return \-1;
}
yes = 1;
if (setsockopt
(s, SOL_SOCKET, SO_REUSEADDR,
(char *) &yes, sizeof (yes)) < 0) {
perror ("setsockopt");
close (s);
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
(char *) &yes, sizeof(yes)) < 0) {
perror("setsockopt");
close(s);
return \-1;
}
memset (&a, 0, sizeof (a));
a.sin_port = htons (listen_port);
memset(&a, 0, sizeof(a));
a.sin_port = htons(listen_port);
a.sin_family = AF_INET;
if (bind
(s, (struct sockaddr *) &a, sizeof (a)) < 0) {
perror ("bind");
close (s);
if (bind(s, (struct sockaddr *) &a, sizeof(a)) < 0) {
perror("bind");
close(s);
return \-1;
}
printf ("accepting connections on port %d\\n",
(int) listen_port);
listen (s, 10);
printf("accepting connections on port %d\\n", listen_port);
listen(s, 10);
return s;
}
static int connect_socket (int connect_port,
char *address) {
static int
connect_socket(int connect_port, char *address)
{
struct sockaddr_in a;
int s;
if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
perror ("socket");
close (s);
if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
perror("socket");
close(s);
return \-1;
}
memset (&a, 0, sizeof (a));
a.sin_port = htons (connect_port);
memset(&a, 0, sizeof(a));
a.sin_port = htons(connect_port);
a.sin_family = AF_INET;
if (!inet_aton
(address,
(struct in_addr *) &a.sin_addr.s_addr)) {
perror ("bad IP address format");
close (s);
if (!inet_aton(address, (struct in_addr *) &a.sin_addr.s_addr)) {
perror("bad IP address format");
close(s);
return \-1;
}
if (connect
(s, (struct sockaddr *) &a,
sizeof (a)) < 0) {
perror ("connect()");
shutdown (s, SHUT_RDWR);
close (s);
if (connect(s, (struct sockaddr *) &a, sizeof(a)) < 0) {
perror("connect()");
shutdown(s, SHUT_RDWR);
close(s);
return \-1;
}
return s;
@ -323,23 +322,25 @@ static int connect_socket (int connect_port,
#define SHUT_FD1 { \\
if (fd1 >= 0) { \\
shutdown (fd1, SHUT_RDWR); \\
close (fd1); \\
shutdown(fd1, SHUT_RDWR); \\
close(fd1); \\
fd1 = \-1; \\
} \\
}
#define SHUT_FD2 { \\
if (fd2 >= 0) { \\
shutdown (fd2, SHUT_RDWR); \\
close (fd2); \\
shutdown(fd2, SHUT_RDWR); \\
close(fd2); \\
fd2 = \-1; \\
} \\
}
#define BUF_SIZE 1024
int main (int argc, char **argv) {
int
main(int argc, char **argv)
{
int h;
int fd1 = \-1, fd2 = \-1;
char buf1[BUF_SIZE], buf2[BUF_SIZE];
@ -347,72 +348,70 @@ int main (int argc, char **argv) {
int buf2_avail, buf2_written;
if (argc != 4) {
fprintf (stderr,
"Usage\\n\\tfwd <listen-port> \\
<forward-to-port> <forward-to-ip-address>\\n");
exit (1);
fprintf(stderr,
"Usage\\n\\tfwd <listen-port> "
"<forward-to-port> <forward-to-ip-address>\\n");
exit(1);
}
signal (SIGPIPE, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
forward_port = atoi (argv[2]);
forward_port = atoi(argv[2]);
h = listen_socket (atoi (argv[1]));
h = listen_socket(atoi(argv[1]));
if (h < 0)
exit (1);
exit(1);
for (;;) {
int r, nfds = 0;
fd_set rd, wr, er;
FD_ZERO (&rd);
FD_ZERO (&wr);
FD_ZERO (&er);
FD_SET (h, &rd);
nfds = max (nfds, h);
FD_ZERO(&rd);
FD_ZERO(&wr);
FD_ZERO(&er);
FD_SET(h, &rd);
nfds = max(nfds, h);
if (fd1 > 0 && buf1_avail < BUF_SIZE) {
FD_SET (fd1, &rd);
nfds = max (nfds, fd1);
FD_SET(fd1, &rd);
nfds = max(nfds, fd1);
}
if (fd2 > 0 && buf2_avail < BUF_SIZE) {
FD_SET (fd2, &rd);
nfds = max (nfds, fd2);
FD_SET(fd2, &rd);
nfds = max(nfds, fd2);
}
if (fd1 > 0
&& buf2_avail \- buf2_written > 0) {
FD_SET (fd1, &wr);
nfds = max (nfds, fd1);
FD_SET(fd1, &wr);
nfds = max(nfds, fd1);
}
if (fd2 > 0
&& buf1_avail \- buf1_written > 0) {
FD_SET (fd2, &wr);
nfds = max (nfds, fd2);
FD_SET(fd2, &wr);
nfds = max(nfds, fd2);
}
if (fd1 > 0) {
FD_SET (fd1, &er);
nfds = max (nfds, fd1);
FD_SET(fd1, &er);
nfds = max(nfds, fd1);
}
if (fd2 > 0) {
FD_SET (fd2, &er);
nfds = max (nfds, fd2);
FD_SET(fd2, &er);
nfds = max(nfds, fd2);
}
r = select (nfds + 1, &rd, &wr, &er, NULL);
r = select(nfds + 1, &rd, &wr, &er, NULL);
if (r == \-1 && errno == EINTR)
continue;
if (r < 0) {
perror ("select()");
exit (1);
perror("select()");
exit(1);
}
if (FD_ISSET (h, &rd)) {
if (FD_ISSET(h, &rd)) {
unsigned int l;
struct sockaddr_in client_address;
memset (&client_address, 0, l =
sizeof (client_address));
r = accept (h, (struct sockaddr *)
&client_address, &l);
memset(&client_address, 0, l = sizeof(client_address));
r = accept(h, (struct sockaddr *) &client_address, &l);
if (r < 0) {
perror ("accept()");
perror("accept()");
} else {
SHUT_FD1;
SHUT_FD2;
@ -420,41 +419,39 @@ int main (int argc, char **argv) {
buf2_avail = buf2_written = 0;
fd1 = r;
fd2 =
connect_socket (forward_port,
argv[3]);
connect_socket(forward_port, argv[3]);
if (fd2 < 0) {
SHUT_FD1;
} else
printf ("connect from %s\\n",
inet_ntoa
(client_address.sin_addr));
printf("connect from %s\\n",
inet_ntoa(client_address.sin_addr));
}
}
/* NB: read oob data before normal reads */
if (fd1 > 0)
if (FD_ISSET (fd1, &er)) {
if (FD_ISSET(fd1, &er)) {
char c;
errno = 0;
r = recv (fd1, &c, 1, MSG_OOB);
r = recv(fd1, &c, 1, MSG_OOB);
if (r < 1) {
SHUT_FD1;
} else
send (fd2, &c, 1, MSG_OOB);
send(fd2, &c, 1, MSG_OOB);
}
if (fd2 > 0)
if (FD_ISSET (fd2, &er)) {
if (FD_ISSET(fd2, &er)) {
char c;
errno = 0;
r = recv (fd2, &c, 1, MSG_OOB);
r = recv(fd2, &c, 1, MSG_OOB);
if (r < 1) {
SHUT_FD1;
} else
send (fd1, &c, 1, MSG_OOB);
send(fd1, &c, 1, MSG_OOB);
}
if (fd1 > 0)
if (FD_ISSET (fd1, &rd)) {
if (FD_ISSET(fd1, &rd)) {
r =
read (fd1, buf1 + buf1_avail,
read(fd1, buf1 + buf1_avail,
BUF_SIZE \- buf1_avail);
if (r < 1) {
SHUT_FD1;
@ -462,9 +459,9 @@ int main (int argc, char **argv) {
buf1_avail += r;
}
if (fd2 > 0)
if (FD_ISSET (fd2, &rd)) {
if (FD_ISSET(fd2, &rd)) {
r =
read (fd2, buf2 + buf2_avail,
read(fd2, buf2 + buf2_avail,
BUF_SIZE \- buf2_avail);
if (r < 1) {
SHUT_FD2;
@ -472,24 +469,20 @@ int main (int argc, char **argv) {
buf2_avail += r;
}
if (fd1 > 0)
if (FD_ISSET (fd1, &wr)) {
if (FD_ISSET(fd1, &wr)) {
r =
write (fd1,
buf2 + buf2_written,
buf2_avail \-
buf2_written);
write(fd1, buf2 + buf2_written,
buf2_avail \- buf2_written);
if (r < 1) {
SHUT_FD1;
} else
buf2_written += r;
}
if (fd2 > 0)
if (FD_ISSET (fd2, &wr)) {
if (FD_ISSET(fd2, &wr)) {
r =
write (fd2,
buf1 + buf1_written,
buf1_avail \-
buf1_written);
write(fd2, buf1 + buf1_written,
buf1_avail \- buf1_written);
if (r < 1) {
SHUT_FD2;
} else
@ -502,12 +495,10 @@ int main (int argc, char **argv) {
buf2_written = buf2_avail = 0;
/* one side has closed the connection, keep
writing to the other side until empty */
if (fd1 < 0
&& buf1_avail \- buf1_written == 0) {
if (fd1 < 0 && buf1_avail \- buf1_written == 0) {
SHUT_FD2;
}
if (fd2 < 0
&& buf2_avail \- buf2_written == 0) {
if (fd2 < 0 && buf2_avail \- buf2_written == 0) {
SHUT_FD1;
}
}
@ -625,7 +616,7 @@ follows:
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 200000; /* 0.2 seconds */
select (0, NULL, NULL, NULL, &tv);
select(0, NULL, NULL, NULL, &tv);
.fi
.PP
This is only guaranteed to work on Unix systems, however.

View File

@ -34,7 +34,6 @@ The kernel keeps for each process two values called
and
.I clear_child_tid
that are NULL by default.
.SS set_child_tid
If a process is started using
.BR clone (2)
@ -50,7 +49,6 @@ When
.I set_child_tid
is set, the very first thing the new process does
is writing its PID at this address.
.SS clear_child_tid
If a process is started using
.BR clone (2)

View File

@ -44,7 +44,6 @@ real user ID, the effective user ID or the saved set-user-ID.
Precisely the same holds for
.BR setegid ()
with "group" instead of "user".
.\" When
.\" .I euid
.\" equals \-1, nothing is changed.

View File

@ -113,7 +113,6 @@ If the exit of the process causes a process group to become orphaned,
and if any member of the newly-orphaned process group is stopped, then a
SIGHUP signal followed by a SIGCONT signal will be sent to each process
in the newly-orphaned process group.
.SH "RETURN VALUE"
On success,
.BR setpgid ()

View File

@ -61,7 +61,6 @@ sets the real GID, effective GID, and saved set-group-ID
of the current process (and always modifies the file system GID
to be the same as the effective GID),
with the same restrictions for non-privileged processes.
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno

View File

@ -76,7 +76,6 @@ Completely analogously,
.BR setregid ()
sets real and effective group ID's of the current process,
and all of the above holds with "group" instead of "user".
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno

View File

@ -210,7 +210,6 @@ struct shm_info {
unsigned long swap_attempts; /* Unused since Linux 2.4 */
unsigned long swap_successes; /* Unused since Linux 2.4 */
};
.in -2n
.fi
.TP

View File

@ -361,7 +361,6 @@ POLL_ERR:i/o error
POLL_PRI:high priority input available
POLL_HUP:device disconnected
.TE
.SH "RETURN VALUE"
.BR sigaction ()
returns 0 on success and \-1 on error.

View File

@ -335,7 +335,6 @@ Unix V7 (and later systems) had S_IREAD, S_IWRITE, S_IEXEC, where POSIX
prescribes the synonyms S_IRUSR, S_IWUSR, S_IXUSR.
.SH "OTHER SYSTEMS"
Values that have been (or are) in use on various systems:
.P
.TS
l l l l l.
hex name ls octal description

View File

@ -174,7 +174,6 @@ is not a directory.
.TP
.B EOVERFLOW
Some values were too large to be represented in the returned struct.
.PP
.SH "CONFORMING TO"
Linux specific.
The Linux

View File

@ -46,7 +46,7 @@ is a pointer to a
structure defined approximately as follows:
.nf
struct statvfs {
struct statvfs {
unsigned long f_bsize; /* file system block size */
unsigned long f_frsize; /* fragment size */
fsblkcnt_t f_blocks; /* size of fs in f_frsize units */
@ -58,7 +58,7 @@ structure defined approximately as follows:
unsigned long f_fsid; /* file system ID */
unsigned long f_flag; /* mount flags */
unsigned long f_namemax; /* maximum filename length */
};
};
.fi
Here the types
@ -83,7 +83,6 @@ Read-only file system.
Set-user-ID/set-group-ID bits are ignored by
.BR exec (2).
.LP
It is unspecified whether all members of the returned struct
have meaningful values on all filesystems.
@ -150,7 +149,6 @@ is not a directory.
.TP
.B EOVERFLOW
Some values were too large to be represented in the returned struct.
.PP
.SH "CONFORMING TO"
POSIX.1-2001
.SH NOTES

View File

@ -51,13 +51,13 @@ or the maximum number of open files. The argument has the form
.PP
.nf
struct __sysctl_args {
int *name; /* integer vector describing variable */
int nlen; /* length of this vector */
void *oldval; /* 0 or address where to store old value */
size_t *oldlenp; /* available room for old value,
overwritten by actual size of old value */
void *newval; /* 0 or address of new value */
size_t newlen; /* size of new value */
int *name; /* integer vector describing variable */
int nlen; /* length of this vector */
void *oldval; /* 0 or address where to store old value */
size_t *oldlenp; /* available room for old value,
overwritten by actual size of old value */
void *newval; /* 0 or address of new value */
size_t newlen; /* size of new value */
};
.fi
.PP
@ -66,7 +66,6 @@ a directory tree under
.IR /proc/sys ,
and if the requested item is found calls some appropriate routine
to read or modify the value.
.SH EXAMPLE
.nf
#include <linux/unistd.h>
@ -77,8 +76,9 @@ _syscall1(int, _sysctl, struct __sysctl_args *, args);
int sysctl(int *name, int nlen, void *oldval, size_t *oldlenp,
void *newval, size_t newlen)
{
struct __sysctl_args args={name,nlen,oldval,oldlenp,newval,newlen};
return _sysctl(&args);
struct __sysctl_args args = { name, nlen, oldval, oldlenp,
newval, newlen };
return _sysctl(&args);
}
#define SIZE(x) sizeof(x)/sizeof(x[0])
@ -88,16 +88,17 @@ char osname[OSNAMESZ];
int osnamelth;
int name[] = { CTL_KERN, KERN_OSTYPE };
main(){
osnamelth = sizeof(osname);
if (sysctl(name, SIZE(name), osname, &osnamelth, 0, 0))
perror("sysctl");
else
printf("This machine is running %*s\en", osnamelth, osname);
return 0;
int
main(void)
{
osnamelth = sizeof(osname);
if (sysctl(name, SIZE(name), osname, &osnamelth, 0, 0))
perror("sysctl");
else
printf("This machine is running %*s\en", osnamelth, osname);
return 0;
}
.fi
.SH "RETURN VALUE"
Upon successful completion,
.BR _sysctl ()

View File

@ -39,7 +39,6 @@ the kernel. The specific form of the
call and the information returned depends on the
.I option
in effect:
.TP
.B 1
Translate the file-system identifier string
@ -59,7 +58,6 @@ has enough space to accept the string.
.B 3
Return the total number of file system types currently present in the
kernel.
.PP
The numbering of the file-system type indexes begins with zero.
.SH "RETURN VALUE"
@ -87,7 +85,6 @@ is not a valid file-system type identifier;
is out-of-bounds;
.I option
is invalid.
.PP
.SH "CONFORMING TO"
SVr4.
.SH NOTE

View File

@ -154,7 +154,6 @@ as follows:
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */
.fi
.SH "RETURN VALUE"
In case of error, \-1 is returned, and \fIerrno\fP is set. Otherwise,
for \fItype\fP equal to 2, 3 or 4, \fBsyslog\fP() returns the number
@ -182,6 +181,5 @@ In libc4 and libc5 the number of this call was defined by
.BR SYS_klog .
In glibc 2.0 the syscall is baptised
.BR klogctl ().
.SH "SEE ALSO"
.BR syslog (3)

View File

@ -61,6 +61,5 @@ Some system calls, like
and
.BR delete_module (2)
only exist when the Linux kernel was built with support for them.
.SH "SEE ALSO"
.BR obsolete (2)

View File

@ -51,7 +51,6 @@ In addition to all of the error codes returned by
and
.BR mmap (2),
the following may also be returned:
.TP
.B EACCES
The library specified by

View File

@ -44,23 +44,18 @@ returns information about a mounted file system.
is a device number identifying a device containing
a mounted file system.
.I ubuf
is a pointer to a ustat structure that contains the following
is a pointer to a \fIustat\fP structure that contains the following
members:
.sp
.RS
.nf
.ne 7
.ta 8n 16n 32n
daddr_t f_tfree; /* Total free blocks */
ino_t f_tinode; /* Number of free inodes */
char f_fname[6]; /* Filsys name */
char f_fpack[6]; /* Filsys pack name */
.ta
daddr_t f_tfree; /* Total free blocks */
ino_t f_tinode; /* Number of free inodes */
char f_fname[6]; /* Filsys name */
char f_fpack[6]; /* Filsys pack name */
.fi
.RE
.PP
The last two fields, f_fname and f_fpack, are not implemented and will
always be filled with null bytes ('\\0').
.SH "RETURN VALUE"

View File

@ -519,7 +519,6 @@ killed by signal 15
[1]+ Done ./a.out
$
#include <sys/wait.h>
#include <stdlib.h>
#include <unistd.h>

View File

@ -60,7 +60,6 @@ The macros
.BR HUGE_VALL
expand to constants of types double, float and long double, respectively,
that represent a large positive value, possibly plus infinity.
.SH AVAILABILITY
On a glibc system, the macro HUGE_VAL is always available.
Availability of the NAN macro can be tested using
@ -70,7 +69,6 @@ They will be defined by
.I <math.h>
if _ISOC99_SOURCE or _GNU_SOURCE is defined, or __STDC_VERSION__ is defined
and has a value not less than 199901L.
.SH "CONFORMING TO"
C99
.SH "SEE ALSO"

View File

@ -8,7 +8,6 @@ __setfpucw \- set fpu control word on i386 architecture (obsolete)
.B #include <i386/fpu_control.h>
.sp
.BI "void __setfpucw((unsigned short) " control_word );
.br
.SH DESCRIPTION
.BR __setfpucw ()
transfers
@ -17,7 +16,6 @@ to the registers of the fpu (floating point unit) on i386 architecture. This
was used to control floating point precision, rounding and floating point
exceptions.
.SH EXAMPLE
.BR __setfpucw(0x1372)
Set fpu control word on i386 architecture to
@ -27,7 +25,6 @@ Set fpu control word on i386 architecture to
\- rounding to nearest
.br
\- exceptions on overflow, zero divide and NaN
.br
.SH AVAILABILITY
As of glibc 2.1 this function does not exist anymore.
There are new functions from C99, with prototypes in

View File

@ -12,7 +12,6 @@ a64l, l64a \- convert between long and base-64
.BI "long a64l(char *" str64 );
.sp
.BI "char *l64a(long " value );
.sp
.SH DESCRIPTION
These functions provide a conversion between 32-bit long integers
and little-endian base-64 ASCII strings (of length zero to six).
@ -30,14 +29,15 @@ sign-extends its 32-bit result.
The 64 digits in the base 64 system are:
.RS
.nf
\&'.' represents a 0
\&'/' represents a 1
0-9 represent 2-11
A-Z represent 12-37
a-z represent 38-63
.fi
.RE
.br
So 123 = 59*64^0 + 1*64^1 = "v/".
.SH NOTES
The value returned by

View File

@ -102,7 +102,6 @@ The buffer area being read into
.\" or the control block of the operation
must not be accessed during the operation or undefined results may
occur. The memory areas involved must remain valid.
.SH "CONFORMING TO"
POSIX.1-2001
.SH "SEE ALSO"

View File

@ -95,7 +95,6 @@ are invalid.
.TP
.B ENOSYS
This function is not supported.
.SH NOTES
It is a good idea to zero out the control block before use.
This control block must not be changed while the write operation
@ -104,7 +103,6 @@ The buffer area being written out
.\" or the control block of the operation
must not be accessed during the operation or undefined results may
occur. The memory areas involved must remain valid.
.SH "CONFORMING TO"
POSIX.1-2001
.SH "SEE ALSO"

View File

@ -66,23 +66,27 @@ it returns a non-zero value.
#include <stdlib.h>
#include <unistd.h>
void bye(void) {
printf("That was all, folks\en");
void
bye(void)
{
printf("That was all, folks\en");
}
int main(){
long a;
int i;
int
main(void)
{
long a;
int i;
a = sysconf(_SC_ATEXIT_MAX);
printf("ATEXIT_MAX = %ld\en", a);
a = sysconf(_SC_ATEXIT_MAX);
printf("ATEXIT_MAX = %ld\en", a);
i = atexit(bye);
if (i != 0) {
fprintf(stderr, "cannot set exit function\en");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
i = atexit(bye);
if (i != 0) {
fprintf(stderr, "cannot set exit function\en");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
.fi
.SH NOTES

View File

@ -17,7 +17,6 @@ The call
.I canonicalize_file_name(path)
is equivalent to the call
.IR "realpath(path,\ NULL)" .
.SH "CONFORMING TO"
The function is a GNU extension.
.SH "SEE ALSO"

View File

@ -103,7 +103,6 @@ closes the message catalog identified by
It invalidates any subsequent references to the message catalog
defined by
.IR catalog .
.LP
.SH "RETURN VALUE"
The function
.BR catopen ()

View File

@ -56,7 +56,6 @@ The declaration is sometimes in
.I <stdlib.h>
and sometimes in
.IR <malloc.h> .
.LP
.SS "3-arg cfree"
Some SCO and Solaris versions have malloc libraries with a 3-argument
.BR cfree (),

View File

@ -35,16 +35,13 @@ The \fBclearenv\fP() function clears the environment of all name-value
pairs and sets the value of the external variable
.I environ
to NULL.
.SH "RETURN VALUE"
The \fBclearenv\fP() function returns zero on success, and a non-zero
value on failure.
.\" Most versions of Unix return -1 on error, or do not even have errors.
.\" Glibc info and the Watcom C library document "a non-zero value".
.SH AVAILABILITY
Not in libc4, libc5. In glibc since glibc 2.0.
.SH "CONFORMING TO"
Various Unix variants (DG/UX, HP-UX, QNX, ...).
POSIX.9 (bindings for FORTRAN77).
@ -53,7 +50,6 @@ but changed its mind and scheduled these functions for some
later issue of this standard (cf. B.4.6.1).
However, POSIX.1-2001
only adds \fIputenv\fP(), and rejected \fBclearenv\fP().
.SH NOTES
Used in security-conscious applications. If it is unavailable
the assignment

View File

@ -9,8 +9,7 @@
CMSG_ALIGN, CMSG_SPACE, CMSG_NXTHDR, CMSG_FIRSTHDR \- Access ancillary data
.SH SYNOPSIS
.B #include <sys/socket.h>
.br
.sp 2
.sp
.BI "struct cmsghdr *CMSG_FIRSTHDR(struct msghdr *" msgh );
.br
.BI "struct cmsghdr *CMSG_NXTHDR(struct msghdr *" msgh ", struct cmsghdr *" cmsg );
@ -24,14 +23,12 @@ CMSG_ALIGN, CMSG_SPACE, CMSG_NXTHDR, CMSG_FIRSTHDR \- Access ancillary data
.BI "unsigned char *CMSG_DATA(struct cmsghdr *" cmsg );
.sp
.nf
.ta 8n 20n 32n
struct cmsghdr {
socklen_t cmsg_len; /* data byte count, including header */
int cmsg_level; /* originating protocol */
int cmsg_type; /* protocol-specific type */
/* followed by unsigned char cmsg_data[]; */
socklen_t cmsg_len; /* data byte count, including header */
int cmsg_level; /* originating protocol */
int cmsg_type; /* protocol-specific type */
/* followed by unsigned char cmsg_data[]; */
};
.ta
.fi
.SH DESCRIPTION
These macros are used to create and access control messages (also called

View File

@ -95,7 +95,6 @@ the parameter
is the 8-byte initialization
vector for the chaining. It is updated to the next initialization
vector upon return.
.LP
.SH "SEE ALSO"
.BR des (1),
.BR crypt (3)
@ -125,7 +124,6 @@ the macro
.\" .BR ( stat )
.BI DES_FAILED( stat )
is false only for the first two statuses.
.\" So far the Sun page
.\" Some additions - aeb
.SH AVAILABILITY

View File

@ -345,7 +345,6 @@ The function
does the same as
.BR dlsym ()
but takes a version string as an additional argument.
.SH EXAMPLE
Load the math library, and print the cosine of 2.0:
.RS
@ -356,14 +355,16 @@ Load the math library, and print the cosine of 2.0:
#include <stdlib.h>
#include <dlfcn.h>
int main(int argc, char **argv) {
int
main(int argc, char **argv)
{
void *handle;
double (*cosine)(double);
char *error;
handle = dlopen ("libm.so", RTLD_LAZY);
handle = dlopen("libm.so", RTLD_LAZY);
if (!handle) {
fprintf (stderr, "%s\en", dlerror());
fprintf(stderr, "%s\en", dlerror());
exit(1);
}
@ -372,11 +373,11 @@ int main(int argc, char **argv) {
.\" the dlsym() casting problem
*(void **) (&cosine) = dlsym(handle, "cos");
if ((error = dlerror()) != NULL) {
fprintf (stderr, "%s\en", error);
fprintf(stderr, "%s\en", error);
exit(1);
}
printf ("%f\en", (*cosine)(2.0));
printf("%f\en", (*cosine)(2.0));
dlclose(handle);
return 0;
}

View File

@ -31,7 +31,6 @@ dysize \- get number of days for a given year
.BR "#include <time.h>"
.sp
.BI "int dysize(int " year );
.sp
.SH DESCRIPTION
The function returns 365 for a normal year and 366 for a leap year.
The calculation for leap year is based on:

View File

@ -118,12 +118,15 @@ and
.nf
#include <crypt.h>
main() {
char key[64]; /* bit pattern for key */
char txt[64]; /* bit pattern for messages */
setkey(key);
encrypt(txt, 0); /* encode */
encrypt(txt, 1); /* decode */
int
main(void)
{
char key[64]; /* bit pattern for key */
char txt[64]; /* bit pattern for messages */
setkey(key);
encrypt(txt, 0); /* encode */
encrypt(txt, 1); /* decode */
}
.fi
.SH "NOTE"

View File

@ -33,7 +33,6 @@ envz_remove, envz_strip \- environment string support
.sp
.BI "void"
.BI "envz_strip(char **" envz ", size_t *" envz_len );
.sp
.SH DESCRIPTION
These functions are glibc-specific.
.LP
@ -117,19 +116,21 @@ if an allocation error occurs.
.nf
#include <stdio.h>
#include <envz.h>
int
main(int argc, char *argv[], char *envp[]) {
int i, e_len = 0;
char *str;
main(int argc, char *argv[], char *envp[])
{
int i, e_len = 0;
char *str;
for (i=0; envp[i] != NULL; i++)
e_len += strlen(envp[i]) + 1;
for (i=0; envp[i] != NULL; i++)
e_len += strlen(envp[i]) + 1;
str = envz_entry(*envp, e_len, "HOME");
printf("%s\en", str);
str = envz_get(*envp, e_len, "HOME");
printf("%s\en", str);
return 0;
str = envz_entry(*envp, e_len, "HOME");
printf("%s\en", str);
str = envz_get(*envp, e_len, "HOME");
printf("%s\en", str);
return 0;
}
.fi
.SH "CONFORMING TO"

View File

@ -63,7 +63,6 @@ The
.BR isinf ()
functions return 1 if \fIx\fP is plus infinity, \-1 is \fIx\fP
is minus infinity, and 0 otherwise.
.SH NOTE
Note that these functions are obsolete. C99 defines macros
isfinite(), isinf() and isnan() (for all types) replacing them.

View File

@ -141,7 +141,6 @@ pointer.
Otherwise, NULL is returned and the global variable
.I errno
is set to indicate the error.
.SH "EXAMPLE"
The program below uses
.BR fmemopen ()
@ -163,7 +162,8 @@ size=11; ptr=1 529 1849
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
FILE *out, *in;
int v, s;
@ -193,7 +193,6 @@ int main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
.fi
.sp
.SH "CONFORMING TO"
These functions are GNU extensions.
.\" Jan 06: But they appear to be going up for standardization by

View File

@ -11,7 +11,6 @@
fmtmsg \- print formatted error messages
.SH SYNOPSIS
.nf
.sp
.B #include <fmtmsg.h>
.sp
.BI "int fmtmsg(long " classification ", const char *" label ,
@ -19,7 +18,6 @@ fmtmsg \- print formatted error messages
.BI " int " severity ", const char *" text ,
.br
.BI " const char *" action ", const char *" tag );
.sp
.fi
.SH DESCRIPTION
This function displays a message described by its parameters on the device(s)
@ -231,27 +229,30 @@ vpfmt(), lfmt(), and vlfmt()", and will be removed later.
#include <stdio.h>
#include <fmtmsg.h>
int main() {
long class = MM_PRINT | MM_SOFT | MM_OPSYS | MM_RECOVER;
int err;
err = fmtmsg(class, "util-linux:mount", MM_ERROR,
"unknown mount option", "See mount(8).", "util-linux:mount:017");
switch(err) {
int
main(void)
{
long class = MM_PRINT | MM_SOFT | MM_OPSYS | MM_RECOVER;
int err;
err = fmtmsg(class, "util-linux:mount", MM_ERROR,
"unknown mount option", "See mount(8).",
"util-linux:mount:017");
switch(err) {
case MM_OK:
break;
break;
case MM_NOTOK:
printf("Nothing printed\en");
break;
printf("Nothing printed\en");
break;
case MM_NOMSG:
printf("Nothing printed to stderr\en");
break;
printf("Nothing printed to stderr\en");
break;
case MM_NOCON:
printf("No console output\en");
break;
printf("No console output\en");
break;
default:
printf("Unknown error from fmtmsg()\en");
}
return 0;
printf("Unknown error from fmtmsg()\en");
}
return 0;
}
.fi
.PP

View File

@ -19,7 +19,6 @@ Link with \-lm.
.SH DESCRIPTION
For the definition of the Gamma function, see
.BR tgamma (3).
.PP
.SS "*BSD version"
4.4BSD and FreeBSD libm have a
.BR gamma ()

View File

@ -24,7 +24,6 @@
.TH GETDATE 3 2001-12-26 "" "Linux Programmer's Manual"
.SH NAME
getdate \- convert a string to struct tm
.br
.SH SYNOPSIS
.B "#define _XOPEN_SOURCE"
.br
@ -35,13 +34,12 @@ getdate \- convert a string to struct tm
.BI "struct tm *getdate(const char *" string );
.sp
.BI "extern int getdate_err;"
.sp 2
.sp
.B "#define _GNU_SOURCE"
.br
.B "#include <time.h>"
.sp
.BI "int getdate_r (const char *" string ", struct tm *" res );
.br
.SH DESCRIPTION
The function
.BR getdate ()

View File

@ -123,7 +123,6 @@ and
.BR getfsspec ()
only return the first occurrence, these two functions are not suitable
for use under Linux.
.LP
.SH "SEE ALSO"
.BR getmntent (3),
.BR fstab (5)

View File

@ -58,10 +58,10 @@ as follows:
.RS
.nf
struct group {
char *gr_name; /* group name */
char *gr_passwd; /* group password */
gid_t gr_gid; /* group ID */
char **gr_mem; /* group members */
char *gr_name; /* group name */
char *gr_passwd; /* group password */
gid_t gr_gid; /* group ID */
char **gr_mem; /* group members */
};
.ta
.fi
@ -104,26 +104,28 @@ Insufficient buffer space supplied. Try again with larger buffer.
#include <stdio.h>
#define BUFLEN 4096
int main() {
struct group grp, *grpp;
char buf[BUFLEN];
int i;
int
main(void)
{
struct group grp, *grpp;
char buf[BUFLEN];
int i;
setgrent();
while (1) {
i = getgrent_r(&grp, buf, BUFLEN, &grpp);
if (i)
break;
printf("%s (%d):", grpp->gr_name, grpp->gr_gid);
for (i = 0; ; i++) {
if (grpp->gr_mem[i] == NULL)
break;
printf(" %s", grpp->gr_mem[i]);
}
printf("\en");
}
endgrent();
return 0;
setgrent();
while (1) {
i = getgrent_r(&grp, buf, BUFLEN, &grpp);
if (i)
break;
printf("%s (%d):", grpp->gr_name, grpp->gr_gid);
for (i = 0; ; i++) {
if (grpp->gr_mem[i] == NULL)
break;
printf(" %s", grpp->gr_mem[i]);
}
printf("\en");
}
endgrent();
return 0;
}
.fi
.\" perhaps add error checking - should use strerror_r
@ -157,7 +159,6 @@ getgrent_r(struct group *grp, char *buf, int buflen,
FILE **gr_fp);
.in
.fi
.sp
.SH NOTES
The function
.BR getgrent_r ()

View File

@ -51,23 +51,26 @@ This function is present since glibc 2.2.4.
#include <grp.h>
#include <pwd.h>
int main() {
int i, ng = 0;
char *user = "who"; /* username here */
gid_t *groups = NULL;
struct passwd *pw = getpwnam(user);
if (pw == NULL)
return 0;
if (getgrouplist(user, pw->pw_gid, NULL, &ng) < 0) {
groups = (gid_t *) malloc(ng * sizeof (gid_t));
getgrouplist(user, pw->pw_gid, groups, &ng);
}
for(i = 0; i < ng; i++)
printf("%d\en", groups[i]);
int
main(void)
{
int i, ng = 0;
char *user = "who"; /* username here */
gid_t *groups = NULL;
struct passwd *pw = getpwnam(user);
if (pw == NULL)
return 0;
if (getgrouplist(user, pw->pw_gid, NULL, &ng) < 0) {
groups = (gid_t *) malloc(ng * sizeof (gid_t));
getgrouplist(user, pw->pw_gid, groups, &ng);
}
for(i = 0; i < ng; i++)
printf("%d\en", groups[i]);
return 0;
}
.fi
.SH "SEE ALSO"

View File

@ -105,22 +105,23 @@ is not valid).
#include <stdio.h>
#include <stdlib.h>
int main(void)
int
main(void)
{
FILE * fp;
char * line = NULL;
size_t len = 0;
ssize_t read;
fp = fopen("/etc/motd", "r");
if (fp == NULL)
exit(EXIT_FAILURE);
while ((read = getline(&line, &len, fp)) != \-1) {
printf("Retrieved line of length %zu :\en", read);
printf("%s", line);
}
if (line)
free(line);
return EXIT_SUCCESS;
FILE * fp;
char * line = NULL;
size_t len = 0;
ssize_t read;
fp = fopen("/etc/motd", "r");
if (fp == NULL)
exit(EXIT_FAILURE);
while ((read = getline(&line, &len, fp)) != \-1) {
printf("Retrieved line of length %zu :\en", read);
printf("%s", line);
}
if (line)
free(line);
return EXIT_SUCCESS;
}
.fi
.SH "CONFORMING TO"

View File

@ -313,7 +313,7 @@ with most of its features.
#include <getopt.h>
int
main (int argc, char **argv) {
main(int argc, char **argv) {
int c;
int digit_optind = 0;
@ -330,60 +330,60 @@ main (int argc, char **argv) {
{0, 0, 0, 0}
};
c = getopt_long (argc, argv, "abc:d:012",
c = getopt_long(argc, argv, "abc:d:012",
long_options, &option_index);
if (c == \-1)
break;
switch (c) {
case 0:
printf ("option %s", long_options[option_index].name);
printf("option %s", long_options[option_index].name);
if (optarg)
printf (" with arg %s", optarg);
printf ("\\n");
printf(" with arg %s", optarg);
printf("\\n");
break;
case '0':
case '1':
case '2':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\\n");
printf("digits occur in two different argv-elements.\\n");
digit_optind = this_option_optind;
printf ("option %c\\n", c);
printf("option %c\\n", c);
break;
case 'a':
printf ("option a\\n");
printf("option a\\n");
break;
case 'b':
printf ("option b\\n");
printf("option b\\n");
break;
case 'c':
printf ("option c with value '%s'\\n", optarg);
printf("option c with value '%s'\\n", optarg);
break;
case 'd':
printf ("option d with value '%s'\\n", optarg);
printf("option d with value '%s'\\n", optarg);
break;
case '?':
break;
default:
printf ("?? getopt returned character code 0%o ??\\n", c);
printf("?? getopt returned character code 0%o ??\\n", c);
}
}
if (optind < argc) {
printf ("non-option ARGV-elements: ");
printf("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\\n");
printf("%s ", argv[optind++]);
printf("\\n");
}
exit (0);
exit(0);
}
.fi
.SH BUGS

View File

@ -18,7 +18,6 @@ It is equivalent to
.BI "open(" \fI"/dev/ptmx" , O_RDWR|O_NOCTTY )
on Linux systems, though the pseudo-terminal master is located
elsewhere on some systems that use GNU Libc.
.SH "RETURN VALUE"
.BR getpt ()
returns an open file descriptor upon successful completion. Otherwise, it

View File

@ -58,13 +58,13 @@ as follows:
.RS
.nf
struct passwd {
char *pw_name; /* user name */
char *pw_passwd; /* user password */
uid_t pw_uid; /* user ID */
gid_t pw_gid; /* group ID */
char *pw_gecos; /* real name */
char *pw_dir; /* home directory */
char *pw_shell; /* shell program */
char *pw_name; /* user name */
char *pw_passwd; /* user password */
uid_t pw_uid; /* user ID */
gid_t pw_gid; /* group ID */
char *pw_gecos; /* real name */
char *pw_dir; /* home directory */
char *pw_shell; /* shell program */
};
.fi
.RE
@ -106,22 +106,23 @@ Insufficient buffer space supplied. Try again with larger buffer.
#include <stdio.h>
#define BUFLEN 4096
int main() {
struct passwd pw, *pwp;
char buf[BUFLEN];
int i;
int
main(void)
{
struct passwd pw, *pwp;
char buf[BUFLEN];
int i;
setpwent();
while (1) {
i = getpwent_r(&pw, buf, BUFLEN, &pwp);
if (i)
break;
printf("%s (%d)\etHOME %s\etSHELL %s\en",
pwp->pw_name, pwp->pw_uid,
pwp->pw_dir, pwp->pw_shell);
}
endpwent();
return 0;
setpwent();
while (1) {
i = getpwent_r(&pw, buf, BUFLEN, &pwp);
if (i)
break;
printf("%s (%d)\etHOME %s\etSHELL %s\en", pwp->pw_name,
pwp->pw_uid, pwp->pw_dir, pwp->pw_shell);
}
endpwent();
return 0;
}
.fi
.\" perhaps add error checking - should use strerror_r
@ -155,7 +156,6 @@ getpwent_r(struct passwd *pwd, char *buf, int buflen,
FILE **pw_fp);
.in
.fi
.sp
.SH NOTES
The function
.BR getpwent_r ()

View File

@ -21,11 +21,11 @@ struct rpcent *getrpcbynumber(number)
int number;
.LP
.ft B
setrpcent (stayopen)
setrpcent(stayopen)
int stayopen;
.LP
.ft B
endrpcent ()
endrpcent()
.fi
.SH DESCRIPTION
.LP

View File

@ -53,7 +53,6 @@ lckpwdf, ulckpwdf \- get shadow password file entry
.BI "int sgetspent_r(const char *" s ", struct spwd *" spbuf ,
.br
.BI " char *" buf ", size_t " buflen ", struct spwd **" spbufp );
.sp
.fi
.SH DESCRIPTION
Long ago it was considered safe to have encrypted passwords openly

View File

@ -38,7 +38,6 @@ The function
.BR getttyent ()
opens the file _PATH_TTYS (if necessary) and returns the first entry.
If the file is already open, the next entry.
.SS "The ttyent structure"
.nf
struct ttyent {

View File

@ -122,37 +122,38 @@ and
#include <unistd.h>
#include <utmp.h>
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
struct utmp entry;
struct utmp entry;
system("echo before adding entry:;who");
system("echo before adding entry:;who");
entry.ut_type=USER_PROCESS;
entry.ut_pid=getpid();
strcpy(entry.ut_line,ttyname(0)+strlen("/dev/"));
/* only correct for ptys named /dev/tty[pqr][0\-9a\-z] */
strcpy(entry.ut_id,ttyname(0)+strlen("/dev/tty"));
time(&entry.ut_time);
strcpy(entry.ut_user,getpwuid(getuid())\->pw_name);
memset(entry.ut_host,0,UT_HOSTSIZE);
entry.ut_addr=0;
setutent();
pututline(&entry);
entry.ut_type=USER_PROCESS;
entry.ut_pid=getpid();
strcpy(entry.ut_line,ttyname(0)+strlen("/dev/"));
/* only correct for ptys named /dev/tty[pqr][0\-9a\-z] */
strcpy(entry.ut_id,ttyname(0)+strlen("/dev/tty"));
time(&entry.ut_time);
strcpy(entry.ut_user,getpwuid(getuid())\->pw_name);
memset(entry.ut_host,0,UT_HOSTSIZE);
entry.ut_addr=0;
setutent();
pututline(&entry);
system("echo after adding entry:;who");
system("echo after adding entry:;who");
entry.ut_type=DEAD_PROCESS;
memset(entry.ut_line,0,UT_LINESIZE);
entry.ut_time=0;
memset(entry.ut_user,0,UT_NAMESIZE);
setutent();
pututline(&entry);
entry.ut_type=DEAD_PROCESS;
memset(entry.ut_line,0,UT_LINESIZE);
entry.ut_time=0;
memset(entry.ut_user,0,UT_NAMESIZE);
setutent();
pututline(&entry);
system("echo after removing entry:;who");
system("echo after removing entry:;who");
endutent();
return 0;
endutent();
return 0;
}
.fi
.SH FILES

View File

@ -30,7 +30,6 @@ getw, putw \- input and output of words (ints)
.BI "int getw(FILE *" stream );
.br
.BI "int putw(int " w ", FILE *" stream );
.br
.SH DESCRIPTION
\fBgetw\fP() reads a word (that is, an \fIint\fP) from \fIstream\fP. It's
provided for compatibility with SVr4. We recommend you use

View File

@ -39,7 +39,7 @@ hcreate, hdestroy, hsearch \- hash table management
.BI "ENTRY *hsearch(ENTRY " item ", ACTION " action );
.sp
.B "void hdestroy(void);"
.sp 2
.sp
.B #define _GNU_SOURCE
.br
.B #include <search.h>
@ -150,47 +150,45 @@ The following program inserts 24 items in to a hash table, then prints
some of them.
.nf
#include <stdio.h>
#include <stdlib.h>
#include <search.h>
#include <stdio.h>
#include <stdlib.h>
#include <search.h>
char *data[] = { "alpha", "bravo", "charlie", "delta",
"echo", "foxtrot", "golf", "hotel", "india", "juliet",
"kilo", "lima", "mike", "november", "oscar", "papa",
"quebec", "romeo", "sierra", "tango", "uniform",
"victor", "whisky", "x-ray", "yankee", "zulu"
};
char *data[] = { "alpha", "bravo", "charlie", "delta",
"echo", "foxtrot", "golf", "hotel", "india", "juliet",
"kilo", "lima", "mike", "november", "oscar", "papa",
"quebec", "romeo", "sierra", "tango", "uniform",
"victor", "whisky", "x-ray", "yankee", "zulu"
};
int main() {
ENTRY e, *ep;
int i;
int main() {
ENTRY e, *ep;
int i;
/* starting with small table, and letting it grow does not work */
hcreate(30);
for (i = 0; i < 24; i++) {
e.key = data[i];
/* data is just an integer, instead of a
pointer to something */
e.data = (void *)i;
ep = hsearch(e, ENTER);
/* there should be no failures */
if (ep == NULL) {
/* starting with small table, and letting it grow does not work */
hcreate(30);
for (i = 0; i < 24; i++) {
e.key = data[i];
/* data is just an integer, instead of a
pointer to something */
e.data = (void *)i;
ep = hsearch(e, ENTER);
/* there should be no failures */
if (ep == NULL) {
fprintf(stderr, "entry failed\\n");
exit(1);
}
}
for (i = 22; i < 26; i++) {
/* print two entries from the table, and
show that two are not in the table */
e.key = data[i];
ep = hsearch(e, FIND);
printf("%9.9s \-> %9.9s:%d\\n", e.key,
ep ? ep\->key : "NULL",
ep ? (int)(ep->data) : 0);
}
return 0;
}
}
for (i = 22; i < 26; i++) {
/* print two entries from the table, and
show that two are not in the table */
e.key = data[i];
ep = hsearch(e, FIND);
printf("%9.9s \-> %9.9s:%d\\n", e.key,
ep ? ep\->key : "NULL", ep ? (int)(ep->data) : 0);
}
return 0;
}
.fi
.SH "SEE ALSO"
.BR bsearch (3),

View File

@ -70,7 +70,6 @@ immediately above; it is obsolete because \-1 is a valid address
(255.255.255.255), and \fBinet_aton\fP() provides a cleaner way
to indicate error return.
.PP
The \fBinet_network\fP() function extracts
a number in host byte order suitable for use as an Internet address
from \fIcp\fP, which is a string in numbers-and-dots notation.
@ -100,12 +99,9 @@ is defined in \fInetinet/in.h\fP as:
.sp
.RS
.nf
.ne 7
.ta 8n 16n
struct in_addr {
unsigned long int s_addr;
unsigned long int s_addr;
}
.ta
.fi
.RE
.PP

View File

@ -21,7 +21,6 @@ key_secretkey_is_set \- interfaces to rpc keyserver daemon
.BI "int key_setsecret(const char *" key );
.sp
.B "int key_secretkey_is_set(void);"
.sp
.SH DESCRIPTION
The functions here are used within the RPC's secure authentication
mechanism (AUTH_DES). There should be no need for user programs to
@ -52,16 +51,13 @@ The function
.BR key_secretkey_is_set ()
can be used to determine whether a key has been
set for the effective UID of the calling process.
.SH NOTE
Note that we talk about two types of encryption here. One is
asymmetric using a public and secret key. The other is symmetric, the
64-bit DES.
.br
The routines were part of the linux/doors-project, abandoned by now.
.SH "RETURN VALUES"
The functions return 1 on success and 0 on failure.
.SH "SEE ALSO"
.BR crypt (3)

View File

@ -81,7 +81,6 @@ compiles with
.sp
.fi
in which case it is a 64-bit signed type.
.SS lseek64
Prototype:
.nf
@ -110,7 +109,6 @@ The function
.\" in glibc 2.0.94, not in 2.0.6
is available since glibc 2.1, and is defined to be an alias for
.BR llseek ().
.SS llseek
Prototype:
.nf
@ -142,7 +140,6 @@ glibc 2.1.3 added the link-time warning
.sp
This makes this function unusable if one desires a warning-free
compilation.
.SS _llseek
All the above functions are implemented in terms of this system call.
The prototype is:

View File

@ -91,27 +91,29 @@ static void *(*old_malloc_hook)(size_t, const void *);
void (*__malloc_initialize_hook) (void) = my_init_hook;
static void
my_init_hook(void) {
my_init_hook(void)
{
old_malloc_hook = __malloc_hook;
__malloc_hook = my_malloc_hook;
}
static void *
my_malloc_hook (size_t size, const void *caller) {
my_malloc_hook(size_t size, const void *caller)
{
void *result;
/* Restore all old hooks */
__malloc_hook = old_malloc_hook;
/* Call recursively */
result = malloc (size);
result = malloc(size);
/* Save underlying hooks */
old_malloc_hook = __malloc_hook;
/* `printf' might call `malloc', so protect it too. */
printf ("malloc(%u) called from %p returns %p\\n",
(unsigned int) size, caller, result);
printf("malloc(%u) called from %p returns %p\\n",
(unsigned int) size, caller, result);
/* Restore our own hooks */
__malloc_hook = my_malloc_hook;

View File

@ -49,10 +49,8 @@ is set appropriately.
.B EINVAL
The last six characters of \fItemplate\fP were not XXXXXX.
Now \fItemplate\fP is unchanged.
.TP
.PP
Also see \fBmkdir(2)\fP for other possible values for \fIerrno\fP.
.SH "CONFORMING TO"
This funtion is present on the BSDs.
.\" As at 2006, this function is being considered for a revision of POSIX.1

View File

@ -33,7 +33,6 @@ They are similar in spirit to the macros defined in
for auxiliary data. The buffer passed to and from a netlink socket should
be only accessed using these macros.
.TP
.TP
NLMSG_ALIGN
Round the length of a netlink message up to align it properly.
.TP
@ -43,7 +42,6 @@ in the
.B nlmsg_len
field of the
.IR nlmsghdr .
.TP
NLMSG_SPACE
Return the number of bytes a netlink message with payload of the passed length
@ -70,12 +68,10 @@ Return true if the netlink message is not truncated and ok to parse.
NLMSG_PAYLOAD
Return the length of the payload associated with the
.IR nlmsghdr .
.SH NOTES
It is often better to use netlink via
.B libnetlink
than via the low level kernel interface.
.SH "SEE ALSO"
.BR netlink (7)
.PP

View File

@ -29,7 +29,6 @@ be queried.
.PP
Examples for the locale elements that can be specified in \fIitem\fP
using the constants defined in <langinfo.h> are:
.TP
.BR CODESET \ (LC_CTYPE)
Return a string with the name of the character encoding used in the
@ -38,63 +37,51 @@ selected locale, such as "UTF-8", "ISO-8859-1", or "ANSI_X3.4-1968"
"locale charmap". For a list of character encoding names,
try "locale \-m", cf.\&
.BR locale (1).
.TP
.BR D_T_FMT \ (LC_TIME)
Return a string that can be used as a format string for
.BR strftime (3)
to represent time and date in a locale-specific way.
.TP
.BR D_FMT \ (LC_TIME)
Return a string that can be used as a format string for
.BR strftime (3)
to represent a date in a locale-specific way.
.TP
.BR T_FMT \ (LC_TIME)
Return a string that can be used as a format string for
.BR strftime (3)
to represent a time in a locale-specific way.
.TP
.BR DAY_ "{1\(en7} (LC_TIME)"
Return name of the \fIn\fP-th day of the week. [Warning: this follows
the US convention DAY_1 = Sunday, not the international convention
(ISO 8601) that Monday is the first day of the week.]
.TP
.BR ABDAY_ "{1\(en7} (LC_TIME)"
Return abbreviated name of the \fIn\fP-th day of the week.
.TP
.BR MON_ "{1\(en12} (LC_TIME)"
Return name of the \fIn\fP-th month.
.TP
.BR ABMON_ "{1\(en12} (LC_TIME)"
Return abbreviated name of the \fIn\fP-th month.
.TP
.BR RADIXCHAR \ (LC_NUMERIC)
Return radix character (decimal dot, decimal comma, etc.).
.TP
.BR THOUSEP \ (LC_NUMERIC)
Return separator character for thousands (groups of three digits).
.TP
.BR YESEXPR \ (LC_MESSAGES)
Return a regular expression that can be used with the
.BR regex (3)
function to recognize a positive response to a yes/no question.
.TP
.BR NOEXPR \ (LC_MESSAGES)
Return a regular expression that can be used with the
.BR regex (3)
function to recognize a negative response to a yes/no question.
.TP
.BR CRNCYSTR \ (LC_MONETARY)
Return the currency symbol, preceded by "\-" if the symbol should

View File

@ -62,7 +62,8 @@ options, the program below produces the following output:
#include <stdio.h>
#include <stdlib.h>
int main()
int
main(void)
{
struct s {
int i;

View File

@ -93,7 +93,6 @@ Thus, if a failing call is not immediately followed by a call to
the value of
.I errno
should be saved.
.SH "CONFORMING TO"
The function
.BR perror ()

View File

@ -69,7 +69,6 @@ It is equivalent to
.IR "memalign(sysconf(_SC_PAGESIZE),size)" .
For all three routines, the memory is not zeroed.
.SH "RETURN VALUE"
.BR memalign ()
and
@ -81,7 +80,6 @@ returns zero on success, or one of the error values listed in the
next section on failure. Note that
.IR errno
is not set.
.SH "ERRORS"
.TP
.B EINVAL
@ -92,7 +90,6 @@ parameter was not a power of two, or was not a multiple of
.TP
.B ENOMEM
There was insufficient memory to fulfill the allocation request.
.SH NOTES
On many systems there are alignment restrictions, e.g. on buffers
used for direct block device I/O. POSIX specifies the
@ -141,7 +138,6 @@ GNU libc
.BR malloc ()
always returns 8-byte aligned memory addresses, so these routines are only
needed if you require larger alignment values.
.SH AVAILABILITY
The functions
.BR memalign ()
@ -151,7 +147,6 @@ have been available in all Linux libc libraries.
The function
.BR posix_memalign ()
is available since glibc 2.1.91.
.SH "CONFORMING TO"
The function
.BR valloc ()
@ -165,7 +160,6 @@ appears in SunOS 4.1.3 but not in 4.4BSD.
The function
.BR posix_memalign ()
comes from POSIX.1d.
.SH HEADERS
Everybody agrees that
.BR posix_memalign ()
@ -183,7 +177,6 @@ Libc4,5 and glibc declare it in <malloc.h> and perhaps also in <stdlib.h>
(namely, if _GNU_SOURCE is defined, or _BSD_SOURCE is defined, or,
for glibc, if _XOPEN_SOURCE_EXTENDED is defined, or, equivalently,
_XOPEN_SOURCE is defined to a value not less than 500).
.SH "SEE ALSO"
.BR brk (2),
.BR getpagesize (2),

View File

@ -495,7 +495,6 @@ and
.BR Lf ,
.BR Lg ,
.BR LG ).
.SS "The conversion specifier"
A character that specifies the type of conversion to be applied.
The conversion specifiers and their meanings are:
@ -706,7 +705,6 @@ No argument is required.
.B %
A `%' is written. No argument is converted. The complete conversion
specification is `%%'.
.PP
.SH EXAMPLE
.br
.if \w'\*(Pi'=0 .ds Pi pi
@ -768,13 +766,13 @@ make_message(const char *fmt, ...) {
char *p, *np;
va_list ap;
if ((p = malloc (size)) == NULL)
if ((p = malloc(size)) == NULL)
return NULL;
while (1) {
/* Try to print in the allocated space. */
va_start(ap, fmt);
n = vsnprintf (p, size, fmt, ap);
n = vsnprintf(p, size, fmt, ap);
va_end(ap);
/* If that worked, return the string. */
if (n > \-1 && n < size)
@ -794,7 +792,6 @@ make_message(const char *fmt, ...) {
}
.fi
.RE
.SH NOTES
The glibc implementation of the functions
.BR snprintf ()
@ -930,7 +927,6 @@ call to write to memory and creating a security hole.
.\" .PP
.\" Some floating point conversions under early libc4
.\" caused memory leaks.
.SH "SEE ALSO"
.BR printf (1),
.BR asprintf (3),

View File

@ -98,7 +98,6 @@ and
return a non-negative number on success, or
.B EOF
on error.
.PP
.SH "CONFORMING TO"
C89, C99
.SH BUGS

View File

@ -156,7 +156,7 @@ A typical source fragment would be
#ifdef PATH_MAX
path_max = PATH_MAX;
#else
path_max = pathconf (path, _PC_PATH_MAX);
path_max = pathconf(path, _PC_PATH_MAX);
if (path_max <= 0)
path_max = 4096;
#endif

View File

@ -16,7 +16,6 @@ remquo, remquof, remquol \- remainder and part of quotient
.BI "float remquof(float " x ", float " y ", int *" quo );
.br
.BI "long double remquol(long double " x ", long double " y ", int *" quo );
.sp
.fi
.SH DESCRIPTION
These functions compute the remainder and part of the quotient
@ -40,7 +39,6 @@ and agrees with the quotient in at least the low order 3 bits.
For example, remquo(29.0,3.0) returns \-1.0 and might store 2.
Note that the actual quotient might not fit in an integer.
.\" A possible application of this function might be the computation
.\" of sin(x). Compute remquo(x, pi/2, &quo) or so.
.\"

View File

@ -138,7 +138,6 @@ contained in the structure \fI_res\fP, which is defined in
\fI<resolv.h>\fP. The only field that is normally manipulated by the
user is \fI_res.options\fP. This field can contain the bitwise ``or''
of the following options:
.sp
.TP
.B RES_INIT
True if \fBres_init\fP() has been called.

View File

@ -68,17 +68,19 @@ The result is the localtime of the computer 'linux'.
int use_tcp = 0;
char *servername = "linux";
int main() {
int
main(void)
{
struct sockaddr_in name;
struct rpc_timeval time1 = {0,0};
struct rpc_timeval timeout = {1,0};
struct hostent *hent;
int ret;
memset((char *)&name, 0, sizeof(name));
memset((char *) &name, 0, sizeof(name));
sethostent(1);
hent = gethostbyname(servername);
memcpy((char *)&name.sin_addr, hent->h_addr, hent->h_length);
memcpy((char *) &name.sin_addr, hent->h_addr, hent->h_length);
ret = rtime(&name, &time1, use_tcp ? NULL : &timeout);
if (ret < 0)
@ -106,7 +108,6 @@ and requires
.I <sys/time.h>
instead of
.IR <rpc/auth_des.h> .
.SH "BUGS"
.BR rtime ()
in glibc <= 2.2.5 does not work properly on 64bit machines.

View File

@ -103,7 +103,7 @@ Creating a rtnetlink message to set a MTU of a device.
rta->rta_len = sizeof(unsigned int);
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) +
RTA_LENGTH(sizeof(mtu));
memcpy(RTA_DATA(rta), &mtu, sizeof (mtu));
memcpy(RTA_DATA(rta), &mtu, sizeof(mtu));
send(rtnetlink_sk, &req, req.n.nlmsg_len);
.fi
.SH BUGS

Some files were not shown because too many files have changed in this diff Show More