mirror of https://github.com/mkerrisk/man-pages
ffix
This commit is contained in:
parent
b9208776db
commit
cf0a9ace57
21
Changes
21
Changes
|
@ -12,16 +12,27 @@ been incorporated in changes in this release:
|
||||||
Apologies if I missed anyone!
|
Apologies if I missed anyone!
|
||||||
|
|
||||||
|
|
||||||
New pages
|
|
||||||
---------
|
|
||||||
|
|
||||||
|
|
||||||
Global changes
|
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
|
Typographical or grammatical errors have been corrected in several
|
||||||
places. (Special thanks to Nicolas François!)
|
places.
|
||||||
|
|
||||||
|
|
||||||
Changes to individual pages
|
Changes to individual pages
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
|
bdflush.2
|
||||||
|
mtk
|
||||||
|
Add <sys/kdaemon.h> header file to SYNOPSIS.
|
||||||
|
|
||||||
|
select_tut.2
|
||||||
|
mtk
|
||||||
|
Make SYNOPSIS match select.2.
|
||||||
|
|
|
@ -45,7 +45,6 @@ accept \- accept a connection on a socket
|
||||||
.sp
|
.sp
|
||||||
.BI "int accept(int " sockfd ", struct sockaddr *" addr ", socklen_t *" addrlen );
|
.BI "int accept(int " sockfd ", struct sockaddr *" addr ", socklen_t *" addrlen );
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
|
||||||
The
|
The
|
||||||
.BR accept ()
|
.BR accept ()
|
||||||
system call is used with connection-based socket types
|
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
|
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
|
(probably somebody didn't like losing face over having done the original
|
||||||
stupid thing, so they silently just renamed their blunder)."
|
stupid thing, so they silently just renamed their blunder)."
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR bind (2),
|
.BR bind (2),
|
||||||
.BR connect (2),
|
.BR connect (2),
|
||||||
|
|
|
@ -50,7 +50,6 @@ Modes are specified by
|
||||||
.IR or'ing
|
.IR or'ing
|
||||||
the following:
|
the following:
|
||||||
.RS
|
.RS
|
||||||
.sp
|
|
||||||
.TP 1.0i
|
.TP 1.0i
|
||||||
S_ISUID
|
S_ISUID
|
||||||
04000 set user ID on execution
|
04000 set user ID on execution
|
||||||
|
@ -87,9 +86,8 @@ S_IWOTH
|
||||||
.TP
|
.TP
|
||||||
S_IXOTH
|
S_IXOTH
|
||||||
00001 execute/search by others
|
00001 execute/search by others
|
||||||
.sp
|
|
||||||
.RE
|
.RE
|
||||||
|
.PP
|
||||||
The effective UID of the calling process must match the owner of the file,
|
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
|
or the process must be privileged (Linux: it must have the
|
||||||
.B CAP_FOWNER
|
.B CAP_FOWNER
|
||||||
|
@ -127,7 +125,6 @@ Depending on the file system, other errors can be returned. The more
|
||||||
general errors for
|
general errors for
|
||||||
.BR chmod ()
|
.BR chmod ()
|
||||||
are listed below:
|
are listed below:
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B EACCES
|
.B EACCES
|
||||||
Search permission is denied on a component of the path prefix.
|
Search permission is denied on a component of the path prefix.
|
||||||
|
|
|
@ -515,7 +515,6 @@ at that address.
|
||||||
The address involved may be changed by the
|
The address involved may be changed by the
|
||||||
.BR set_tid_address (2)
|
.BR set_tid_address (2)
|
||||||
system call. This is used by threading libraries.
|
system call. This is used by threading libraries.
|
||||||
|
|
||||||
.SS "sys_clone"
|
.SS "sys_clone"
|
||||||
The
|
The
|
||||||
.B sys_clone
|
.B sys_clone
|
||||||
|
|
|
@ -59,7 +59,6 @@ is set appropriately.
|
||||||
.I size
|
.I size
|
||||||
is not positive.
|
is not positive.
|
||||||
.TP
|
.TP
|
||||||
.TP
|
|
||||||
.B ENFILE
|
.B ENFILE
|
||||||
The system limit on the total number of open files has been reached.
|
The system limit on the total number of open files has been reached.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -42,19 +42,21 @@ The
|
||||||
.I struct epoll_event
|
.I struct epoll_event
|
||||||
is defined as :
|
is defined as :
|
||||||
.sp
|
.sp
|
||||||
|
.in +0.5i
|
||||||
.nf
|
.nf
|
||||||
typedef union epoll_data {
|
typedef union epoll_data {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
int fd;
|
int fd;
|
||||||
__uint32_t u32;
|
__uint32_t u32;
|
||||||
__uint64_t u64;
|
__uint64_t u64;
|
||||||
} epoll_data_t;
|
} epoll_data_t;
|
||||||
|
|
||||||
struct epoll_event {
|
struct epoll_event {
|
||||||
__uint32_t events; /* Epoll events */
|
__uint32_t events; /* Epoll events */
|
||||||
epoll_data_t data; /* User data variable */
|
epoll_data_t data; /* User data variable */
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
|
.in -0.5i
|
||||||
|
|
||||||
The
|
The
|
||||||
.I events
|
.I events
|
||||||
|
|
|
@ -62,19 +62,21 @@ The
|
||||||
.I struct epoll_event
|
.I struct epoll_event
|
||||||
is defined as :
|
is defined as :
|
||||||
.sp
|
.sp
|
||||||
|
.in +0.5i
|
||||||
.nf
|
.nf
|
||||||
typedef union epoll_data {
|
typedef union epoll_data {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
int fd;
|
int fd;
|
||||||
__uint32_t u32;
|
__uint32_t u32;
|
||||||
__uint64_t u64;
|
__uint64_t u64;
|
||||||
} epoll_data_t;
|
} epoll_data_t;
|
||||||
|
|
||||||
struct epoll_event {
|
struct epoll_event {
|
||||||
__uint32_t events; /* Epoll events */
|
__uint32_t events; /* Epoll events */
|
||||||
epoll_data_t data; /* User data variable */
|
epoll_data_t data; /* User data variable */
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
|
.in -0.5i
|
||||||
|
|
||||||
The
|
The
|
||||||
.I data
|
.I data
|
||||||
|
|
|
@ -318,7 +318,6 @@ a #! executable shell script.
|
||||||
.\" Linux versions have also had other security holes in \fBexecve\fP(),
|
.\" Linux versions have also had other security holes in \fBexecve\fP(),
|
||||||
.\" that could be exploited for denial of service by a suitably crafted
|
.\" 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.
|
.\" ELF binary. There are no known problems with 2.0.34 or 2.2.15.
|
||||||
|
|
||||||
.SH HISTORICAL
|
.SH HISTORICAL
|
||||||
With Unix V6 the argument list of an
|
With Unix V6 the argument list of an
|
||||||
.BR exec ()
|
.BR exec ()
|
||||||
|
@ -330,7 +329,6 @@ argument list was not directly usable in a further
|
||||||
.BR exec ()
|
.BR exec ()
|
||||||
call.
|
call.
|
||||||
Since Unix V7 both are NULL.
|
Since Unix V7 both are NULL.
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR chmod (2),
|
.BR chmod (2),
|
||||||
.BR fork (2),
|
.BR fork (2),
|
||||||
|
|
10
man2/fcntl.2
10
man2/fcntl.2
|
@ -71,7 +71,6 @@ performs one of the operations described below on the open file descriptor
|
||||||
.IR fd .
|
.IR fd .
|
||||||
The operation is determined by
|
The operation is determined by
|
||||||
.IR cmd .
|
.IR cmd .
|
||||||
.P
|
|
||||||
.SS "Duplicating a file descriptor"
|
.SS "Duplicating a file descriptor"
|
||||||
.TP
|
.TP
|
||||||
.B F_DUPFD
|
.B F_DUPFD
|
||||||
|
@ -89,7 +88,6 @@ On success, the new descriptor is returned.
|
||||||
See
|
See
|
||||||
.BR dup (2)
|
.BR dup (2)
|
||||||
for further details.
|
for further details.
|
||||||
.P
|
|
||||||
.SS "File descriptor flags"
|
.SS "File descriptor flags"
|
||||||
The following commands manipulate the flags associated with
|
The following commands manipulate the flags associated with
|
||||||
a file descriptor.
|
a file descriptor.
|
||||||
|
@ -108,7 +106,6 @@ Read the file descriptor flags.
|
||||||
.B F_SETFD
|
.B F_SETFD
|
||||||
Set the file descriptor flags to the value specified by
|
Set the file descriptor flags to the value specified by
|
||||||
.IR arg .
|
.IR arg .
|
||||||
.P
|
|
||||||
.SS "File status flags"
|
.SS "File status flags"
|
||||||
Each open file description has certain associated status flags,
|
Each open file description has certain associated status flags,
|
||||||
initialized by
|
initialized by
|
||||||
|
@ -153,7 +150,6 @@ flags.
|
||||||
.\" FIXME According to POSIX.1-2001, O_SYNC should also be modifiable
|
.\" FIXME According to POSIX.1-2001, O_SYNC should also be modifiable
|
||||||
.\" via fcntl(2), but currently Linux does not permit this
|
.\" via fcntl(2), but currently Linux does not permit this
|
||||||
.\" See http://bugzilla.kernel.org/show_bug.cgi?id=5994
|
.\" See http://bugzilla.kernel.org/show_bug.cgi?id=5994
|
||||||
.P
|
|
||||||
.SS "Advisory locking"
|
.SS "Advisory locking"
|
||||||
.BR F_GETLK ", " F_SETLK " and " F_SETLKW
|
.BR F_GETLK ", " F_SETLK " and " F_SETLKW
|
||||||
are used to acquire, release, and test for the existence of record
|
are used to acquire, release, and test for the existence of record
|
||||||
|
@ -329,7 +325,6 @@ should be avoided; use
|
||||||
and
|
and
|
||||||
.BR write (2)
|
.BR write (2)
|
||||||
instead.
|
instead.
|
||||||
.P
|
|
||||||
.SS "Mandatory locking"
|
.SS "Mandatory locking"
|
||||||
(Non-POSIX.)
|
(Non-POSIX.)
|
||||||
The above record locks may be either advisory or mandatory,
|
The above record locks may be either advisory or mandatory,
|
||||||
|
@ -375,7 +370,6 @@ permission bit (see
|
||||||
.BR chmod (1)
|
.BR chmod (1)
|
||||||
and
|
and
|
||||||
.BR chmod (2)).
|
.BR chmod (2)).
|
||||||
.P
|
|
||||||
.SS "Managing signals"
|
.SS "Managing signals"
|
||||||
.BR F_GETOWN ", " F_SETOWN ", " F_GETSIG " and " F_SETSIG
|
.BR F_GETOWN ", " F_SETOWN ", " F_GETSIG " and " F_SETSIG
|
||||||
are used to manage I/O availability signals:
|
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
|
.I aio_sigevent
|
||||||
structure to achieve similar things; these are also available
|
structure to achieve similar things; these are also available
|
||||||
in Linux as part of the GNU C Library (Glibc).
|
in Linux as part of the GNU C Library (Glibc).
|
||||||
.P
|
|
||||||
.SS Leases
|
.SS Leases
|
||||||
.B F_SETLEASE
|
.B F_SETLEASE
|
||||||
and
|
and
|
||||||
|
@ -584,7 +577,6 @@ values is specified in the integer
|
||||||
.IR arg :
|
.IR arg :
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
.TP
|
|
||||||
.B F_RDLCK
|
.B F_RDLCK
|
||||||
Take out a read lease.
|
Take out a read lease.
|
||||||
This will cause the calling process to be notified when
|
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
|
field of this argument will hold the descriptor of the leased file
|
||||||
that has been accessed by another process.
|
that has been accessed by another process.
|
||||||
(This is useful if the caller holds leases against multiple files).
|
(This is useful if the caller holds leases against multiple files).
|
||||||
.P
|
|
||||||
.SS "File and directory change notification (dnotify)"
|
.SS "File and directory change notification (dnotify)"
|
||||||
.TP
|
.TP
|
||||||
.B F_NOTIFY
|
.B F_NOTIFY
|
||||||
|
@ -713,7 +704,6 @@ The events to be notified are specified in
|
||||||
.IR arg ,
|
.IR arg ,
|
||||||
which is a bit mask specified by ORing together zero or more of
|
which is a bit mask specified by ORing together zero or more of
|
||||||
the following bits:
|
the following bits:
|
||||||
|
|
||||||
.TS
|
.TS
|
||||||
l l
|
l l
|
||||||
----
|
----
|
||||||
|
|
|
@ -107,7 +107,6 @@ If the timer expires while the process is active (always true for
|
||||||
.BR ITIMER_VIRTUAL )
|
.BR ITIMER_VIRTUAL )
|
||||||
the signal will be delivered immediately when generated. Otherwise the
|
the signal will be delivered immediately when generated. Otherwise the
|
||||||
delivery will be offset by a small time dependent on the system loading.
|
delivery will be offset by a small time dependent on the system loading.
|
||||||
.LP
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success, zero is returned. On error, \-1 is returned, and
|
On success, zero is returned. On error, \-1 is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
|
|
|
@ -41,7 +41,6 @@ and
|
||||||
(both introduced in Linux 2.1.44)
|
(both introduced in Linux 2.1.44)
|
||||||
get the real UID, effective UID, and saved set-user-ID (resp. group ID's)
|
get the real UID, effective UID, and saved set-user-ID (resp. group ID's)
|
||||||
of the current process.
|
of the current process.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success, zero is returned. On error, \-1 is returned, and
|
On success, zero is returned. On error, \-1 is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
|
|
|
@ -120,12 +120,10 @@ For
|
||||||
.BR setsockopt (),
|
.BR setsockopt (),
|
||||||
the parameter should be non-zero to enable a boolean option, or zero if the
|
the parameter should be non-zero to enable a boolean option, or zero if the
|
||||||
option is to be disabled.
|
option is to be disabled.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
For a description of the available socket options see
|
For a description of the available socket options see
|
||||||
.BR socket (7)
|
.BR socket (7)
|
||||||
and the appropriate protocol man pages.
|
and the appropriate protocol man pages.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success, zero is returned. On error, \-1 is returned, and
|
On success, zero is returned. On error, \-1 is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
|
|
36
man2/intro.2
36
man2/intro.2
|
@ -55,7 +55,6 @@ on when to use one or other mechanism.
|
||||||
A _syscall macro
|
A _syscall macro
|
||||||
|
|
||||||
desired system call
|
desired system call
|
||||||
|
|
||||||
.SS Setup
|
.SS Setup
|
||||||
The important thing to know about a system call is its prototype. You
|
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.
|
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,
|
specify. Once you include the _syscall() in your source file,
|
||||||
you call the system call by \fIname\fP.
|
you call the system call by \fIname\fP.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
|
||||||
.sp
|
.sp
|
||||||
|
.nf
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <linux/unistd.h> /* for _syscallX macros/related stuff */
|
#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
|
/* Note: if you copy directly from the nroff source, remember to
|
||||||
REMOVE the extra backslashes in the printf statement. */
|
REMOVE the extra backslashes in the printf statement. */
|
||||||
|
|
||||||
int main(void)
|
int
|
||||||
|
main(void)
|
||||||
{
|
{
|
||||||
struct sysinfo s_info;
|
struct sysinfo s_info;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = sysinfo(&s_info);
|
error = sysinfo(&s_info);
|
||||||
printf("code error = %d\\n", error);
|
printf("code error = %d\\n", error);
|
||||||
printf("Uptime = %lds\\nLoad: 1 min %lu / 5 min %lu / 15 min %lu\\n"
|
printf("Uptime = %lds\\nLoad: 1 min %lu / 5 min %lu / 15 min %lu\\n"
|
||||||
"RAM: total %lu / free %lu / shared %lu\\n"
|
"RAM: total %lu / free %lu / shared %lu\\n"
|
||||||
"Memory in buffers = %lu\\nSwap: total %lu / free %lu\\n"
|
"Memory in buffers = %lu\\nSwap: total %lu / free %lu\\n"
|
||||||
"Number of processes = %d\\n",
|
"Number of processes = %d\\n",
|
||||||
s_info.uptime, s_info.loads[0],
|
s_info.uptime, s_info.loads[0],
|
||||||
s_info.loads[1], s_info.loads[2],
|
s_info.loads[1], s_info.loads[2],
|
||||||
s_info.totalram, s_info.freeram,
|
s_info.totalram, s_info.freeram,
|
||||||
s_info.sharedram, s_info.bufferram,
|
s_info.sharedram, s_info.bufferram,
|
||||||
s_info.totalswap, s_info.freeswap,
|
s_info.totalswap, s_info.freeswap,
|
||||||
s_info.procs);
|
s_info.procs);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.SS "Sample Output"
|
.SS "Sample Output"
|
||||||
|
|
|
@ -24,9 +24,7 @@
|
||||||
.TH IOCTL_LIST 2 2003-03-30 "Linux 1.3" "Linux Programmer's Manual"
|
.TH IOCTL_LIST 2 2003-03-30 "Linux 1.3" "Linux Programmer's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
ioctl_list \- list of ioctl calls in Linux/i386 kernel
|
ioctl_list \- list of ioctl calls in Linux/i386 kernel
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
|
||||||
This is Ioctl List 1.3.27, a list of ioctl calls in Linux/i386 kernel
|
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.
|
1.3.27. It contains 421 ioctls from /usr/include/{asm,linux}/*.h.
|
||||||
For each ioctl, its numerical value, its name, and its argument
|
For each ioctl, its numerical value, its name, and its argument
|
||||||
|
@ -43,7 +41,6 @@ separate section.
|
||||||
.PP
|
.PP
|
||||||
This list is very incomplete.
|
This list is very incomplete.
|
||||||
Please e-mail changes and comments to <mec@duracef.shout.net>.
|
Please e-mail changes and comments to <mec@duracef.shout.net>.
|
||||||
|
|
||||||
.SH "IOCTL STRUCTURE"
|
.SH "IOCTL STRUCTURE"
|
||||||
.\" added two sections - aeb
|
.\" added two sections - aeb
|
||||||
Ioctl command values are 32-bit constants.
|
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:
|
Thus, it seems that the new structure only gave disadvantages:
|
||||||
it does not help in checking, but it causes varying values
|
it does not help in checking, but it causes varying values
|
||||||
for the various architectures.
|
for the various architectures.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
Decent ioctls return 0 on success and \-1 on error, while
|
Decent ioctls return 0 on success and \-1 on error, while
|
||||||
any output value is stored via the argument. However,
|
any output value is stored via the argument. However,
|
||||||
quite a few ioctls in fact return an output value.
|
quite a few ioctls in fact return an output value.
|
||||||
This is not yet indicated below.
|
This is not yet indicated below.
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
|
|
||||||
// Main table.
|
// Main table.
|
||||||
|
|
||||||
// <include/asm-i386/socket.h>
|
// <include/asm-i386/socket.h>
|
||||||
|
@ -568,7 +564,6 @@ This is not yet indicated below.
|
||||||
0x0000560A VT_RESIZEX const struct vt_consize *
|
0x0000560A VT_RESIZEX const struct vt_consize *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// More arguments.
|
// More arguments.
|
||||||
|
|
||||||
Some ioctl's take a pointer to a structure which contains additional
|
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 *
|
TIOCLINUX-10 1 + const char *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Duplicate ioctls
|
// Duplicate ioctls
|
||||||
|
|
||||||
This list does not include ioctls in the range SIOCDEVPRIVATE and
|
This list does not include ioctls in the range SIOCDEVPRIVATE and
|
||||||
|
|
|
@ -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
|
O_SYNC) writes. I/O priorities are not supported for asynchronous
|
||||||
writes because they are issued outside the context of the program
|
writes because they are issued outside the context of the program
|
||||||
dirtying the memory, and thus program-specific priorities do not apply.
|
dirtying the memory, and thus program-specific priorities do not apply.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success,
|
On success,
|
||||||
.BR ioprio_get ()
|
.BR ioprio_get ()
|
||||||
|
|
|
@ -85,7 +85,6 @@ length and this sysctl setting is ignored.
|
||||||
See
|
See
|
||||||
.BR tcp (7)
|
.BR tcp (7)
|
||||||
for more information.
|
for more information.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success, zero is returned. On error, \-1 is returned, and
|
On success, zero is returned. On error, \-1 is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
|
|
|
@ -60,7 +60,6 @@ or
|
||||||
respectively.
|
respectively.
|
||||||
It returns the resulting file position in the argument
|
It returns the resulting file position in the argument
|
||||||
.IR result .
|
.IR result .
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
Upon successful completion,
|
Upon successful completion,
|
||||||
.BR _llseek ()
|
.BR _llseek ()
|
||||||
|
|
|
@ -42,7 +42,6 @@ For
|
||||||
.BR lookup_dcookie ()
|
.BR lookup_dcookie ()
|
||||||
to return successfully,
|
to return successfully,
|
||||||
the kernel must still hold a cookie reference to the directory entry.
|
the kernel must still hold a cookie reference to the directory entry.
|
||||||
|
|
||||||
.SH "NOTES"
|
.SH "NOTES"
|
||||||
.BR lookup_dcookie ()
|
.BR lookup_dcookie ()
|
||||||
is a special-purpose system call, currently used only by the oprofile profiler.
|
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
|
The path returned may be suffixed by the string " (deleted)" if the directory
|
||||||
entry has been removed.
|
entry has been removed.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success,
|
On success,
|
||||||
.BR lookup_dcookie ()
|
.BR lookup_dcookie ()
|
||||||
|
|
|
@ -131,7 +131,6 @@ is incorrect English, but maintained for historical reasons.
|
||||||
|
|
||||||
When converting old code, substitute values for \fIwhence\fP with the
|
When converting old code, substitute values for \fIwhence\fP with the
|
||||||
following macros:
|
following macros:
|
||||||
.PP
|
|
||||||
.TS
|
.TS
|
||||||
c c
|
c c
|
||||||
l l.
|
l l.
|
||||||
|
|
|
@ -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
|
If the parent directory has the set-group-ID bit set then so will the
|
||||||
newly created directory.
|
newly created directory.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
.BR mkdir ()
|
.BR mkdir ()
|
||||||
returns zero on success, or \-1 if an error occurred (in which case,
|
returns zero on success, or \-1 if an error occurred (in which case,
|
||||||
|
|
|
@ -64,7 +64,7 @@ and
|
||||||
is set appropriately.
|
is set appropriately.
|
||||||
.SH ERRORS
|
.SH ERRORS
|
||||||
.TP
|
.TP
|
||||||
.SH EFAULT
|
EFAULT
|
||||||
Problem with getting the
|
Problem with getting the
|
||||||
data from userspace.
|
data from userspace.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
|
|
|
@ -275,7 +275,6 @@ is set appropriately.
|
||||||
The error values given below result from filesystem type independent
|
The error values given below result from filesystem type independent
|
||||||
errors. Each filesystem type may have its own special errors and its
|
errors. Each filesystem type may have its own special errors and its
|
||||||
own special behavior. See the kernel source code for details.
|
own special behavior. See the kernel source code for details.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B EACCES
|
.B EACCES
|
||||||
A component of a path was not searchable. (See also
|
A component of a path was not searchable. (See also
|
||||||
|
|
|
@ -260,7 +260,6 @@ For a discussion of the effect of
|
||||||
.BR O_NONBLOCK
|
.BR O_NONBLOCK
|
||||||
in conjunction with mandatory file locks and with file leases, see
|
in conjunction with mandatory file locks and with file leases, see
|
||||||
.BR fcntl (2).
|
.BR fcntl (2).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B O_SYNC
|
.B O_SYNC
|
||||||
The file is opened for synchronous I/O. Any
|
The file is opened for synchronous I/O. Any
|
||||||
|
|
|
@ -26,7 +26,6 @@ Unix/Linux path resolution \- find the file referred to by a filename
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Some Unix/Linux system calls have as parameter one or more filenames.
|
Some Unix/Linux system calls have as parameter one or more filenames.
|
||||||
A filename (or pathname) is resolved as follows.
|
A filename (or pathname) is resolved as follows.
|
||||||
|
|
||||||
.SS "Step 1: Start of the resolution process"
|
.SS "Step 1: Start of the resolution process"
|
||||||
If the pathname starts with the '/' character, the starting lookup directory
|
If the pathname starts with the '/' character, the starting lookup directory
|
||||||
is the root directory of the current process. (A process inherits its
|
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 starting with a '/' character are called absolute pathnames.
|
||||||
Pathnames not starting with a '/' are called relative pathnames.
|
Pathnames not starting with a '/' are called relative pathnames.
|
||||||
|
|
||||||
.SS "Step 2: Walk along the path"
|
.SS "Step 2: Walk along the path"
|
||||||
Set the current lookup directory to the starting lookup directory.
|
Set the current lookup directory to the starting lookup directory.
|
||||||
Now, for each non-final component of the pathname, where a component
|
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
|
.\" presently: max recursion depth during symlink resolution: 5
|
||||||
.\" max total number of symlinks followed: 40
|
.\" max total number of symlinks followed: 40
|
||||||
.\" _POSIX_SYMLOOP_MAX is 8
|
.\" _POSIX_SYMLOOP_MAX is 8
|
||||||
|
|
||||||
.SS "Step 3: Find the final entry"
|
.SS "Step 3: Find the final entry"
|
||||||
The lookup of the final component of the pathname goes just like
|
The lookup of the final component of the pathname goes just like
|
||||||
that of all other components, as described in the previous step,
|
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
|
maybe we are just creating it. The details on the treatment
|
||||||
of the final entry are described in the manual pages of the specific
|
of the final entry are described in the manual pages of the specific
|
||||||
system calls.
|
system calls.
|
||||||
|
|
||||||
.SS ". and .."
|
.SS ". and .."
|
||||||
By convention, every directory has the entries "." and "..",
|
By convention, every directory has the entries "." and "..",
|
||||||
which refer to the directory itself and to its parent directory,
|
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.
|
actually present in the physical filesystem.
|
||||||
|
|
||||||
One cannot walk down past the root: "/.." is the same as "/".
|
One cannot walk down past the root: "/.." is the same as "/".
|
||||||
|
|
||||||
.SS "Mount points"
|
.SS "Mount points"
|
||||||
After a "mount dev path" command, the pathname "path" refers to
|
After a "mount dev path" command, the pathname "path" refers to
|
||||||
the root of the filesystem hierarchy on the device "dev", and no
|
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
|
One can walk out of a mounted filesystem: "path/.." refers to
|
||||||
the parent directory of "path",
|
the parent directory of "path",
|
||||||
outside of the filesystem hierarchy on "dev".
|
outside of the filesystem hierarchy on "dev".
|
||||||
|
|
||||||
.SS "Trailing slashes"
|
.SS "Trailing slashes"
|
||||||
If a pathname ends in a '/', that forces resolution of the preceding
|
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.
|
component as in Step 2: it has to exist and resolve to a directory.
|
||||||
Otherwise a trailing '/' is ignored.
|
Otherwise a trailing '/' is ignored.
|
||||||
(Or, equivalently, a pathname with a trailing '/' is equivalent to
|
(Or, equivalently, a pathname with a trailing '/' is equivalent to
|
||||||
the pathname obtained by appending '.' to it.)
|
the pathname obtained by appending '.' to it.)
|
||||||
|
|
||||||
.SS "Final symlink"
|
.SS "Final symlink"
|
||||||
If the last component of a pathname is a symbolic link, then it
|
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
|
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
|
will operate on the symlink, while
|
||||||
.BR stat (2)
|
.BR stat (2)
|
||||||
operates on the file pointed to by the symlink.
|
operates on the file pointed to by the symlink.
|
||||||
|
|
||||||
.SS "Length limit"
|
.SS "Length limit"
|
||||||
There is a maximum length for pathnames. If the pathname (or some
|
There is a maximum length for pathnames. If the pathname (or some
|
||||||
intermediate pathname obtained while resolving symbolic links)
|
intermediate pathname obtained while resolving symbolic links)
|
||||||
is too long, an ENAMETOOLONG error is returned ("File name too long").
|
is too long, an ENAMETOOLONG error is returned ("File name too long").
|
||||||
|
|
||||||
.SS "Empty pathname"
|
.SS "Empty pathname"
|
||||||
In the original Unix, the empty pathname referred to the current directory.
|
In the original Unix, the empty pathname referred to the current directory.
|
||||||
Nowadays POSIX decrees that an empty pathname must not be resolved
|
Nowadays POSIX decrees that an empty pathname must not be resolved
|
||||||
successfully. Linux returns ENOENT in this case.
|
successfully. Linux returns ENOENT in this case.
|
||||||
|
|
||||||
.SS "Permissions"
|
.SS "Permissions"
|
||||||
The permission bits of a file consist of three groups of three bits, cf.\&
|
The permission bits of a file consist of three groups of three bits, cf.\&
|
||||||
.BR chmod (1)
|
.BR chmod (1)
|
||||||
|
@ -178,7 +168,6 @@ Similarly, Linux uses the fsgid ("file system group ID")
|
||||||
instead of the effective group ID. See
|
instead of the effective group ID. See
|
||||||
.BR setfsgid (2).
|
.BR setfsgid (2).
|
||||||
.\" FIXME say something about filesystem mounted read-only ?
|
.\" FIXME say something about filesystem mounted read-only ?
|
||||||
|
|
||||||
.SS "Bypassing permission checks: superuser and capabilities"
|
.SS "Bypassing permission checks: superuser and capabilities"
|
||||||
On a traditional Unix system, the superuser
|
On a traditional Unix system, the superuser
|
||||||
.RI ( root ,
|
.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.
|
on directories, and read permission on ordinary files.
|
||||||
.\" FIXME say something about immutable files
|
.\" FIXME say something about immutable files
|
||||||
.\" FIXME say something about ACLs
|
.\" FIXME say something about ACLs
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR capabilities (7)
|
.BR capabilities (7)
|
||||||
|
|
|
@ -115,7 +115,6 @@ main(int argc, char *argv[])
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR fork (2),
|
.BR fork (2),
|
||||||
|
|
|
@ -80,7 +80,6 @@ On success, zero is returned. On error, \-1 is returned, and
|
||||||
.SH ERRORS
|
.SH ERRORS
|
||||||
\fBpivot_root\fP() may return (in \fIerrno\fP) any of the errors returned by
|
\fBpivot_root\fP() may return (in \fIerrno\fP) any of the errors returned by
|
||||||
\fBstat(2)\fP. Additionally, it may return:
|
\fBstat(2)\fP. Additionally, it may return:
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B EBUSY
|
.B EBUSY
|
||||||
\fInew_root\fP or \fIput_old\fP are on the current root file system,
|
\fInew_root\fP or \fIput_old\fP are on the current root file system,
|
||||||
|
|
|
@ -170,7 +170,6 @@ Priority data may be written.
|
||||||
.PP
|
.PP
|
||||||
Linux also knows about, but does not use
|
Linux also knows about, but does not use
|
||||||
.BR POLLMSG .
|
.BR POLLMSG .
|
||||||
.PP
|
|
||||||
.SS ppoll()
|
.SS ppoll()
|
||||||
The relationship between
|
The relationship between
|
||||||
.BR poll ()
|
.BR poll ()
|
||||||
|
|
|
@ -167,7 +167,6 @@ Sync disk copy of a filesystem's quota.
|
||||||
.TP
|
.TP
|
||||||
.B Q_GETSTATS
|
.B Q_GETSTATS
|
||||||
Get collected stats.
|
Get collected stats.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success,
|
On success,
|
||||||
.BR quotactl ()
|
.BR quotactl ()
|
||||||
|
|
|
@ -56,7 +56,6 @@ is zero, \fBread\fP() returns zero and has no other results.
|
||||||
If
|
If
|
||||||
.I count
|
.I count
|
||||||
is greater than SSIZE_MAX, the result is unspecified.
|
is greater than SSIZE_MAX, the result is unspecified.
|
||||||
.PP
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success, the number of bytes read is returned (zero indicates end of
|
On success, the number of bytes read is returned (zero indicates end of
|
||||||
file), and the file position is advanced by this number.
|
file), and the file position is advanced by this number.
|
||||||
|
|
|
@ -90,7 +90,6 @@ is the size of
|
||||||
not counting the null terminator.
|
not counting the null terminator.
|
||||||
.I d_name
|
.I d_name
|
||||||
is a null-terminated filename.
|
is a null-terminated filename.
|
||||||
.PP
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success, 1 is returned.
|
On success, 1 is returned.
|
||||||
On end of directory, 0 is returned.
|
On end of directory, 0 is returned.
|
||||||
|
|
|
@ -84,7 +84,6 @@ The
|
||||||
function works just like
|
function works just like
|
||||||
.BR write (2)
|
.BR write (2)
|
||||||
except that multiple buffers are written out.
|
except that multiple buffers are written out.
|
||||||
.PP
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success, the
|
On success, the
|
||||||
.BR readv ()
|
.BR readv ()
|
||||||
|
|
|
@ -189,26 +189,29 @@ program would look like:
|
||||||
.nf
|
.nf
|
||||||
int child_events = 0;
|
int child_events = 0;
|
||||||
|
|
||||||
void child_sig_handler (int x) {
|
void
|
||||||
|
child_sig_handler(int x)
|
||||||
|
{
|
||||||
child_events++;
|
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;
|
sigset_t sigmask, orig_sigmask;
|
||||||
|
|
||||||
sigemptyset (&sigmask);
|
sigemptyset(&sigmask);
|
||||||
sigaddset (&sigmask, SIGCHLD);
|
sigaddset(&sigmask, SIGCHLD);
|
||||||
sigprocmask (SIG_BLOCK, &sigmask,
|
sigprocmask(SIG_BLOCK, &sigmask, &orig_sigmask);
|
||||||
&orig_sigmask);
|
|
||||||
|
|
||||||
signal (SIGCHLD, child_sig_handler);
|
signal(SIGCHLD, child_sig_handler);
|
||||||
|
|
||||||
for (;;) { /* main loop */
|
for (;;) { /* main loop */
|
||||||
for (; child_events > 0; child_events\-\-) {
|
for (; child_events > 0; child_events\-\-) {
|
||||||
/* do event work here */
|
/* 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 */
|
/* main body of program */
|
||||||
}
|
}
|
||||||
|
@ -257,65 +260,61 @@ static int forward_port;
|
||||||
#undef max
|
#undef max
|
||||||
#define max(x,y) ((x) > (y) ? (x) : (y))
|
#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;
|
struct sockaddr_in a;
|
||||||
int s;
|
int s;
|
||||||
int yes;
|
int yes;
|
||||||
if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
|
if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||||
perror ("socket");
|
perror("socket");
|
||||||
return \-1;
|
return \-1;
|
||||||
}
|
}
|
||||||
yes = 1;
|
yes = 1;
|
||||||
if (setsockopt
|
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
|
||||||
(s, SOL_SOCKET, SO_REUSEADDR,
|
(char *) &yes, sizeof(yes)) < 0) {
|
||||||
(char *) &yes, sizeof (yes)) < 0) {
|
perror("setsockopt");
|
||||||
perror ("setsockopt");
|
close(s);
|
||||||
close (s);
|
|
||||||
return \-1;
|
return \-1;
|
||||||
}
|
}
|
||||||
memset (&a, 0, sizeof (a));
|
memset(&a, 0, sizeof(a));
|
||||||
a.sin_port = htons (listen_port);
|
a.sin_port = htons(listen_port);
|
||||||
a.sin_family = AF_INET;
|
a.sin_family = AF_INET;
|
||||||
if (bind
|
if (bind(s, (struct sockaddr *) &a, sizeof(a)) < 0) {
|
||||||
(s, (struct sockaddr *) &a, sizeof (a)) < 0) {
|
perror("bind");
|
||||||
perror ("bind");
|
close(s);
|
||||||
close (s);
|
|
||||||
return \-1;
|
return \-1;
|
||||||
}
|
}
|
||||||
printf ("accepting connections on port %d\\n",
|
printf("accepting connections on port %d\\n", listen_port);
|
||||||
(int) listen_port);
|
listen(s, 10);
|
||||||
listen (s, 10);
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int connect_socket (int connect_port,
|
static int
|
||||||
char *address) {
|
connect_socket(int connect_port, char *address)
|
||||||
|
{
|
||||||
struct sockaddr_in a;
|
struct sockaddr_in a;
|
||||||
int s;
|
int s;
|
||||||
if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
|
if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||||
perror ("socket");
|
perror("socket");
|
||||||
close (s);
|
close(s);
|
||||||
return \-1;
|
return \-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (&a, 0, sizeof (a));
|
memset(&a, 0, sizeof(a));
|
||||||
a.sin_port = htons (connect_port);
|
a.sin_port = htons(connect_port);
|
||||||
a.sin_family = AF_INET;
|
a.sin_family = AF_INET;
|
||||||
|
|
||||||
if (!inet_aton
|
if (!inet_aton(address, (struct in_addr *) &a.sin_addr.s_addr)) {
|
||||||
(address,
|
perror("bad IP address format");
|
||||||
(struct in_addr *) &a.sin_addr.s_addr)) {
|
close(s);
|
||||||
perror ("bad IP address format");
|
|
||||||
close (s);
|
|
||||||
return \-1;
|
return \-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connect
|
if (connect(s, (struct sockaddr *) &a, sizeof(a)) < 0) {
|
||||||
(s, (struct sockaddr *) &a,
|
perror("connect()");
|
||||||
sizeof (a)) < 0) {
|
shutdown(s, SHUT_RDWR);
|
||||||
perror ("connect()");
|
close(s);
|
||||||
shutdown (s, SHUT_RDWR);
|
|
||||||
close (s);
|
|
||||||
return \-1;
|
return \-1;
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
@ -323,23 +322,25 @@ static int connect_socket (int connect_port,
|
||||||
|
|
||||||
#define SHUT_FD1 { \\
|
#define SHUT_FD1 { \\
|
||||||
if (fd1 >= 0) { \\
|
if (fd1 >= 0) { \\
|
||||||
shutdown (fd1, SHUT_RDWR); \\
|
shutdown(fd1, SHUT_RDWR); \\
|
||||||
close (fd1); \\
|
close(fd1); \\
|
||||||
fd1 = \-1; \\
|
fd1 = \-1; \\
|
||||||
} \\
|
} \\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SHUT_FD2 { \\
|
#define SHUT_FD2 { \\
|
||||||
if (fd2 >= 0) { \\
|
if (fd2 >= 0) { \\
|
||||||
shutdown (fd2, SHUT_RDWR); \\
|
shutdown(fd2, SHUT_RDWR); \\
|
||||||
close (fd2); \\
|
close(fd2); \\
|
||||||
fd2 = \-1; \\
|
fd2 = \-1; \\
|
||||||
} \\
|
} \\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BUF_SIZE 1024
|
#define BUF_SIZE 1024
|
||||||
|
|
||||||
int main (int argc, char **argv) {
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
int h;
|
int h;
|
||||||
int fd1 = \-1, fd2 = \-1;
|
int fd1 = \-1, fd2 = \-1;
|
||||||
char buf1[BUF_SIZE], buf2[BUF_SIZE];
|
char buf1[BUF_SIZE], buf2[BUF_SIZE];
|
||||||
|
@ -347,72 +348,70 @@ int main (int argc, char **argv) {
|
||||||
int buf2_avail, buf2_written;
|
int buf2_avail, buf2_written;
|
||||||
|
|
||||||
if (argc != 4) {
|
if (argc != 4) {
|
||||||
fprintf (stderr,
|
fprintf(stderr,
|
||||||
"Usage\\n\\tfwd <listen-port> \\
|
"Usage\\n\\tfwd <listen-port> "
|
||||||
<forward-to-port> <forward-to-ip-address>\\n");
|
"<forward-to-port> <forward-to-ip-address>\\n");
|
||||||
exit (1);
|
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)
|
if (h < 0)
|
||||||
exit (1);
|
exit(1);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int r, nfds = 0;
|
int r, nfds = 0;
|
||||||
fd_set rd, wr, er;
|
fd_set rd, wr, er;
|
||||||
FD_ZERO (&rd);
|
FD_ZERO(&rd);
|
||||||
FD_ZERO (&wr);
|
FD_ZERO(&wr);
|
||||||
FD_ZERO (&er);
|
FD_ZERO(&er);
|
||||||
FD_SET (h, &rd);
|
FD_SET(h, &rd);
|
||||||
nfds = max (nfds, h);
|
nfds = max(nfds, h);
|
||||||
if (fd1 > 0 && buf1_avail < BUF_SIZE) {
|
if (fd1 > 0 && buf1_avail < BUF_SIZE) {
|
||||||
FD_SET (fd1, &rd);
|
FD_SET(fd1, &rd);
|
||||||
nfds = max (nfds, fd1);
|
nfds = max(nfds, fd1);
|
||||||
}
|
}
|
||||||
if (fd2 > 0 && buf2_avail < BUF_SIZE) {
|
if (fd2 > 0 && buf2_avail < BUF_SIZE) {
|
||||||
FD_SET (fd2, &rd);
|
FD_SET(fd2, &rd);
|
||||||
nfds = max (nfds, fd2);
|
nfds = max(nfds, fd2);
|
||||||
}
|
}
|
||||||
if (fd1 > 0
|
if (fd1 > 0
|
||||||
&& buf2_avail \- buf2_written > 0) {
|
&& buf2_avail \- buf2_written > 0) {
|
||||||
FD_SET (fd1, &wr);
|
FD_SET(fd1, &wr);
|
||||||
nfds = max (nfds, fd1);
|
nfds = max(nfds, fd1);
|
||||||
}
|
}
|
||||||
if (fd2 > 0
|
if (fd2 > 0
|
||||||
&& buf1_avail \- buf1_written > 0) {
|
&& buf1_avail \- buf1_written > 0) {
|
||||||
FD_SET (fd2, &wr);
|
FD_SET(fd2, &wr);
|
||||||
nfds = max (nfds, fd2);
|
nfds = max(nfds, fd2);
|
||||||
}
|
}
|
||||||
if (fd1 > 0) {
|
if (fd1 > 0) {
|
||||||
FD_SET (fd1, &er);
|
FD_SET(fd1, &er);
|
||||||
nfds = max (nfds, fd1);
|
nfds = max(nfds, fd1);
|
||||||
}
|
}
|
||||||
if (fd2 > 0) {
|
if (fd2 > 0) {
|
||||||
FD_SET (fd2, &er);
|
FD_SET(fd2, &er);
|
||||||
nfds = max (nfds, fd2);
|
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)
|
if (r == \-1 && errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
perror ("select()");
|
perror("select()");
|
||||||
exit (1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (FD_ISSET (h, &rd)) {
|
if (FD_ISSET(h, &rd)) {
|
||||||
unsigned int l;
|
unsigned int l;
|
||||||
struct sockaddr_in client_address;
|
struct sockaddr_in client_address;
|
||||||
memset (&client_address, 0, l =
|
memset(&client_address, 0, l = sizeof(client_address));
|
||||||
sizeof (client_address));
|
r = accept(h, (struct sockaddr *) &client_address, &l);
|
||||||
r = accept (h, (struct sockaddr *)
|
|
||||||
&client_address, &l);
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
perror ("accept()");
|
perror("accept()");
|
||||||
} else {
|
} else {
|
||||||
SHUT_FD1;
|
SHUT_FD1;
|
||||||
SHUT_FD2;
|
SHUT_FD2;
|
||||||
|
@ -420,41 +419,39 @@ int main (int argc, char **argv) {
|
||||||
buf2_avail = buf2_written = 0;
|
buf2_avail = buf2_written = 0;
|
||||||
fd1 = r;
|
fd1 = r;
|
||||||
fd2 =
|
fd2 =
|
||||||
connect_socket (forward_port,
|
connect_socket(forward_port, argv[3]);
|
||||||
argv[3]);
|
|
||||||
if (fd2 < 0) {
|
if (fd2 < 0) {
|
||||||
SHUT_FD1;
|
SHUT_FD1;
|
||||||
} else
|
} else
|
||||||
printf ("connect from %s\\n",
|
printf("connect from %s\\n",
|
||||||
inet_ntoa
|
inet_ntoa(client_address.sin_addr));
|
||||||
(client_address.sin_addr));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* NB: read oob data before normal reads */
|
/* NB: read oob data before normal reads */
|
||||||
if (fd1 > 0)
|
if (fd1 > 0)
|
||||||
if (FD_ISSET (fd1, &er)) {
|
if (FD_ISSET(fd1, &er)) {
|
||||||
char c;
|
char c;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
r = recv (fd1, &c, 1, MSG_OOB);
|
r = recv(fd1, &c, 1, MSG_OOB);
|
||||||
if (r < 1) {
|
if (r < 1) {
|
||||||
SHUT_FD1;
|
SHUT_FD1;
|
||||||
} else
|
} else
|
||||||
send (fd2, &c, 1, MSG_OOB);
|
send(fd2, &c, 1, MSG_OOB);
|
||||||
}
|
}
|
||||||
if (fd2 > 0)
|
if (fd2 > 0)
|
||||||
if (FD_ISSET (fd2, &er)) {
|
if (FD_ISSET(fd2, &er)) {
|
||||||
char c;
|
char c;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
r = recv (fd2, &c, 1, MSG_OOB);
|
r = recv(fd2, &c, 1, MSG_OOB);
|
||||||
if (r < 1) {
|
if (r < 1) {
|
||||||
SHUT_FD1;
|
SHUT_FD1;
|
||||||
} else
|
} else
|
||||||
send (fd1, &c, 1, MSG_OOB);
|
send(fd1, &c, 1, MSG_OOB);
|
||||||
}
|
}
|
||||||
if (fd1 > 0)
|
if (fd1 > 0)
|
||||||
if (FD_ISSET (fd1, &rd)) {
|
if (FD_ISSET(fd1, &rd)) {
|
||||||
r =
|
r =
|
||||||
read (fd1, buf1 + buf1_avail,
|
read(fd1, buf1 + buf1_avail,
|
||||||
BUF_SIZE \- buf1_avail);
|
BUF_SIZE \- buf1_avail);
|
||||||
if (r < 1) {
|
if (r < 1) {
|
||||||
SHUT_FD1;
|
SHUT_FD1;
|
||||||
|
@ -462,9 +459,9 @@ int main (int argc, char **argv) {
|
||||||
buf1_avail += r;
|
buf1_avail += r;
|
||||||
}
|
}
|
||||||
if (fd2 > 0)
|
if (fd2 > 0)
|
||||||
if (FD_ISSET (fd2, &rd)) {
|
if (FD_ISSET(fd2, &rd)) {
|
||||||
r =
|
r =
|
||||||
read (fd2, buf2 + buf2_avail,
|
read(fd2, buf2 + buf2_avail,
|
||||||
BUF_SIZE \- buf2_avail);
|
BUF_SIZE \- buf2_avail);
|
||||||
if (r < 1) {
|
if (r < 1) {
|
||||||
SHUT_FD2;
|
SHUT_FD2;
|
||||||
|
@ -472,24 +469,20 @@ int main (int argc, char **argv) {
|
||||||
buf2_avail += r;
|
buf2_avail += r;
|
||||||
}
|
}
|
||||||
if (fd1 > 0)
|
if (fd1 > 0)
|
||||||
if (FD_ISSET (fd1, &wr)) {
|
if (FD_ISSET(fd1, &wr)) {
|
||||||
r =
|
r =
|
||||||
write (fd1,
|
write(fd1, buf2 + buf2_written,
|
||||||
buf2 + buf2_written,
|
buf2_avail \- buf2_written);
|
||||||
buf2_avail \-
|
|
||||||
buf2_written);
|
|
||||||
if (r < 1) {
|
if (r < 1) {
|
||||||
SHUT_FD1;
|
SHUT_FD1;
|
||||||
} else
|
} else
|
||||||
buf2_written += r;
|
buf2_written += r;
|
||||||
}
|
}
|
||||||
if (fd2 > 0)
|
if (fd2 > 0)
|
||||||
if (FD_ISSET (fd2, &wr)) {
|
if (FD_ISSET(fd2, &wr)) {
|
||||||
r =
|
r =
|
||||||
write (fd2,
|
write(fd2, buf1 + buf1_written,
|
||||||
buf1 + buf1_written,
|
buf1_avail \- buf1_written);
|
||||||
buf1_avail \-
|
|
||||||
buf1_written);
|
|
||||||
if (r < 1) {
|
if (r < 1) {
|
||||||
SHUT_FD2;
|
SHUT_FD2;
|
||||||
} else
|
} else
|
||||||
|
@ -502,12 +495,10 @@ int main (int argc, char **argv) {
|
||||||
buf2_written = buf2_avail = 0;
|
buf2_written = buf2_avail = 0;
|
||||||
/* one side has closed the connection, keep
|
/* one side has closed the connection, keep
|
||||||
writing to the other side until empty */
|
writing to the other side until empty */
|
||||||
if (fd1 < 0
|
if (fd1 < 0 && buf1_avail \- buf1_written == 0) {
|
||||||
&& buf1_avail \- buf1_written == 0) {
|
|
||||||
SHUT_FD2;
|
SHUT_FD2;
|
||||||
}
|
}
|
||||||
if (fd2 < 0
|
if (fd2 < 0 && buf2_avail \- buf2_written == 0) {
|
||||||
&& buf2_avail \- buf2_written == 0) {
|
|
||||||
SHUT_FD1;
|
SHUT_FD1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -625,7 +616,7 @@ follows:
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 200000; /* 0.2 seconds */
|
tv.tv_usec = 200000; /* 0.2 seconds */
|
||||||
select (0, NULL, NULL, NULL, &tv);
|
select(0, NULL, NULL, NULL, &tv);
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
This is only guaranteed to work on Unix systems, however.
|
This is only guaranteed to work on Unix systems, however.
|
||||||
|
|
|
@ -34,7 +34,6 @@ The kernel keeps for each process two values called
|
||||||
and
|
and
|
||||||
.I clear_child_tid
|
.I clear_child_tid
|
||||||
that are NULL by default.
|
that are NULL by default.
|
||||||
|
|
||||||
.SS set_child_tid
|
.SS set_child_tid
|
||||||
If a process is started using
|
If a process is started using
|
||||||
.BR clone (2)
|
.BR clone (2)
|
||||||
|
@ -50,7 +49,6 @@ When
|
||||||
.I set_child_tid
|
.I set_child_tid
|
||||||
is set, the very first thing the new process does
|
is set, the very first thing the new process does
|
||||||
is writing its PID at this address.
|
is writing its PID at this address.
|
||||||
|
|
||||||
.SS clear_child_tid
|
.SS clear_child_tid
|
||||||
If a process is started using
|
If a process is started using
|
||||||
.BR clone (2)
|
.BR clone (2)
|
||||||
|
|
|
@ -44,7 +44,6 @@ real user ID, the effective user ID or the saved set-user-ID.
|
||||||
Precisely the same holds for
|
Precisely the same holds for
|
||||||
.BR setegid ()
|
.BR setegid ()
|
||||||
with "group" instead of "user".
|
with "group" instead of "user".
|
||||||
|
|
||||||
.\" When
|
.\" When
|
||||||
.\" .I euid
|
.\" .I euid
|
||||||
.\" equals \-1, nothing is changed.
|
.\" equals \-1, nothing is changed.
|
||||||
|
|
|
@ -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
|
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
|
SIGHUP signal followed by a SIGCONT signal will be sent to each process
|
||||||
in the newly-orphaned process group.
|
in the newly-orphaned process group.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success,
|
On success,
|
||||||
.BR setpgid ()
|
.BR setpgid ()
|
||||||
|
|
|
@ -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
|
of the current process (and always modifies the file system GID
|
||||||
to be the same as the effective GID),
|
to be the same as the effective GID),
|
||||||
with the same restrictions for non-privileged processes.
|
with the same restrictions for non-privileged processes.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success, zero is returned. On error, \-1 is returned, and
|
On success, zero is returned. On error, \-1 is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
|
|
|
@ -76,7 +76,6 @@ Completely analogously,
|
||||||
.BR setregid ()
|
.BR setregid ()
|
||||||
sets real and effective group ID's of the current process,
|
sets real and effective group ID's of the current process,
|
||||||
and all of the above holds with "group" instead of "user".
|
and all of the above holds with "group" instead of "user".
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success, zero is returned. On error, \-1 is returned, and
|
On success, zero is returned. On error, \-1 is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
|
|
|
@ -210,7 +210,6 @@ struct shm_info {
|
||||||
unsigned long swap_attempts; /* Unused since Linux 2.4 */
|
unsigned long swap_attempts; /* Unused since Linux 2.4 */
|
||||||
unsigned long swap_successes; /* Unused since Linux 2.4 */
|
unsigned long swap_successes; /* Unused since Linux 2.4 */
|
||||||
};
|
};
|
||||||
|
|
||||||
.in -2n
|
.in -2n
|
||||||
.fi
|
.fi
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -361,7 +361,6 @@ POLL_ERR:i/o error
|
||||||
POLL_PRI:high priority input available
|
POLL_PRI:high priority input available
|
||||||
POLL_HUP:device disconnected
|
POLL_HUP:device disconnected
|
||||||
.TE
|
.TE
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
.BR sigaction ()
|
.BR sigaction ()
|
||||||
returns 0 on success and \-1 on error.
|
returns 0 on success and \-1 on error.
|
||||||
|
|
|
@ -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.
|
prescribes the synonyms S_IRUSR, S_IWUSR, S_IXUSR.
|
||||||
.SH "OTHER SYSTEMS"
|
.SH "OTHER SYSTEMS"
|
||||||
Values that have been (or are) in use on various systems:
|
Values that have been (or are) in use on various systems:
|
||||||
.P
|
|
||||||
.TS
|
.TS
|
||||||
l l l l l.
|
l l l l l.
|
||||||
hex name ls octal description
|
hex name ls octal description
|
||||||
|
|
|
@ -174,7 +174,6 @@ is not a directory.
|
||||||
.TP
|
.TP
|
||||||
.B EOVERFLOW
|
.B EOVERFLOW
|
||||||
Some values were too large to be represented in the returned struct.
|
Some values were too large to be represented in the returned struct.
|
||||||
.PP
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
Linux specific.
|
Linux specific.
|
||||||
The Linux
|
The Linux
|
||||||
|
|
|
@ -46,7 +46,7 @@ is a pointer to a
|
||||||
structure defined approximately as follows:
|
structure defined approximately as follows:
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
struct statvfs {
|
struct statvfs {
|
||||||
unsigned long f_bsize; /* file system block size */
|
unsigned long f_bsize; /* file system block size */
|
||||||
unsigned long f_frsize; /* fragment size */
|
unsigned long f_frsize; /* fragment size */
|
||||||
fsblkcnt_t f_blocks; /* size of fs in f_frsize units */
|
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_fsid; /* file system ID */
|
||||||
unsigned long f_flag; /* mount flags */
|
unsigned long f_flag; /* mount flags */
|
||||||
unsigned long f_namemax; /* maximum filename length */
|
unsigned long f_namemax; /* maximum filename length */
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
Here the types
|
Here the types
|
||||||
|
@ -83,7 +83,6 @@ Read-only file system.
|
||||||
Set-user-ID/set-group-ID bits are ignored by
|
Set-user-ID/set-group-ID bits are ignored by
|
||||||
.BR exec (2).
|
.BR exec (2).
|
||||||
.LP
|
.LP
|
||||||
|
|
||||||
It is unspecified whether all members of the returned struct
|
It is unspecified whether all members of the returned struct
|
||||||
have meaningful values on all filesystems.
|
have meaningful values on all filesystems.
|
||||||
|
|
||||||
|
@ -150,7 +149,6 @@ is not a directory.
|
||||||
.TP
|
.TP
|
||||||
.B EOVERFLOW
|
.B EOVERFLOW
|
||||||
Some values were too large to be represented in the returned struct.
|
Some values were too large to be represented in the returned struct.
|
||||||
.PP
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
POSIX.1-2001
|
POSIX.1-2001
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
|
|
|
@ -51,13 +51,13 @@ or the maximum number of open files. The argument has the form
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
struct __sysctl_args {
|
struct __sysctl_args {
|
||||||
int *name; /* integer vector describing variable */
|
int *name; /* integer vector describing variable */
|
||||||
int nlen; /* length of this vector */
|
int nlen; /* length of this vector */
|
||||||
void *oldval; /* 0 or address where to store old value */
|
void *oldval; /* 0 or address where to store old value */
|
||||||
size_t *oldlenp; /* available room for old value,
|
size_t *oldlenp; /* available room for old value,
|
||||||
overwritten by actual size of old value */
|
overwritten by actual size of old value */
|
||||||
void *newval; /* 0 or address of new value */
|
void *newval; /* 0 or address of new value */
|
||||||
size_t newlen; /* size of new value */
|
size_t newlen; /* size of new value */
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
|
@ -66,7 +66,6 @@ a directory tree under
|
||||||
.IR /proc/sys ,
|
.IR /proc/sys ,
|
||||||
and if the requested item is found calls some appropriate routine
|
and if the requested item is found calls some appropriate routine
|
||||||
to read or modify the value.
|
to read or modify the value.
|
||||||
|
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.nf
|
||||||
#include <linux/unistd.h>
|
#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,
|
int sysctl(int *name, int nlen, void *oldval, size_t *oldlenp,
|
||||||
void *newval, size_t newlen)
|
void *newval, size_t newlen)
|
||||||
{
|
{
|
||||||
struct __sysctl_args args={name,nlen,oldval,oldlenp,newval,newlen};
|
struct __sysctl_args args = { name, nlen, oldval, oldlenp,
|
||||||
return _sysctl(&args);
|
newval, newlen };
|
||||||
|
return _sysctl(&args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SIZE(x) sizeof(x)/sizeof(x[0])
|
#define SIZE(x) sizeof(x)/sizeof(x[0])
|
||||||
|
@ -88,16 +88,17 @@ char osname[OSNAMESZ];
|
||||||
int osnamelth;
|
int osnamelth;
|
||||||
int name[] = { CTL_KERN, KERN_OSTYPE };
|
int name[] = { CTL_KERN, KERN_OSTYPE };
|
||||||
|
|
||||||
main(){
|
int
|
||||||
osnamelth = sizeof(osname);
|
main(void)
|
||||||
if (sysctl(name, SIZE(name), osname, &osnamelth, 0, 0))
|
{
|
||||||
perror("sysctl");
|
osnamelth = sizeof(osname);
|
||||||
else
|
if (sysctl(name, SIZE(name), osname, &osnamelth, 0, 0))
|
||||||
printf("This machine is running %*s\en", osnamelth, osname);
|
perror("sysctl");
|
||||||
return 0;
|
else
|
||||||
|
printf("This machine is running %*s\en", osnamelth, osname);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
Upon successful completion,
|
Upon successful completion,
|
||||||
.BR _sysctl ()
|
.BR _sysctl ()
|
||||||
|
|
|
@ -39,7 +39,6 @@ the kernel. The specific form of the
|
||||||
call and the information returned depends on the
|
call and the information returned depends on the
|
||||||
.I option
|
.I option
|
||||||
in effect:
|
in effect:
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B 1
|
.B 1
|
||||||
Translate the file-system identifier string
|
Translate the file-system identifier string
|
||||||
|
@ -59,7 +58,6 @@ has enough space to accept the string.
|
||||||
.B 3
|
.B 3
|
||||||
Return the total number of file system types currently present in the
|
Return the total number of file system types currently present in the
|
||||||
kernel.
|
kernel.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
The numbering of the file-system type indexes begins with zero.
|
The numbering of the file-system type indexes begins with zero.
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
|
@ -87,7 +85,6 @@ is not a valid file-system type identifier;
|
||||||
is out-of-bounds;
|
is out-of-bounds;
|
||||||
.I option
|
.I option
|
||||||
is invalid.
|
is invalid.
|
||||||
.PP
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
SVr4.
|
SVr4.
|
||||||
.SH NOTE
|
.SH NOTE
|
||||||
|
|
|
@ -154,7 +154,6 @@ as follows:
|
||||||
#define KERN_INFO "<6>" /* informational */
|
#define KERN_INFO "<6>" /* informational */
|
||||||
#define KERN_DEBUG "<7>" /* debug-level messages */
|
#define KERN_DEBUG "<7>" /* debug-level messages */
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
In case of error, \-1 is returned, and \fIerrno\fP is set. Otherwise,
|
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
|
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 .
|
.BR SYS_klog .
|
||||||
In glibc 2.0 the syscall is baptised
|
In glibc 2.0 the syscall is baptised
|
||||||
.BR klogctl ().
|
.BR klogctl ().
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR syslog (3)
|
.BR syslog (3)
|
||||||
|
|
|
@ -61,6 +61,5 @@ Some system calls, like
|
||||||
and
|
and
|
||||||
.BR delete_module (2)
|
.BR delete_module (2)
|
||||||
only exist when the Linux kernel was built with support for them.
|
only exist when the Linux kernel was built with support for them.
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR obsolete (2)
|
.BR obsolete (2)
|
||||||
|
|
|
@ -51,7 +51,6 @@ In addition to all of the error codes returned by
|
||||||
and
|
and
|
||||||
.BR mmap (2),
|
.BR mmap (2),
|
||||||
the following may also be returned:
|
the following may also be returned:
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B EACCES
|
.B EACCES
|
||||||
The library specified by
|
The library specified by
|
||||||
|
|
17
man2/ustat.2
17
man2/ustat.2
|
@ -44,23 +44,18 @@ returns information about a mounted file system.
|
||||||
is a device number identifying a device containing
|
is a device number identifying a device containing
|
||||||
a mounted file system.
|
a mounted file system.
|
||||||
.I ubuf
|
.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:
|
members:
|
||||||
|
|
||||||
.sp
|
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
.ne 7
|
|
||||||
.ta 8n 16n 32n
|
daddr_t f_tfree; /* Total free blocks */
|
||||||
daddr_t f_tfree; /* Total free blocks */
|
ino_t f_tinode; /* Number of free inodes */
|
||||||
ino_t f_tinode; /* Number of free inodes */
|
char f_fname[6]; /* Filsys name */
|
||||||
char f_fname[6]; /* Filsys name */
|
char f_fpack[6]; /* Filsys pack name */
|
||||||
char f_fpack[6]; /* Filsys pack name */
|
|
||||||
.ta
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
The last two fields, f_fname and f_fpack, are not implemented and will
|
The last two fields, f_fname and f_fpack, are not implemented and will
|
||||||
always be filled with null bytes ('\\0').
|
always be filled with null bytes ('\\0').
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
|
|
|
@ -519,7 +519,6 @@ killed by signal 15
|
||||||
[1]+ Done ./a.out
|
[1]+ Done ./a.out
|
||||||
$
|
$
|
||||||
|
|
||||||
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
@ -60,7 +60,6 @@ The macros
|
||||||
.BR HUGE_VALL
|
.BR HUGE_VALL
|
||||||
expand to constants of types double, float and long double, respectively,
|
expand to constants of types double, float and long double, respectively,
|
||||||
that represent a large positive value, possibly plus infinity.
|
that represent a large positive value, possibly plus infinity.
|
||||||
|
|
||||||
.SH AVAILABILITY
|
.SH AVAILABILITY
|
||||||
On a glibc system, the macro HUGE_VAL is always available.
|
On a glibc system, the macro HUGE_VAL is always available.
|
||||||
Availability of the NAN macro can be tested using
|
Availability of the NAN macro can be tested using
|
||||||
|
@ -70,7 +69,6 @@ They will be defined by
|
||||||
.I <math.h>
|
.I <math.h>
|
||||||
if _ISOC99_SOURCE or _GNU_SOURCE is defined, or __STDC_VERSION__ is defined
|
if _ISOC99_SOURCE or _GNU_SOURCE is defined, or __STDC_VERSION__ is defined
|
||||||
and has a value not less than 199901L.
|
and has a value not less than 199901L.
|
||||||
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
C99
|
C99
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
|
|
|
@ -8,7 +8,6 @@ __setfpucw \- set fpu control word on i386 architecture (obsolete)
|
||||||
.B #include <i386/fpu_control.h>
|
.B #include <i386/fpu_control.h>
|
||||||
.sp
|
.sp
|
||||||
.BI "void __setfpucw((unsigned short) " control_word );
|
.BI "void __setfpucw((unsigned short) " control_word );
|
||||||
.br
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.BR __setfpucw ()
|
.BR __setfpucw ()
|
||||||
transfers
|
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
|
was used to control floating point precision, rounding and floating point
|
||||||
exceptions.
|
exceptions.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
|
|
||||||
.BR __setfpucw(0x1372)
|
.BR __setfpucw(0x1372)
|
||||||
|
|
||||||
Set fpu control word on i386 architecture to
|
Set fpu control word on i386 architecture to
|
||||||
|
@ -27,7 +25,6 @@ Set fpu control word on i386 architecture to
|
||||||
\- rounding to nearest
|
\- rounding to nearest
|
||||||
.br
|
.br
|
||||||
\- exceptions on overflow, zero divide and NaN
|
\- exceptions on overflow, zero divide and NaN
|
||||||
.br
|
|
||||||
.SH AVAILABILITY
|
.SH AVAILABILITY
|
||||||
As of glibc 2.1 this function does not exist anymore.
|
As of glibc 2.1 this function does not exist anymore.
|
||||||
There are new functions from C99, with prototypes in
|
There are new functions from C99, with prototypes in
|
||||||
|
|
|
@ -12,7 +12,6 @@ a64l, l64a \- convert between long and base-64
|
||||||
.BI "long a64l(char *" str64 );
|
.BI "long a64l(char *" str64 );
|
||||||
.sp
|
.sp
|
||||||
.BI "char *l64a(long " value );
|
.BI "char *l64a(long " value );
|
||||||
.sp
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
These functions provide a conversion between 32-bit long integers
|
These functions provide a conversion between 32-bit long integers
|
||||||
and little-endian base-64 ASCII strings (of length zero to six).
|
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:
|
The 64 digits in the base 64 system are:
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
\&'.' represents a 0
|
\&'.' represents a 0
|
||||||
\&'/' represents a 1
|
\&'/' represents a 1
|
||||||
0-9 represent 2-11
|
0-9 represent 2-11
|
||||||
A-Z represent 12-37
|
A-Z represent 12-37
|
||||||
a-z represent 38-63
|
a-z represent 38-63
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
.br
|
|
||||||
So 123 = 59*64^0 + 1*64^1 = "v/".
|
So 123 = 59*64^0 + 1*64^1 = "v/".
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
The value returned by
|
The value returned by
|
||||||
|
|
|
@ -102,7 +102,6 @@ The buffer area being read into
|
||||||
.\" or the control block of the operation
|
.\" or the control block of the operation
|
||||||
must not be accessed during the operation or undefined results may
|
must not be accessed during the operation or undefined results may
|
||||||
occur. The memory areas involved must remain valid.
|
occur. The memory areas involved must remain valid.
|
||||||
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
POSIX.1-2001
|
POSIX.1-2001
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
|
|
|
@ -95,7 +95,6 @@ are invalid.
|
||||||
.TP
|
.TP
|
||||||
.B ENOSYS
|
.B ENOSYS
|
||||||
This function is not supported.
|
This function is not supported.
|
||||||
|
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
It is a good idea to zero out the control block before use.
|
It is a good idea to zero out the control block before use.
|
||||||
This control block must not be changed while the write operation
|
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
|
.\" or the control block of the operation
|
||||||
must not be accessed during the operation or undefined results may
|
must not be accessed during the operation or undefined results may
|
||||||
occur. The memory areas involved must remain valid.
|
occur. The memory areas involved must remain valid.
|
||||||
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
POSIX.1-2001
|
POSIX.1-2001
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
|
|
|
@ -66,23 +66,27 @@ it returns a non-zero value.
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
void bye(void) {
|
void
|
||||||
printf("That was all, folks\en");
|
bye(void)
|
||||||
|
{
|
||||||
|
printf("That was all, folks\en");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(){
|
int
|
||||||
long a;
|
main(void)
|
||||||
int i;
|
{
|
||||||
|
long a;
|
||||||
|
int i;
|
||||||
|
|
||||||
a = sysconf(_SC_ATEXIT_MAX);
|
a = sysconf(_SC_ATEXIT_MAX);
|
||||||
printf("ATEXIT_MAX = %ld\en", a);
|
printf("ATEXIT_MAX = %ld\en", a);
|
||||||
|
|
||||||
i = atexit(bye);
|
i = atexit(bye);
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
fprintf(stderr, "cannot set exit function\en");
|
fprintf(stderr, "cannot set exit function\en");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
|
|
|
@ -17,7 +17,6 @@ The call
|
||||||
.I canonicalize_file_name(path)
|
.I canonicalize_file_name(path)
|
||||||
is equivalent to the call
|
is equivalent to the call
|
||||||
.IR "realpath(path,\ NULL)" .
|
.IR "realpath(path,\ NULL)" .
|
||||||
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
The function is a GNU extension.
|
The function is a GNU extension.
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
|
|
|
@ -103,7 +103,6 @@ closes the message catalog identified by
|
||||||
It invalidates any subsequent references to the message catalog
|
It invalidates any subsequent references to the message catalog
|
||||||
defined by
|
defined by
|
||||||
.IR catalog .
|
.IR catalog .
|
||||||
.LP
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
The function
|
The function
|
||||||
.BR catopen ()
|
.BR catopen ()
|
||||||
|
|
|
@ -56,7 +56,6 @@ The declaration is sometimes in
|
||||||
.I <stdlib.h>
|
.I <stdlib.h>
|
||||||
and sometimes in
|
and sometimes in
|
||||||
.IR <malloc.h> .
|
.IR <malloc.h> .
|
||||||
.LP
|
|
||||||
.SS "3-arg cfree"
|
.SS "3-arg cfree"
|
||||||
Some SCO and Solaris versions have malloc libraries with a 3-argument
|
Some SCO and Solaris versions have malloc libraries with a 3-argument
|
||||||
.BR cfree (),
|
.BR cfree (),
|
||||||
|
|
|
@ -35,16 +35,13 @@ The \fBclearenv\fP() function clears the environment of all name-value
|
||||||
pairs and sets the value of the external variable
|
pairs and sets the value of the external variable
|
||||||
.I environ
|
.I environ
|
||||||
to NULL.
|
to NULL.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
The \fBclearenv\fP() function returns zero on success, and a non-zero
|
The \fBclearenv\fP() function returns zero on success, and a non-zero
|
||||||
value on failure.
|
value on failure.
|
||||||
.\" Most versions of Unix return -1 on error, or do not even have errors.
|
.\" 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".
|
.\" Glibc info and the Watcom C library document "a non-zero value".
|
||||||
|
|
||||||
.SH AVAILABILITY
|
.SH AVAILABILITY
|
||||||
Not in libc4, libc5. In glibc since glibc 2.0.
|
Not in libc4, libc5. In glibc since glibc 2.0.
|
||||||
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
Various Unix variants (DG/UX, HP-UX, QNX, ...).
|
Various Unix variants (DG/UX, HP-UX, QNX, ...).
|
||||||
POSIX.9 (bindings for FORTRAN77).
|
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).
|
later issue of this standard (cf. B.4.6.1).
|
||||||
However, POSIX.1-2001
|
However, POSIX.1-2001
|
||||||
only adds \fIputenv\fP(), and rejected \fBclearenv\fP().
|
only adds \fIputenv\fP(), and rejected \fBclearenv\fP().
|
||||||
|
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
Used in security-conscious applications. If it is unavailable
|
Used in security-conscious applications. If it is unavailable
|
||||||
the assignment
|
the assignment
|
||||||
|
|
13
man3/cmsg.3
13
man3/cmsg.3
|
@ -9,8 +9,7 @@
|
||||||
CMSG_ALIGN, CMSG_SPACE, CMSG_NXTHDR, CMSG_FIRSTHDR \- Access ancillary data
|
CMSG_ALIGN, CMSG_SPACE, CMSG_NXTHDR, CMSG_FIRSTHDR \- Access ancillary data
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B #include <sys/socket.h>
|
.B #include <sys/socket.h>
|
||||||
.br
|
.sp
|
||||||
.sp 2
|
|
||||||
.BI "struct cmsghdr *CMSG_FIRSTHDR(struct msghdr *" msgh );
|
.BI "struct cmsghdr *CMSG_FIRSTHDR(struct msghdr *" msgh );
|
||||||
.br
|
.br
|
||||||
.BI "struct cmsghdr *CMSG_NXTHDR(struct msghdr *" msgh ", struct cmsghdr *" cmsg );
|
.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 );
|
.BI "unsigned char *CMSG_DATA(struct cmsghdr *" cmsg );
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
.ta 8n 20n 32n
|
|
||||||
struct cmsghdr {
|
struct cmsghdr {
|
||||||
socklen_t cmsg_len; /* data byte count, including header */
|
socklen_t cmsg_len; /* data byte count, including header */
|
||||||
int cmsg_level; /* originating protocol */
|
int cmsg_level; /* originating protocol */
|
||||||
int cmsg_type; /* protocol-specific type */
|
int cmsg_type; /* protocol-specific type */
|
||||||
/* followed by unsigned char cmsg_data[]; */
|
/* followed by unsigned char cmsg_data[]; */
|
||||||
};
|
};
|
||||||
.ta
|
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
These macros are used to create and access control messages (also called
|
These macros are used to create and access control messages (also called
|
||||||
|
|
|
@ -95,7 +95,6 @@ the parameter
|
||||||
is the 8-byte initialization
|
is the 8-byte initialization
|
||||||
vector for the chaining. It is updated to the next initialization
|
vector for the chaining. It is updated to the next initialization
|
||||||
vector upon return.
|
vector upon return.
|
||||||
.LP
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR des (1),
|
.BR des (1),
|
||||||
.BR crypt (3)
|
.BR crypt (3)
|
||||||
|
@ -125,7 +124,6 @@ the macro
|
||||||
.\" .BR ( stat )
|
.\" .BR ( stat )
|
||||||
.BI DES_FAILED( stat )
|
.BI DES_FAILED( stat )
|
||||||
is false only for the first two statuses.
|
is false only for the first two statuses.
|
||||||
|
|
||||||
.\" So far the Sun page
|
.\" So far the Sun page
|
||||||
.\" Some additions - aeb
|
.\" Some additions - aeb
|
||||||
.SH AVAILABILITY
|
.SH AVAILABILITY
|
||||||
|
|
|
@ -345,7 +345,6 @@ The function
|
||||||
does the same as
|
does the same as
|
||||||
.BR dlsym ()
|
.BR dlsym ()
|
||||||
but takes a version string as an additional argument.
|
but takes a version string as an additional argument.
|
||||||
|
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
Load the math library, and print the cosine of 2.0:
|
Load the math library, and print the cosine of 2.0:
|
||||||
.RS
|
.RS
|
||||||
|
@ -356,14 +355,16 @@ Load the math library, and print the cosine of 2.0:
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
void *handle;
|
void *handle;
|
||||||
double (*cosine)(double);
|
double (*cosine)(double);
|
||||||
char *error;
|
char *error;
|
||||||
|
|
||||||
handle = dlopen ("libm.so", RTLD_LAZY);
|
handle = dlopen("libm.so", RTLD_LAZY);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
fprintf (stderr, "%s\en", dlerror());
|
fprintf(stderr, "%s\en", dlerror());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,11 +373,11 @@ int main(int argc, char **argv) {
|
||||||
.\" the dlsym() casting problem
|
.\" the dlsym() casting problem
|
||||||
*(void **) (&cosine) = dlsym(handle, "cos");
|
*(void **) (&cosine) = dlsym(handle, "cos");
|
||||||
if ((error = dlerror()) != NULL) {
|
if ((error = dlerror()) != NULL) {
|
||||||
fprintf (stderr, "%s\en", error);
|
fprintf(stderr, "%s\en", error);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("%f\en", (*cosine)(2.0));
|
printf("%f\en", (*cosine)(2.0));
|
||||||
dlclose(handle);
|
dlclose(handle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ dysize \- get number of days for a given year
|
||||||
.BR "#include <time.h>"
|
.BR "#include <time.h>"
|
||||||
.sp
|
.sp
|
||||||
.BI "int dysize(int " year );
|
.BI "int dysize(int " year );
|
||||||
.sp
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The function returns 365 for a normal year and 366 for a leap year.
|
The function returns 365 for a normal year and 366 for a leap year.
|
||||||
The calculation for leap year is based on:
|
The calculation for leap year is based on:
|
||||||
|
|
|
@ -118,12 +118,15 @@ and
|
||||||
.nf
|
.nf
|
||||||
#include <crypt.h>
|
#include <crypt.h>
|
||||||
|
|
||||||
main() {
|
int
|
||||||
char key[64]; /* bit pattern for key */
|
main(void)
|
||||||
char txt[64]; /* bit pattern for messages */
|
{
|
||||||
setkey(key);
|
char key[64]; /* bit pattern for key */
|
||||||
encrypt(txt, 0); /* encode */
|
char txt[64]; /* bit pattern for messages */
|
||||||
encrypt(txt, 1); /* decode */
|
|
||||||
|
setkey(key);
|
||||||
|
encrypt(txt, 0); /* encode */
|
||||||
|
encrypt(txt, 1); /* decode */
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.SH "NOTE"
|
.SH "NOTE"
|
||||||
|
|
|
@ -33,7 +33,6 @@ envz_remove, envz_strip \- environment string support
|
||||||
.sp
|
.sp
|
||||||
.BI "void"
|
.BI "void"
|
||||||
.BI "envz_strip(char **" envz ", size_t *" envz_len );
|
.BI "envz_strip(char **" envz ", size_t *" envz_len );
|
||||||
.sp
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
These functions are glibc-specific.
|
These functions are glibc-specific.
|
||||||
.LP
|
.LP
|
||||||
|
@ -117,19 +116,21 @@ if an allocation error occurs.
|
||||||
.nf
|
.nf
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <envz.h>
|
#include <envz.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[], char *envp[]) {
|
main(int argc, char *argv[], char *envp[])
|
||||||
int i, e_len = 0;
|
{
|
||||||
char *str;
|
int i, e_len = 0;
|
||||||
|
char *str;
|
||||||
|
|
||||||
for (i=0; envp[i] != NULL; i++)
|
for (i=0; envp[i] != NULL; i++)
|
||||||
e_len += strlen(envp[i]) + 1;
|
e_len += strlen(envp[i]) + 1;
|
||||||
|
|
||||||
str = envz_entry(*envp, e_len, "HOME");
|
str = envz_entry(*envp, e_len, "HOME");
|
||||||
printf("%s\en", str);
|
printf("%s\en", str);
|
||||||
str = envz_get(*envp, e_len, "HOME");
|
str = envz_get(*envp, e_len, "HOME");
|
||||||
printf("%s\en", str);
|
printf("%s\en", str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
|
|
|
@ -63,7 +63,6 @@ The
|
||||||
.BR isinf ()
|
.BR isinf ()
|
||||||
functions return 1 if \fIx\fP is plus infinity, \-1 is \fIx\fP
|
functions return 1 if \fIx\fP is plus infinity, \-1 is \fIx\fP
|
||||||
is minus infinity, and 0 otherwise.
|
is minus infinity, and 0 otherwise.
|
||||||
|
|
||||||
.SH NOTE
|
.SH NOTE
|
||||||
Note that these functions are obsolete. C99 defines macros
|
Note that these functions are obsolete. C99 defines macros
|
||||||
isfinite(), isinf() and isnan() (for all types) replacing them.
|
isfinite(), isinf() and isnan() (for all types) replacing them.
|
||||||
|
|
|
@ -141,7 +141,6 @@ pointer.
|
||||||
Otherwise, NULL is returned and the global variable
|
Otherwise, NULL is returned and the global variable
|
||||||
.I errno
|
.I errno
|
||||||
is set to indicate the error.
|
is set to indicate the error.
|
||||||
|
|
||||||
.SH "EXAMPLE"
|
.SH "EXAMPLE"
|
||||||
The program below uses
|
The program below uses
|
||||||
.BR fmemopen ()
|
.BR fmemopen ()
|
||||||
|
@ -163,7 +162,8 @@ size=11; ptr=1 529 1849
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
FILE *out, *in;
|
FILE *out, *in;
|
||||||
int v, s;
|
int v, s;
|
||||||
|
@ -193,7 +193,6 @@ int main(int argc, char *argv[])
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.sp
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
These functions are GNU extensions.
|
These functions are GNU extensions.
|
||||||
.\" Jan 06: But they appear to be going up for standardization by
|
.\" Jan 06: But they appear to be going up for standardization by
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
fmtmsg \- print formatted error messages
|
fmtmsg \- print formatted error messages
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
.sp
|
|
||||||
.B #include <fmtmsg.h>
|
.B #include <fmtmsg.h>
|
||||||
.sp
|
.sp
|
||||||
.BI "int fmtmsg(long " classification ", const char *" label ,
|
.BI "int fmtmsg(long " classification ", const char *" label ,
|
||||||
|
@ -19,7 +18,6 @@ fmtmsg \- print formatted error messages
|
||||||
.BI " int " severity ", const char *" text ,
|
.BI " int " severity ", const char *" text ,
|
||||||
.br
|
.br
|
||||||
.BI " const char *" action ", const char *" tag );
|
.BI " const char *" action ", const char *" tag );
|
||||||
.sp
|
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
This function displays a message described by its parameters on the device(s)
|
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 <stdio.h>
|
||||||
#include <fmtmsg.h>
|
#include <fmtmsg.h>
|
||||||
|
|
||||||
int main() {
|
int
|
||||||
long class = MM_PRINT | MM_SOFT | MM_OPSYS | MM_RECOVER;
|
main(void)
|
||||||
int err;
|
{
|
||||||
err = fmtmsg(class, "util-linux:mount", MM_ERROR,
|
long class = MM_PRINT | MM_SOFT | MM_OPSYS | MM_RECOVER;
|
||||||
"unknown mount option", "See mount(8).", "util-linux:mount:017");
|
int err;
|
||||||
switch(err) {
|
err = fmtmsg(class, "util-linux:mount", MM_ERROR,
|
||||||
|
"unknown mount option", "See mount(8).",
|
||||||
|
"util-linux:mount:017");
|
||||||
|
switch(err) {
|
||||||
case MM_OK:
|
case MM_OK:
|
||||||
break;
|
break;
|
||||||
case MM_NOTOK:
|
case MM_NOTOK:
|
||||||
printf("Nothing printed\en");
|
printf("Nothing printed\en");
|
||||||
break;
|
break;
|
||||||
case MM_NOMSG:
|
case MM_NOMSG:
|
||||||
printf("Nothing printed to stderr\en");
|
printf("Nothing printed to stderr\en");
|
||||||
break;
|
break;
|
||||||
case MM_NOCON:
|
case MM_NOCON:
|
||||||
printf("No console output\en");
|
printf("No console output\en");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unknown error from fmtmsg()\en");
|
printf("Unknown error from fmtmsg()\en");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -19,7 +19,6 @@ Link with \-lm.
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
For the definition of the Gamma function, see
|
For the definition of the Gamma function, see
|
||||||
.BR tgamma (3).
|
.BR tgamma (3).
|
||||||
.PP
|
|
||||||
.SS "*BSD version"
|
.SS "*BSD version"
|
||||||
4.4BSD and FreeBSD libm have a
|
4.4BSD and FreeBSD libm have a
|
||||||
.BR gamma ()
|
.BR gamma ()
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
.TH GETDATE 3 2001-12-26 "" "Linux Programmer's Manual"
|
.TH GETDATE 3 2001-12-26 "" "Linux Programmer's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
getdate \- convert a string to struct tm
|
getdate \- convert a string to struct tm
|
||||||
.br
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B "#define _XOPEN_SOURCE"
|
.B "#define _XOPEN_SOURCE"
|
||||||
.br
|
.br
|
||||||
|
@ -35,13 +34,12 @@ getdate \- convert a string to struct tm
|
||||||
.BI "struct tm *getdate(const char *" string );
|
.BI "struct tm *getdate(const char *" string );
|
||||||
.sp
|
.sp
|
||||||
.BI "extern int getdate_err;"
|
.BI "extern int getdate_err;"
|
||||||
.sp 2
|
.sp
|
||||||
.B "#define _GNU_SOURCE"
|
.B "#define _GNU_SOURCE"
|
||||||
.br
|
.br
|
||||||
.B "#include <time.h>"
|
.B "#include <time.h>"
|
||||||
.sp
|
.sp
|
||||||
.BI "int getdate_r (const char *" string ", struct tm *" res );
|
.BI "int getdate_r (const char *" string ", struct tm *" res );
|
||||||
.br
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The function
|
The function
|
||||||
.BR getdate ()
|
.BR getdate ()
|
||||||
|
|
|
@ -123,7 +123,6 @@ and
|
||||||
.BR getfsspec ()
|
.BR getfsspec ()
|
||||||
only return the first occurrence, these two functions are not suitable
|
only return the first occurrence, these two functions are not suitable
|
||||||
for use under Linux.
|
for use under Linux.
|
||||||
.LP
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR getmntent (3),
|
.BR getmntent (3),
|
||||||
.BR fstab (5)
|
.BR fstab (5)
|
||||||
|
|
|
@ -58,10 +58,10 @@ as follows:
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
struct group {
|
struct group {
|
||||||
char *gr_name; /* group name */
|
char *gr_name; /* group name */
|
||||||
char *gr_passwd; /* group password */
|
char *gr_passwd; /* group password */
|
||||||
gid_t gr_gid; /* group ID */
|
gid_t gr_gid; /* group ID */
|
||||||
char **gr_mem; /* group members */
|
char **gr_mem; /* group members */
|
||||||
};
|
};
|
||||||
.ta
|
.ta
|
||||||
.fi
|
.fi
|
||||||
|
@ -104,26 +104,28 @@ Insufficient buffer space supplied. Try again with larger buffer.
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define BUFLEN 4096
|
#define BUFLEN 4096
|
||||||
|
|
||||||
int main() {
|
int
|
||||||
struct group grp, *grpp;
|
main(void)
|
||||||
char buf[BUFLEN];
|
{
|
||||||
int i;
|
struct group grp, *grpp;
|
||||||
|
char buf[BUFLEN];
|
||||||
|
int i;
|
||||||
|
|
||||||
setgrent();
|
setgrent();
|
||||||
while (1) {
|
while (1) {
|
||||||
i = getgrent_r(&grp, buf, BUFLEN, &grpp);
|
i = getgrent_r(&grp, buf, BUFLEN, &grpp);
|
||||||
if (i)
|
if (i)
|
||||||
break;
|
break;
|
||||||
printf("%s (%d):", grpp->gr_name, grpp->gr_gid);
|
printf("%s (%d):", grpp->gr_name, grpp->gr_gid);
|
||||||
for (i = 0; ; i++) {
|
for (i = 0; ; i++) {
|
||||||
if (grpp->gr_mem[i] == NULL)
|
if (grpp->gr_mem[i] == NULL)
|
||||||
break;
|
break;
|
||||||
printf(" %s", grpp->gr_mem[i]);
|
printf(" %s", grpp->gr_mem[i]);
|
||||||
}
|
}
|
||||||
printf("\en");
|
printf("\en");
|
||||||
}
|
}
|
||||||
endgrent();
|
endgrent();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.\" perhaps add error checking - should use strerror_r
|
.\" perhaps add error checking - should use strerror_r
|
||||||
|
@ -157,7 +159,6 @@ getgrent_r(struct group *grp, char *buf, int buflen,
|
||||||
FILE **gr_fp);
|
FILE **gr_fp);
|
||||||
.in
|
.in
|
||||||
.fi
|
.fi
|
||||||
.sp
|
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
The function
|
The function
|
||||||
.BR getgrent_r ()
|
.BR getgrent_r ()
|
||||||
|
|
|
@ -51,23 +51,26 @@ This function is present since glibc 2.2.4.
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
int main() {
|
int
|
||||||
int i, ng = 0;
|
main(void)
|
||||||
char *user = "who"; /* username here */
|
{
|
||||||
gid_t *groups = NULL;
|
int i, ng = 0;
|
||||||
struct passwd *pw = getpwnam(user);
|
char *user = "who"; /* username here */
|
||||||
if (pw == NULL)
|
gid_t *groups = NULL;
|
||||||
return 0;
|
struct passwd *pw = getpwnam(user);
|
||||||
|
|
||||||
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]);
|
|
||||||
|
|
||||||
|
if (pw == NULL)
|
||||||
return 0;
|
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
|
.fi
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
|
|
|
@ -105,22 +105,23 @@ is not valid).
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int main(void)
|
int
|
||||||
|
main(void)
|
||||||
{
|
{
|
||||||
FILE * fp;
|
FILE * fp;
|
||||||
char * line = NULL;
|
char * line = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
ssize_t read;
|
ssize_t read;
|
||||||
fp = fopen("/etc/motd", "r");
|
fp = fopen("/etc/motd", "r");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
while ((read = getline(&line, &len, fp)) != \-1) {
|
while ((read = getline(&line, &len, fp)) != \-1) {
|
||||||
printf("Retrieved line of length %zu :\en", read);
|
printf("Retrieved line of length %zu :\en", read);
|
||||||
printf("%s", line);
|
printf("%s", line);
|
||||||
}
|
}
|
||||||
if (line)
|
if (line)
|
||||||
free(line);
|
free(line);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
|
|
|
@ -313,7 +313,7 @@ with most of its features.
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv) {
|
main(int argc, char **argv) {
|
||||||
int c;
|
int c;
|
||||||
int digit_optind = 0;
|
int digit_optind = 0;
|
||||||
|
|
||||||
|
@ -330,60 +330,60 @@ main (int argc, char **argv) {
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
c = getopt_long (argc, argv, "abc:d:012",
|
c = getopt_long(argc, argv, "abc:d:012",
|
||||||
long_options, &option_index);
|
long_options, &option_index);
|
||||||
if (c == \-1)
|
if (c == \-1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 0:
|
case 0:
|
||||||
printf ("option %s", long_options[option_index].name);
|
printf("option %s", long_options[option_index].name);
|
||||||
if (optarg)
|
if (optarg)
|
||||||
printf (" with arg %s", optarg);
|
printf(" with arg %s", optarg);
|
||||||
printf ("\\n");
|
printf("\\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '0':
|
case '0':
|
||||||
case '1':
|
case '1':
|
||||||
case '2':
|
case '2':
|
||||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
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;
|
digit_optind = this_option_optind;
|
||||||
printf ("option %c\\n", c);
|
printf("option %c\\n", c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
printf ("option a\\n");
|
printf("option a\\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
printf ("option b\\n");
|
printf("option b\\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
printf ("option c with value '%s'\\n", optarg);
|
printf("option c with value '%s'\\n", optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
printf ("option d with value '%s'\\n", optarg);
|
printf("option d with value '%s'\\n", optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf ("?? getopt returned character code 0%o ??\\n", c);
|
printf("?? getopt returned character code 0%o ??\\n", c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
printf ("non-option ARGV-elements: ");
|
printf("non-option ARGV-elements: ");
|
||||||
while (optind < argc)
|
while (optind < argc)
|
||||||
printf ("%s ", argv[optind++]);
|
printf("%s ", argv[optind++]);
|
||||||
printf ("\\n");
|
printf("\\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
exit (0);
|
exit(0);
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
|
|
|
@ -18,7 +18,6 @@ It is equivalent to
|
||||||
.BI "open(" \fI"/dev/ptmx" , O_RDWR|O_NOCTTY )
|
.BI "open(" \fI"/dev/ptmx" , O_RDWR|O_NOCTTY )
|
||||||
on Linux systems, though the pseudo-terminal master is located
|
on Linux systems, though the pseudo-terminal master is located
|
||||||
elsewhere on some systems that use GNU Libc.
|
elsewhere on some systems that use GNU Libc.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
.BR getpt ()
|
.BR getpt ()
|
||||||
returns an open file descriptor upon successful completion. Otherwise, it
|
returns an open file descriptor upon successful completion. Otherwise, it
|
||||||
|
|
|
@ -58,13 +58,13 @@ as follows:
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
struct passwd {
|
struct passwd {
|
||||||
char *pw_name; /* user name */
|
char *pw_name; /* user name */
|
||||||
char *pw_passwd; /* user password */
|
char *pw_passwd; /* user password */
|
||||||
uid_t pw_uid; /* user ID */
|
uid_t pw_uid; /* user ID */
|
||||||
gid_t pw_gid; /* group ID */
|
gid_t pw_gid; /* group ID */
|
||||||
char *pw_gecos; /* real name */
|
char *pw_gecos; /* real name */
|
||||||
char *pw_dir; /* home directory */
|
char *pw_dir; /* home directory */
|
||||||
char *pw_shell; /* shell program */
|
char *pw_shell; /* shell program */
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
|
@ -106,22 +106,23 @@ Insufficient buffer space supplied. Try again with larger buffer.
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define BUFLEN 4096
|
#define BUFLEN 4096
|
||||||
|
|
||||||
int main() {
|
int
|
||||||
struct passwd pw, *pwp;
|
main(void)
|
||||||
char buf[BUFLEN];
|
{
|
||||||
int i;
|
struct passwd pw, *pwp;
|
||||||
|
char buf[BUFLEN];
|
||||||
|
int i;
|
||||||
|
|
||||||
setpwent();
|
setpwent();
|
||||||
while (1) {
|
while (1) {
|
||||||
i = getpwent_r(&pw, buf, BUFLEN, &pwp);
|
i = getpwent_r(&pw, buf, BUFLEN, &pwp);
|
||||||
if (i)
|
if (i)
|
||||||
break;
|
break;
|
||||||
printf("%s (%d)\etHOME %s\etSHELL %s\en",
|
printf("%s (%d)\etHOME %s\etSHELL %s\en", pwp->pw_name,
|
||||||
pwp->pw_name, pwp->pw_uid,
|
pwp->pw_uid, pwp->pw_dir, pwp->pw_shell);
|
||||||
pwp->pw_dir, pwp->pw_shell);
|
}
|
||||||
}
|
endpwent();
|
||||||
endpwent();
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.\" perhaps add error checking - should use strerror_r
|
.\" perhaps add error checking - should use strerror_r
|
||||||
|
@ -155,7 +156,6 @@ getpwent_r(struct passwd *pwd, char *buf, int buflen,
|
||||||
FILE **pw_fp);
|
FILE **pw_fp);
|
||||||
.in
|
.in
|
||||||
.fi
|
.fi
|
||||||
.sp
|
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
The function
|
The function
|
||||||
.BR getpwent_r ()
|
.BR getpwent_r ()
|
||||||
|
|
|
@ -21,11 +21,11 @@ struct rpcent *getrpcbynumber(number)
|
||||||
int number;
|
int number;
|
||||||
.LP
|
.LP
|
||||||
.ft B
|
.ft B
|
||||||
setrpcent (stayopen)
|
setrpcent(stayopen)
|
||||||
int stayopen;
|
int stayopen;
|
||||||
.LP
|
.LP
|
||||||
.ft B
|
.ft B
|
||||||
endrpcent ()
|
endrpcent()
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.LP
|
.LP
|
||||||
|
|
|
@ -53,7 +53,6 @@ lckpwdf, ulckpwdf \- get shadow password file entry
|
||||||
.BI "int sgetspent_r(const char *" s ", struct spwd *" spbuf ,
|
.BI "int sgetspent_r(const char *" s ", struct spwd *" spbuf ,
|
||||||
.br
|
.br
|
||||||
.BI " char *" buf ", size_t " buflen ", struct spwd **" spbufp );
|
.BI " char *" buf ", size_t " buflen ", struct spwd **" spbufp );
|
||||||
.sp
|
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Long ago it was considered safe to have encrypted passwords openly
|
Long ago it was considered safe to have encrypted passwords openly
|
||||||
|
|
|
@ -38,7 +38,6 @@ The function
|
||||||
.BR getttyent ()
|
.BR getttyent ()
|
||||||
opens the file _PATH_TTYS (if necessary) and returns the first entry.
|
opens the file _PATH_TTYS (if necessary) and returns the first entry.
|
||||||
If the file is already open, the next entry.
|
If the file is already open, the next entry.
|
||||||
|
|
||||||
.SS "The ttyent structure"
|
.SS "The ttyent structure"
|
||||||
.nf
|
.nf
|
||||||
struct ttyent {
|
struct ttyent {
|
||||||
|
|
|
@ -122,37 +122,38 @@ and
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <utmp.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_type=USER_PROCESS;
|
||||||
entry.ut_pid=getpid();
|
entry.ut_pid=getpid();
|
||||||
strcpy(entry.ut_line,ttyname(0)+strlen("/dev/"));
|
strcpy(entry.ut_line,ttyname(0)+strlen("/dev/"));
|
||||||
/* only correct for ptys named /dev/tty[pqr][0\-9a\-z] */
|
/* only correct for ptys named /dev/tty[pqr][0\-9a\-z] */
|
||||||
strcpy(entry.ut_id,ttyname(0)+strlen("/dev/tty"));
|
strcpy(entry.ut_id,ttyname(0)+strlen("/dev/tty"));
|
||||||
time(&entry.ut_time);
|
time(&entry.ut_time);
|
||||||
strcpy(entry.ut_user,getpwuid(getuid())\->pw_name);
|
strcpy(entry.ut_user,getpwuid(getuid())\->pw_name);
|
||||||
memset(entry.ut_host,0,UT_HOSTSIZE);
|
memset(entry.ut_host,0,UT_HOSTSIZE);
|
||||||
entry.ut_addr=0;
|
entry.ut_addr=0;
|
||||||
setutent();
|
setutent();
|
||||||
pututline(&entry);
|
pututline(&entry);
|
||||||
|
|
||||||
system("echo after adding entry:;who");
|
system("echo after adding entry:;who");
|
||||||
|
|
||||||
entry.ut_type=DEAD_PROCESS;
|
entry.ut_type=DEAD_PROCESS;
|
||||||
memset(entry.ut_line,0,UT_LINESIZE);
|
memset(entry.ut_line,0,UT_LINESIZE);
|
||||||
entry.ut_time=0;
|
entry.ut_time=0;
|
||||||
memset(entry.ut_user,0,UT_NAMESIZE);
|
memset(entry.ut_user,0,UT_NAMESIZE);
|
||||||
setutent();
|
setutent();
|
||||||
pututline(&entry);
|
pututline(&entry);
|
||||||
|
|
||||||
system("echo after removing entry:;who");
|
system("echo after removing entry:;who");
|
||||||
|
|
||||||
endutent();
|
endutent();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.SH FILES
|
.SH FILES
|
||||||
|
|
|
@ -30,7 +30,6 @@ getw, putw \- input and output of words (ints)
|
||||||
.BI "int getw(FILE *" stream );
|
.BI "int getw(FILE *" stream );
|
||||||
.br
|
.br
|
||||||
.BI "int putw(int " w ", FILE *" stream );
|
.BI "int putw(int " w ", FILE *" stream );
|
||||||
.br
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fBgetw\fP() reads a word (that is, an \fIint\fP) from \fIstream\fP. It's
|
\fBgetw\fP() reads a word (that is, an \fIint\fP) from \fIstream\fP. It's
|
||||||
provided for compatibility with SVr4. We recommend you use
|
provided for compatibility with SVr4. We recommend you use
|
||||||
|
|
|
@ -39,7 +39,7 @@ hcreate, hdestroy, hsearch \- hash table management
|
||||||
.BI "ENTRY *hsearch(ENTRY " item ", ACTION " action );
|
.BI "ENTRY *hsearch(ENTRY " item ", ACTION " action );
|
||||||
.sp
|
.sp
|
||||||
.B "void hdestroy(void);"
|
.B "void hdestroy(void);"
|
||||||
.sp 2
|
.sp
|
||||||
.B #define _GNU_SOURCE
|
.B #define _GNU_SOURCE
|
||||||
.br
|
.br
|
||||||
.B #include <search.h>
|
.B #include <search.h>
|
||||||
|
@ -150,47 +150,45 @@ The following program inserts 24 items in to a hash table, then prints
|
||||||
some of them.
|
some of them.
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <search.h>
|
#include <search.h>
|
||||||
|
|
||||||
char *data[] = { "alpha", "bravo", "charlie", "delta",
|
char *data[] = { "alpha", "bravo", "charlie", "delta",
|
||||||
"echo", "foxtrot", "golf", "hotel", "india", "juliet",
|
"echo", "foxtrot", "golf", "hotel", "india", "juliet",
|
||||||
"kilo", "lima", "mike", "november", "oscar", "papa",
|
"kilo", "lima", "mike", "november", "oscar", "papa",
|
||||||
"quebec", "romeo", "sierra", "tango", "uniform",
|
"quebec", "romeo", "sierra", "tango", "uniform",
|
||||||
"victor", "whisky", "x-ray", "yankee", "zulu"
|
"victor", "whisky", "x-ray", "yankee", "zulu"
|
||||||
};
|
};
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
ENTRY e, *ep;
|
ENTRY e, *ep;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* starting with small table, and letting it grow does not work */
|
/* starting with small table, and letting it grow does not work */
|
||||||
hcreate(30);
|
hcreate(30);
|
||||||
for (i = 0; i < 24; i++) {
|
for (i = 0; i < 24; i++) {
|
||||||
e.key = data[i];
|
e.key = data[i];
|
||||||
/* data is just an integer, instead of a
|
/* data is just an integer, instead of a
|
||||||
pointer to something */
|
pointer to something */
|
||||||
e.data = (void *)i;
|
e.data = (void *)i;
|
||||||
ep = hsearch(e, ENTER);
|
ep = hsearch(e, ENTER);
|
||||||
/* there should be no failures */
|
/* there should be no failures */
|
||||||
if (ep == NULL) {
|
if (ep == NULL) {
|
||||||
fprintf(stderr, "entry failed\\n");
|
fprintf(stderr, "entry failed\\n");
|
||||||
exit(1);
|
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
|
.fi
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR bsearch (3),
|
.BR bsearch (3),
|
||||||
|
|
|
@ -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
|
(255.255.255.255), and \fBinet_aton\fP() provides a cleaner way
|
||||||
to indicate error return.
|
to indicate error return.
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
The \fBinet_network\fP() function extracts
|
The \fBinet_network\fP() function extracts
|
||||||
a number in host byte order suitable for use as an Internet address
|
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.
|
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
|
.sp
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
.ne 7
|
|
||||||
.ta 8n 16n
|
|
||||||
struct in_addr {
|
struct in_addr {
|
||||||
unsigned long int s_addr;
|
unsigned long int s_addr;
|
||||||
}
|
}
|
||||||
.ta
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -21,7 +21,6 @@ key_secretkey_is_set \- interfaces to rpc keyserver daemon
|
||||||
.BI "int key_setsecret(const char *" key );
|
.BI "int key_setsecret(const char *" key );
|
||||||
.sp
|
.sp
|
||||||
.B "int key_secretkey_is_set(void);"
|
.B "int key_secretkey_is_set(void);"
|
||||||
.sp
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The functions here are used within the RPC's secure authentication
|
The functions here are used within the RPC's secure authentication
|
||||||
mechanism (AUTH_DES). There should be no need for user programs to
|
mechanism (AUTH_DES). There should be no need for user programs to
|
||||||
|
@ -52,16 +51,13 @@ The function
|
||||||
.BR key_secretkey_is_set ()
|
.BR key_secretkey_is_set ()
|
||||||
can be used to determine whether a key has been
|
can be used to determine whether a key has been
|
||||||
set for the effective UID of the calling process.
|
set for the effective UID of the calling process.
|
||||||
|
|
||||||
.SH NOTE
|
.SH NOTE
|
||||||
Note that we talk about two types of encryption here. One is
|
Note that we talk about two types of encryption here. One is
|
||||||
asymmetric using a public and secret key. The other is symmetric, the
|
asymmetric using a public and secret key. The other is symmetric, the
|
||||||
64-bit DES.
|
64-bit DES.
|
||||||
.br
|
.br
|
||||||
The routines were part of the linux/doors-project, abandoned by now.
|
The routines were part of the linux/doors-project, abandoned by now.
|
||||||
|
|
||||||
.SH "RETURN VALUES"
|
.SH "RETURN VALUES"
|
||||||
The functions return 1 on success and 0 on failure.
|
The functions return 1 on success and 0 on failure.
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR crypt (3)
|
.BR crypt (3)
|
||||||
|
|
|
@ -81,7 +81,6 @@ compiles with
|
||||||
.sp
|
.sp
|
||||||
.fi
|
.fi
|
||||||
in which case it is a 64-bit signed type.
|
in which case it is a 64-bit signed type.
|
||||||
|
|
||||||
.SS lseek64
|
.SS lseek64
|
||||||
Prototype:
|
Prototype:
|
||||||
.nf
|
.nf
|
||||||
|
@ -110,7 +109,6 @@ The function
|
||||||
.\" in glibc 2.0.94, not in 2.0.6
|
.\" in glibc 2.0.94, not in 2.0.6
|
||||||
is available since glibc 2.1, and is defined to be an alias for
|
is available since glibc 2.1, and is defined to be an alias for
|
||||||
.BR llseek ().
|
.BR llseek ().
|
||||||
|
|
||||||
.SS llseek
|
.SS llseek
|
||||||
Prototype:
|
Prototype:
|
||||||
.nf
|
.nf
|
||||||
|
@ -142,7 +140,6 @@ glibc 2.1.3 added the link-time warning
|
||||||
.sp
|
.sp
|
||||||
This makes this function unusable if one desires a warning-free
|
This makes this function unusable if one desires a warning-free
|
||||||
compilation.
|
compilation.
|
||||||
|
|
||||||
.SS _llseek
|
.SS _llseek
|
||||||
All the above functions are implemented in terms of this system call.
|
All the above functions are implemented in terms of this system call.
|
||||||
The prototype is:
|
The prototype is:
|
||||||
|
|
|
@ -91,27 +91,29 @@ static void *(*old_malloc_hook)(size_t, const void *);
|
||||||
void (*__malloc_initialize_hook) (void) = my_init_hook;
|
void (*__malloc_initialize_hook) (void) = my_init_hook;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
my_init_hook(void) {
|
my_init_hook(void)
|
||||||
|
{
|
||||||
old_malloc_hook = __malloc_hook;
|
old_malloc_hook = __malloc_hook;
|
||||||
__malloc_hook = my_malloc_hook;
|
__malloc_hook = my_malloc_hook;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
my_malloc_hook (size_t size, const void *caller) {
|
my_malloc_hook(size_t size, const void *caller)
|
||||||
|
{
|
||||||
void *result;
|
void *result;
|
||||||
|
|
||||||
/* Restore all old hooks */
|
/* Restore all old hooks */
|
||||||
__malloc_hook = old_malloc_hook;
|
__malloc_hook = old_malloc_hook;
|
||||||
|
|
||||||
/* Call recursively */
|
/* Call recursively */
|
||||||
result = malloc (size);
|
result = malloc(size);
|
||||||
|
|
||||||
/* Save underlying hooks */
|
/* Save underlying hooks */
|
||||||
old_malloc_hook = __malloc_hook;
|
old_malloc_hook = __malloc_hook;
|
||||||
|
|
||||||
/* `printf' might call `malloc', so protect it too. */
|
/* `printf' might call `malloc', so protect it too. */
|
||||||
printf ("malloc(%u) called from %p returns %p\\n",
|
printf("malloc(%u) called from %p returns %p\\n",
|
||||||
(unsigned int) size, caller, result);
|
(unsigned int) size, caller, result);
|
||||||
|
|
||||||
/* Restore our own hooks */
|
/* Restore our own hooks */
|
||||||
__malloc_hook = my_malloc_hook;
|
__malloc_hook = my_malloc_hook;
|
||||||
|
|
|
@ -49,10 +49,8 @@ is set appropriately.
|
||||||
.B EINVAL
|
.B EINVAL
|
||||||
The last six characters of \fItemplate\fP were not XXXXXX.
|
The last six characters of \fItemplate\fP were not XXXXXX.
|
||||||
Now \fItemplate\fP is unchanged.
|
Now \fItemplate\fP is unchanged.
|
||||||
|
.PP
|
||||||
.TP
|
|
||||||
Also see \fBmkdir(2)\fP for other possible values for \fIerrno\fP.
|
Also see \fBmkdir(2)\fP for other possible values for \fIerrno\fP.
|
||||||
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
This funtion is present on the BSDs.
|
This funtion is present on the BSDs.
|
||||||
.\" As at 2006, this function is being considered for a revision of POSIX.1
|
.\" As at 2006, this function is being considered for a revision of POSIX.1
|
||||||
|
|
|
@ -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
|
for auxiliary data. The buffer passed to and from a netlink socket should
|
||||||
be only accessed using these macros.
|
be only accessed using these macros.
|
||||||
.TP
|
.TP
|
||||||
.TP
|
|
||||||
NLMSG_ALIGN
|
NLMSG_ALIGN
|
||||||
Round the length of a netlink message up to align it properly.
|
Round the length of a netlink message up to align it properly.
|
||||||
.TP
|
.TP
|
||||||
|
@ -43,7 +42,6 @@ in the
|
||||||
.B nlmsg_len
|
.B nlmsg_len
|
||||||
field of the
|
field of the
|
||||||
.IR nlmsghdr .
|
.IR nlmsghdr .
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
NLMSG_SPACE
|
NLMSG_SPACE
|
||||||
Return the number of bytes a netlink message with payload of the passed length
|
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
|
NLMSG_PAYLOAD
|
||||||
Return the length of the payload associated with the
|
Return the length of the payload associated with the
|
||||||
.IR nlmsghdr .
|
.IR nlmsghdr .
|
||||||
|
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
It is often better to use netlink via
|
It is often better to use netlink via
|
||||||
.B libnetlink
|
.B libnetlink
|
||||||
than via the low level kernel interface.
|
than via the low level kernel interface.
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR netlink (7)
|
.BR netlink (7)
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -29,7 +29,6 @@ be queried.
|
||||||
.PP
|
.PP
|
||||||
Examples for the locale elements that can be specified in \fIitem\fP
|
Examples for the locale elements that can be specified in \fIitem\fP
|
||||||
using the constants defined in <langinfo.h> are:
|
using the constants defined in <langinfo.h> are:
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR CODESET \ (LC_CTYPE)
|
.BR CODESET \ (LC_CTYPE)
|
||||||
Return a string with the name of the character encoding used in the
|
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,
|
"locale charmap". For a list of character encoding names,
|
||||||
try "locale \-m", cf.\&
|
try "locale \-m", cf.\&
|
||||||
.BR locale (1).
|
.BR locale (1).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR D_T_FMT \ (LC_TIME)
|
.BR D_T_FMT \ (LC_TIME)
|
||||||
Return a string that can be used as a format string for
|
Return a string that can be used as a format string for
|
||||||
.BR strftime (3)
|
.BR strftime (3)
|
||||||
to represent time and date in a locale-specific way.
|
to represent time and date in a locale-specific way.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR D_FMT \ (LC_TIME)
|
.BR D_FMT \ (LC_TIME)
|
||||||
Return a string that can be used as a format string for
|
Return a string that can be used as a format string for
|
||||||
.BR strftime (3)
|
.BR strftime (3)
|
||||||
to represent a date in a locale-specific way.
|
to represent a date in a locale-specific way.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR T_FMT \ (LC_TIME)
|
.BR T_FMT \ (LC_TIME)
|
||||||
Return a string that can be used as a format string for
|
Return a string that can be used as a format string for
|
||||||
.BR strftime (3)
|
.BR strftime (3)
|
||||||
to represent a time in a locale-specific way.
|
to represent a time in a locale-specific way.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR DAY_ "{1\(en7} (LC_TIME)"
|
.BR DAY_ "{1\(en7} (LC_TIME)"
|
||||||
Return name of the \fIn\fP-th day of the week. [Warning: this follows
|
Return name of the \fIn\fP-th day of the week. [Warning: this follows
|
||||||
the US convention DAY_1 = Sunday, not the international convention
|
the US convention DAY_1 = Sunday, not the international convention
|
||||||
(ISO 8601) that Monday is the first day of the week.]
|
(ISO 8601) that Monday is the first day of the week.]
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR ABDAY_ "{1\(en7} (LC_TIME)"
|
.BR ABDAY_ "{1\(en7} (LC_TIME)"
|
||||||
Return abbreviated name of the \fIn\fP-th day of the week.
|
Return abbreviated name of the \fIn\fP-th day of the week.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR MON_ "{1\(en12} (LC_TIME)"
|
.BR MON_ "{1\(en12} (LC_TIME)"
|
||||||
Return name of the \fIn\fP-th month.
|
Return name of the \fIn\fP-th month.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR ABMON_ "{1\(en12} (LC_TIME)"
|
.BR ABMON_ "{1\(en12} (LC_TIME)"
|
||||||
Return abbreviated name of the \fIn\fP-th month.
|
Return abbreviated name of the \fIn\fP-th month.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR RADIXCHAR \ (LC_NUMERIC)
|
.BR RADIXCHAR \ (LC_NUMERIC)
|
||||||
Return radix character (decimal dot, decimal comma, etc.).
|
Return radix character (decimal dot, decimal comma, etc.).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR THOUSEP \ (LC_NUMERIC)
|
.BR THOUSEP \ (LC_NUMERIC)
|
||||||
Return separator character for thousands (groups of three digits).
|
Return separator character for thousands (groups of three digits).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR YESEXPR \ (LC_MESSAGES)
|
.BR YESEXPR \ (LC_MESSAGES)
|
||||||
Return a regular expression that can be used with the
|
Return a regular expression that can be used with the
|
||||||
.BR regex (3)
|
.BR regex (3)
|
||||||
function to recognize a positive response to a yes/no question.
|
function to recognize a positive response to a yes/no question.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR NOEXPR \ (LC_MESSAGES)
|
.BR NOEXPR \ (LC_MESSAGES)
|
||||||
Return a regular expression that can be used with the
|
Return a regular expression that can be used with the
|
||||||
.BR regex (3)
|
.BR regex (3)
|
||||||
function to recognize a negative response to a yes/no question.
|
function to recognize a negative response to a yes/no question.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR CRNCYSTR \ (LC_MONETARY)
|
.BR CRNCYSTR \ (LC_MONETARY)
|
||||||
Return the currency symbol, preceded by "\-" if the symbol should
|
Return the currency symbol, preceded by "\-" if the symbol should
|
||||||
|
|
|
@ -62,7 +62,8 @@ options, the program below produces the following output:
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int main()
|
int
|
||||||
|
main(void)
|
||||||
{
|
{
|
||||||
struct s {
|
struct s {
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -93,7 +93,6 @@ Thus, if a failing call is not immediately followed by a call to
|
||||||
the value of
|
the value of
|
||||||
.I errno
|
.I errno
|
||||||
should be saved.
|
should be saved.
|
||||||
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
The function
|
The function
|
||||||
.BR perror ()
|
.BR perror ()
|
||||||
|
|
|
@ -69,7 +69,6 @@ It is equivalent to
|
||||||
.IR "memalign(sysconf(_SC_PAGESIZE),size)" .
|
.IR "memalign(sysconf(_SC_PAGESIZE),size)" .
|
||||||
|
|
||||||
For all three routines, the memory is not zeroed.
|
For all three routines, the memory is not zeroed.
|
||||||
|
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
.BR memalign ()
|
.BR memalign ()
|
||||||
and
|
and
|
||||||
|
@ -81,7 +80,6 @@ returns zero on success, or one of the error values listed in the
|
||||||
next section on failure. Note that
|
next section on failure. Note that
|
||||||
.IR errno
|
.IR errno
|
||||||
is not set.
|
is not set.
|
||||||
|
|
||||||
.SH "ERRORS"
|
.SH "ERRORS"
|
||||||
.TP
|
.TP
|
||||||
.B EINVAL
|
.B EINVAL
|
||||||
|
@ -92,7 +90,6 @@ parameter was not a power of two, or was not a multiple of
|
||||||
.TP
|
.TP
|
||||||
.B ENOMEM
|
.B ENOMEM
|
||||||
There was insufficient memory to fulfill the allocation request.
|
There was insufficient memory to fulfill the allocation request.
|
||||||
|
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
On many systems there are alignment restrictions, e.g. on buffers
|
On many systems there are alignment restrictions, e.g. on buffers
|
||||||
used for direct block device I/O. POSIX specifies the
|
used for direct block device I/O. POSIX specifies the
|
||||||
|
@ -141,7 +138,6 @@ GNU libc
|
||||||
.BR malloc ()
|
.BR malloc ()
|
||||||
always returns 8-byte aligned memory addresses, so these routines are only
|
always returns 8-byte aligned memory addresses, so these routines are only
|
||||||
needed if you require larger alignment values.
|
needed if you require larger alignment values.
|
||||||
|
|
||||||
.SH AVAILABILITY
|
.SH AVAILABILITY
|
||||||
The functions
|
The functions
|
||||||
.BR memalign ()
|
.BR memalign ()
|
||||||
|
@ -151,7 +147,6 @@ have been available in all Linux libc libraries.
|
||||||
The function
|
The function
|
||||||
.BR posix_memalign ()
|
.BR posix_memalign ()
|
||||||
is available since glibc 2.1.91.
|
is available since glibc 2.1.91.
|
||||||
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
The function
|
The function
|
||||||
.BR valloc ()
|
.BR valloc ()
|
||||||
|
@ -165,7 +160,6 @@ appears in SunOS 4.1.3 but not in 4.4BSD.
|
||||||
The function
|
The function
|
||||||
.BR posix_memalign ()
|
.BR posix_memalign ()
|
||||||
comes from POSIX.1d.
|
comes from POSIX.1d.
|
||||||
|
|
||||||
.SH HEADERS
|
.SH HEADERS
|
||||||
Everybody agrees that
|
Everybody agrees that
|
||||||
.BR posix_memalign ()
|
.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,
|
(namely, if _GNU_SOURCE is defined, or _BSD_SOURCE is defined, or,
|
||||||
for glibc, if _XOPEN_SOURCE_EXTENDED is defined, or, equivalently,
|
for glibc, if _XOPEN_SOURCE_EXTENDED is defined, or, equivalently,
|
||||||
_XOPEN_SOURCE is defined to a value not less than 500).
|
_XOPEN_SOURCE is defined to a value not less than 500).
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR brk (2),
|
.BR brk (2),
|
||||||
.BR getpagesize (2),
|
.BR getpagesize (2),
|
||||||
|
|
|
@ -495,7 +495,6 @@ and
|
||||||
.BR Lf ,
|
.BR Lf ,
|
||||||
.BR Lg ,
|
.BR Lg ,
|
||||||
.BR LG ).
|
.BR LG ).
|
||||||
|
|
||||||
.SS "The conversion specifier"
|
.SS "The conversion specifier"
|
||||||
A character that specifies the type of conversion to be applied.
|
A character that specifies the type of conversion to be applied.
|
||||||
The conversion specifiers and their meanings are:
|
The conversion specifiers and their meanings are:
|
||||||
|
@ -706,7 +705,6 @@ No argument is required.
|
||||||
.B %
|
.B %
|
||||||
A `%' is written. No argument is converted. The complete conversion
|
A `%' is written. No argument is converted. The complete conversion
|
||||||
specification is `%%'.
|
specification is `%%'.
|
||||||
.PP
|
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.br
|
.br
|
||||||
.if \w'\*(Pi'=0 .ds Pi pi
|
.if \w'\*(Pi'=0 .ds Pi pi
|
||||||
|
@ -768,13 +766,13 @@ make_message(const char *fmt, ...) {
|
||||||
char *p, *np;
|
char *p, *np;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if ((p = malloc (size)) == NULL)
|
if ((p = malloc(size)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
/* Try to print in the allocated space. */
|
/* Try to print in the allocated space. */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
n = vsnprintf (p, size, fmt, ap);
|
n = vsnprintf(p, size, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
/* If that worked, return the string. */
|
/* If that worked, return the string. */
|
||||||
if (n > \-1 && n < size)
|
if (n > \-1 && n < size)
|
||||||
|
@ -794,7 +792,6 @@ make_message(const char *fmt, ...) {
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
The glibc implementation of the functions
|
The glibc implementation of the functions
|
||||||
.BR snprintf ()
|
.BR snprintf ()
|
||||||
|
@ -930,7 +927,6 @@ call to write to memory and creating a security hole.
|
||||||
.\" .PP
|
.\" .PP
|
||||||
.\" Some floating point conversions under early libc4
|
.\" Some floating point conversions under early libc4
|
||||||
.\" caused memory leaks.
|
.\" caused memory leaks.
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR printf (1),
|
.BR printf (1),
|
||||||
.BR asprintf (3),
|
.BR asprintf (3),
|
||||||
|
|
|
@ -98,7 +98,6 @@ and
|
||||||
return a non-negative number on success, or
|
return a non-negative number on success, or
|
||||||
.B EOF
|
.B EOF
|
||||||
on error.
|
on error.
|
||||||
.PP
|
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
C89, C99
|
C89, C99
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
|
|
|
@ -156,7 +156,7 @@ A typical source fragment would be
|
||||||
#ifdef PATH_MAX
|
#ifdef PATH_MAX
|
||||||
path_max = PATH_MAX;
|
path_max = PATH_MAX;
|
||||||
#else
|
#else
|
||||||
path_max = pathconf (path, _PC_PATH_MAX);
|
path_max = pathconf(path, _PC_PATH_MAX);
|
||||||
if (path_max <= 0)
|
if (path_max <= 0)
|
||||||
path_max = 4096;
|
path_max = 4096;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,7 +16,6 @@ remquo, remquof, remquol \- remainder and part of quotient
|
||||||
.BI "float remquof(float " x ", float " y ", int *" quo );
|
.BI "float remquof(float " x ", float " y ", int *" quo );
|
||||||
.br
|
.br
|
||||||
.BI "long double remquol(long double " x ", long double " y ", int *" quo );
|
.BI "long double remquol(long double " x ", long double " y ", int *" quo );
|
||||||
.sp
|
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
These functions compute the remainder and part of the quotient
|
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.
|
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.
|
Note that the actual quotient might not fit in an integer.
|
||||||
|
|
||||||
.\" A possible application of this function might be the computation
|
.\" A possible application of this function might be the computation
|
||||||
.\" of sin(x). Compute remquo(x, pi/2, &quo) or so.
|
.\" of sin(x). Compute remquo(x, pi/2, &quo) or so.
|
||||||
.\"
|
.\"
|
||||||
|
|
|
@ -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
|
\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''
|
user is \fI_res.options\fP. This field can contain the bitwise ``or''
|
||||||
of the following options:
|
of the following options:
|
||||||
.sp
|
|
||||||
.TP
|
.TP
|
||||||
.B RES_INIT
|
.B RES_INIT
|
||||||
True if \fBres_init\fP() has been called.
|
True if \fBres_init\fP() has been called.
|
||||||
|
|
|
@ -68,17 +68,19 @@ The result is the localtime of the computer 'linux'.
|
||||||
int use_tcp = 0;
|
int use_tcp = 0;
|
||||||
char *servername = "linux";
|
char *servername = "linux";
|
||||||
|
|
||||||
int main() {
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
struct sockaddr_in name;
|
struct sockaddr_in name;
|
||||||
struct rpc_timeval time1 = {0,0};
|
struct rpc_timeval time1 = {0,0};
|
||||||
struct rpc_timeval timeout = {1,0};
|
struct rpc_timeval timeout = {1,0};
|
||||||
struct hostent *hent;
|
struct hostent *hent;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
memset((char *)&name, 0, sizeof(name));
|
memset((char *) &name, 0, sizeof(name));
|
||||||
sethostent(1);
|
sethostent(1);
|
||||||
hent = gethostbyname(servername);
|
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);
|
ret = rtime(&name, &time1, use_tcp ? NULL : &timeout);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -106,7 +108,6 @@ and requires
|
||||||
.I <sys/time.h>
|
.I <sys/time.h>
|
||||||
instead of
|
instead of
|
||||||
.IR <rpc/auth_des.h> .
|
.IR <rpc/auth_des.h> .
|
||||||
|
|
||||||
.SH "BUGS"
|
.SH "BUGS"
|
||||||
.BR rtime ()
|
.BR rtime ()
|
||||||
in glibc <= 2.2.5 does not work properly on 64bit machines.
|
in glibc <= 2.2.5 does not work properly on 64bit machines.
|
||||||
|
|
|
@ -103,7 +103,7 @@ Creating a rtnetlink message to set a MTU of a device.
|
||||||
rta->rta_len = sizeof(unsigned int);
|
rta->rta_len = sizeof(unsigned int);
|
||||||
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) +
|
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) +
|
||||||
RTA_LENGTH(sizeof(mtu));
|
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);
|
send(rtnetlink_sk, &req, req.n.nlmsg_len);
|
||||||
.fi
|
.fi
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue