Apologies if I missed anyone!
-New pages
----------
-
-
Global changes
--------------
+This release consists mainly of formatting fixes (to a large
+number of pages) to achieve greater consistency across pages.
+In addition, a number of example programs were reformatted
+to more closely match K&R style.
+With the exception of the few individual changes noted below,
+no changes were made to content.
+
Typographical or grammatical errors have been corrected in several
-places. (Special thanks to Nicolas François!)
+places.
Changes to individual pages
---------------------------
+
+bdflush.2
+ mtk
+ Add <sys/kdaemon.h> header file to SYNOPSIS.
+
+select_tut.2
+ mtk
+ Make SYNOPSIS match select.2.
.sp
.BI "int accept(int " sockfd ", struct sockaddr *" addr ", socklen_t *" addrlen );
.SH DESCRIPTION
-
The
.BR accept ()
system call is used with connection-based socket types
they felt it had to have a named type for some unfathomable reason
(probably somebody didn't like losing face over having done the original
stupid thing, so they silently just renamed their blunder)."
-
.SH "SEE ALSO"
.BR bind (2),
.BR connect (2),
.IR or'ing
the following:
.RS
-.sp
.TP 1.0i
S_ISUID
04000 set user ID on execution
.TP
S_IXOTH
00001 execute/search by others
-.sp
.RE
-
+.PP
The effective UID of the calling process must match the owner of the file,
or the process must be privileged (Linux: it must have the
.B CAP_FOWNER
general errors for
.BR chmod ()
are listed below:
-
.TP
.B EACCES
Search permission is denied on a component of the path prefix.
The address involved may be changed by the
.BR set_tid_address (2)
system call. This is used by threading libraries.
-
.SS "sys_clone"
The
.B sys_clone
.I size
is not positive.
.TP
-.TP
.B ENFILE
The system limit on the total number of open files has been reached.
.TP
.I struct epoll_event
is defined as :
.sp
+.in +0.5i
.nf
- typedef union epoll_data {
- void *ptr;
- int fd;
- __uint32_t u32;
- __uint64_t u64;
- } epoll_data_t;
+typedef union epoll_data {
+ void *ptr;
+ int fd;
+ __uint32_t u32;
+ __uint64_t u64;
+} epoll_data_t;
- struct epoll_event {
- __uint32_t events; /* Epoll events */
- epoll_data_t data; /* User data variable */
- };
+struct epoll_event {
+ __uint32_t events; /* Epoll events */
+ epoll_data_t data; /* User data variable */
+};
.fi
+.in -0.5i
The
.I events
.I struct epoll_event
is defined as :
.sp
+.in +0.5i
.nf
- typedef union epoll_data {
- void *ptr;
- int fd;
- __uint32_t u32;
- __uint64_t u64;
- } epoll_data_t;
+typedef union epoll_data {
+ void *ptr;
+ int fd;
+ __uint32_t u32;
+ __uint64_t u64;
+} epoll_data_t;
- struct epoll_event {
- __uint32_t events; /* Epoll events */
- epoll_data_t data; /* User data variable */
- };
+struct epoll_event {
+ __uint32_t events; /* Epoll events */
+ epoll_data_t data; /* User data variable */
+};
.fi
+.in -0.5i
The
.I data
.\" Linux versions have also had other security holes in \fBexecve\fP(),
.\" that could be exploited for denial of service by a suitably crafted
.\" ELF binary. There are no known problems with 2.0.34 or 2.2.15.
-
.SH HISTORICAL
With Unix V6 the argument list of an
.BR exec ()
.BR exec ()
call.
Since Unix V7 both are NULL.
-
.SH "SEE ALSO"
.BR chmod (2),
.BR fork (2),
.IR fd .
The operation is determined by
.IR cmd .
-.P
.SS "Duplicating a file descriptor"
.TP
.B F_DUPFD
See
.BR dup (2)
for further details.
-.P
.SS "File descriptor flags"
The following commands manipulate the flags associated with
a file descriptor.
.B F_SETFD
Set the file descriptor flags to the value specified by
.IR arg .
-.P
.SS "File status flags"
Each open file description has certain associated status flags,
initialized by
.\" FIXME According to POSIX.1-2001, O_SYNC should also be modifiable
.\" via fcntl(2), but currently Linux does not permit this
.\" See http://bugzilla.kernel.org/show_bug.cgi?id=5994
-.P
.SS "Advisory locking"
.BR F_GETLK ", " F_SETLK " and " F_SETLKW
are used to acquire, release, and test for the existence of record
and
.BR write (2)
instead.
-.P
.SS "Mandatory locking"
(Non-POSIX.)
The above record locks may be either advisory or mandatory,
.BR chmod (1)
and
.BR chmod (2)).
-.P
.SS "Managing signals"
.BR F_GETOWN ", " F_SETOWN ", " F_GETSIG " and " F_SETSIG
are used to manage I/O availability signals:
.I aio_sigevent
structure to achieve similar things; these are also available
in Linux as part of the GNU C Library (Glibc).
-.P
.SS Leases
.B F_SETLEASE
and
.IR arg :
.RS
-.TP
.B F_RDLCK
Take out a read lease.
This will cause the calling process to be notified when
field of this argument will hold the descriptor of the leased file
that has been accessed by another process.
(This is useful if the caller holds leases against multiple files).
-.P
.SS "File and directory change notification (dnotify)"
.TP
.B F_NOTIFY
.IR arg ,
which is a bit mask specified by ORing together zero or more of
the following bits:
-
.TS
l l
----
.BR ITIMER_VIRTUAL )
the signal will be delivered immediately when generated. Otherwise the
delivery will be offset by a small time dependent on the system loading.
-.LP
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno
(both introduced in Linux 2.1.44)
get the real UID, effective UID, and saved set-user-ID (resp. group ID's)
of the current process.
-
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno
.BR setsockopt (),
the parameter should be non-zero to enable a boolean option, or zero if the
option is to be disabled.
-
.PP
For a description of the available socket options see
.BR socket (7)
and the appropriate protocol man pages.
-
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno
A _syscall macro
desired system call
-
.SS Setup
The important thing to know about a system call is its prototype. You
need to know how many arguments, their types, and the function return type.
specify. Once you include the _syscall() in your source file,
you call the system call by \fIname\fP.
.SH EXAMPLE
-.nf
.sp
+.nf
#include <stdio.h>
#include <errno.h>
#include <linux/unistd.h> /* for _syscallX macros/related stuff */
/* Note: if you copy directly from the nroff source, remember to
REMOVE the extra backslashes in the printf statement. */
-int main(void)
+int
+main(void)
{
- struct sysinfo s_info;
- int error;
+ struct sysinfo s_info;
+ int error;
- error = sysinfo(&s_info);
- printf("code error = %d\\n", error);
- printf("Uptime = %lds\\nLoad: 1 min %lu / 5 min %lu / 15 min %lu\\n"
- "RAM: total %lu / free %lu / shared %lu\\n"
- "Memory in buffers = %lu\\nSwap: total %lu / free %lu\\n"
- "Number of processes = %d\\n",
- s_info.uptime, s_info.loads[0],
- s_info.loads[1], s_info.loads[2],
- s_info.totalram, s_info.freeram,
- s_info.sharedram, s_info.bufferram,
- s_info.totalswap, s_info.freeswap,
- s_info.procs);
- return(0);
+ error = sysinfo(&s_info);
+ printf("code error = %d\\n", error);
+ printf("Uptime = %lds\\nLoad: 1 min %lu / 5 min %lu / 15 min %lu\\n"
+ "RAM: total %lu / free %lu / shared %lu\\n"
+ "Memory in buffers = %lu\\nSwap: total %lu / free %lu\\n"
+ "Number of processes = %d\\n",
+ s_info.uptime, s_info.loads[0],
+ s_info.loads[1], s_info.loads[2],
+ s_info.totalram, s_info.freeram,
+ s_info.sharedram, s_info.bufferram,
+ s_info.totalswap, s_info.freeswap,
+ s_info.procs);
+ return(0);
}
.fi
.SS "Sample Output"
.TH IOCTL_LIST 2 2003-03-30 "Linux 1.3" "Linux Programmer's Manual"
.SH NAME
ioctl_list \- list of ioctl calls in Linux/i386 kernel
-
.SH DESCRIPTION
-
This is Ioctl List 1.3.27, a list of ioctl calls in Linux/i386 kernel
1.3.27. It contains 421 ioctls from /usr/include/{asm,linux}/*.h.
For each ioctl, its numerical value, its name, and its argument
.PP
This list is very incomplete.
Please e-mail changes and comments to <mec@duracef.shout.net>.
-
.SH "IOCTL STRUCTURE"
.\" added two sections - aeb
Ioctl command values are 32-bit constants.
Thus, it seems that the new structure only gave disadvantages:
it does not help in checking, but it causes varying values
for the various architectures.
-
.SH "RETURN VALUE"
Decent ioctls return 0 on success and \-1 on error, while
any output value is stored via the argument. However,
quite a few ioctls in fact return an output value.
This is not yet indicated below.
-
.nf
+
// Main table.
// <include/asm-i386/socket.h>
0x0000560A VT_RESIZEX const struct vt_consize *
-
// More arguments.
Some ioctl's take a pointer to a structure which contains additional
TIOCLINUX-10 1 + const char *
-
-
-
// Duplicate ioctls
This list does not include ioctls in the range SIOCDEVPRIVATE and
O_SYNC) writes. I/O priorities are not supported for asynchronous
writes because they are issued outside the context of the program
dirtying the memory, and thus program-specific priorities do not apply.
-
.SH "RETURN VALUE"
On success,
.BR ioprio_get ()
See
.BR tcp (7)
for more information.
-
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno
respectively.
It returns the resulting file position in the argument
.IR result .
-
.SH "RETURN VALUE"
Upon successful completion,
.BR _llseek ()
.BR lookup_dcookie ()
to return successfully,
the kernel must still hold a cookie reference to the directory entry.
-
.SH "NOTES"
.BR lookup_dcookie ()
is a special-purpose system call, currently used only by the oprofile profiler.
The path returned may be suffixed by the string " (deleted)" if the directory
entry has been removed.
-
.SH "RETURN VALUE"
On success,
.BR lookup_dcookie ()
When converting old code, substitute values for \fIwhence\fP with the
following macros:
-.PP
.TS
c c
l l.
If the parent directory has the set-group-ID bit set then so will the
newly created directory.
-
.SH "RETURN VALUE"
.BR mkdir ()
returns zero on success, or \-1 if an error occurred (in which case,
is set appropriately.
.SH ERRORS
.TP
-.SH EFAULT
+EFAULT
Problem with getting the
data from userspace.
.SH NOTES
The error values given below result from filesystem type independent
errors. Each filesystem type may have its own special errors and its
own special behavior. See the kernel source code for details.
-
.TP
.B EACCES
A component of a path was not searchable. (See also
.BR O_NONBLOCK
in conjunction with mandatory file locks and with file leases, see
.BR fcntl (2).
-
.TP
.B O_SYNC
The file is opened for synchronous I/O. Any
.SH DESCRIPTION
Some Unix/Linux system calls have as parameter one or more filenames.
A filename (or pathname) is resolved as follows.
-
.SS "Step 1: Start of the resolution process"
If the pathname starts with the '/' character, the starting lookup directory
is the root directory of the current process. (A process inherits its
Pathnames starting with a '/' character are called absolute pathnames.
Pathnames not starting with a '/' are called relative pathnames.
-
.SS "Step 2: Walk along the path"
Set the current lookup directory to the starting lookup directory.
Now, for each non-final component of the pathname, where a component
.\" presently: max recursion depth during symlink resolution: 5
.\" max total number of symlinks followed: 40
.\" _POSIX_SYMLOOP_MAX is 8
-
.SS "Step 3: Find the final entry"
The lookup of the final component of the pathname goes just like
that of all other components, as described in the previous step,
maybe we are just creating it. The details on the treatment
of the final entry are described in the manual pages of the specific
system calls.
-
.SS ". and .."
By convention, every directory has the entries "." and "..",
which refer to the directory itself and to its parent directory,
actually present in the physical filesystem.
One cannot walk down past the root: "/.." is the same as "/".
-
.SS "Mount points"
After a "mount dev path" command, the pathname "path" refers to
the root of the filesystem hierarchy on the device "dev", and no
One can walk out of a mounted filesystem: "path/.." refers to
the parent directory of "path",
outside of the filesystem hierarchy on "dev".
-
.SS "Trailing slashes"
If a pathname ends in a '/', that forces resolution of the preceding
component as in Step 2: it has to exist and resolve to a directory.
Otherwise a trailing '/' is ignored.
(Or, equivalently, a pathname with a trailing '/' is equivalent to
the pathname obtained by appending '.' to it.)
-
.SS "Final symlink"
If the last component of a pathname is a symbolic link, then it
depends on the system call whether the file referred to will be
will operate on the symlink, while
.BR stat (2)
operates on the file pointed to by the symlink.
-
.SS "Length limit"
There is a maximum length for pathnames. If the pathname (or some
intermediate pathname obtained while resolving symbolic links)
is too long, an ENAMETOOLONG error is returned ("File name too long").
-
.SS "Empty pathname"
In the original Unix, the empty pathname referred to the current directory.
Nowadays POSIX decrees that an empty pathname must not be resolved
successfully. Linux returns ENOENT in this case.
-
.SS "Permissions"
The permission bits of a file consist of three groups of three bits, cf.\&
.BR chmod (1)
instead of the effective group ID. See
.BR setfsgid (2).
.\" FIXME say something about filesystem mounted read-only ?
-
.SS "Bypassing permission checks: superuser and capabilities"
On a traditional Unix system, the superuser
.RI ( root ,
on directories, and read permission on ordinary files.
.\" FIXME say something about immutable files
.\" FIXME say something about ACLs
-
.SH "SEE ALSO"
.BR capabilities (7)
exit(EXIT_SUCCESS);
}
}
-
.fi
.SH "SEE ALSO"
.BR fork (2),
.SH ERRORS
\fBpivot_root\fP() may return (in \fIerrno\fP) any of the errors returned by
\fBstat(2)\fP. Additionally, it may return:
-
.TP
.B EBUSY
\fInew_root\fP or \fIput_old\fP are on the current root file system,
.PP
Linux also knows about, but does not use
.BR POLLMSG .
-.PP
.SS ppoll()
The relationship between
.BR poll ()
.TP
.B Q_GETSTATS
Get collected stats.
-
.SH "RETURN VALUE"
On success,
.BR quotactl ()
If
.I count
is greater than SSIZE_MAX, the result is unspecified.
-.PP
.SH "RETURN VALUE"
On success, the number of bytes read is returned (zero indicates end of
file), and the file position is advanced by this number.
not counting the null terminator.
.I d_name
is a null-terminated filename.
-.PP
.SH "RETURN VALUE"
On success, 1 is returned.
On end of directory, 0 is returned.
function works just like
.BR write (2)
except that multiple buffers are written out.
-.PP
.SH "RETURN VALUE"
On success, the
.BR readv ()
.nf
int child_events = 0;
-void child_sig_handler (int x) {
+void
+child_sig_handler(int x)
+{
child_events++;
- signal (SIGCHLD, child_sig_handler);
+ signal(SIGCHLD, child_sig_handler);
}
-int main (int argc, char **argv) {
+int
+main(int argc, char **argv)
+{
sigset_t sigmask, orig_sigmask;
- sigemptyset (&sigmask);
- sigaddset (&sigmask, SIGCHLD);
- sigprocmask (SIG_BLOCK, &sigmask,
- &orig_sigmask);
+ sigemptyset(&sigmask);
+ sigaddset(&sigmask, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &sigmask, &orig_sigmask);
- signal (SIGCHLD, child_sig_handler);
+ signal(SIGCHLD, child_sig_handler);
for (;;) { /* main loop */
for (; child_events > 0; child_events\-\-) {
/* do event work here */
}
- r = pselect (nfds, &rd, &wr, &er, 0, &orig_sigmask);
+ r = pselect(nfds, &rd, &wr, &er, 0, &orig_sigmask);
/* main body of program */
}
#undef max
#define max(x,y) ((x) > (y) ? (x) : (y))
-static int listen_socket (int listen_port) {
+static int
+listen_socket(int listen_port)
+{
struct sockaddr_in a;
int s;
int yes;
- if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
- perror ("socket");
+ if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ perror("socket");
return \-1;
}
yes = 1;
- if (setsockopt
- (s, SOL_SOCKET, SO_REUSEADDR,
- (char *) &yes, sizeof (yes)) < 0) {
- perror ("setsockopt");
- close (s);
+ if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
+ (char *) &yes, sizeof(yes)) < 0) {
+ perror("setsockopt");
+ close(s);
return \-1;
}
- memset (&a, 0, sizeof (a));
- a.sin_port = htons (listen_port);
+ memset(&a, 0, sizeof(a));
+ a.sin_port = htons(listen_port);
a.sin_family = AF_INET;
- if (bind
- (s, (struct sockaddr *) &a, sizeof (a)) < 0) {
- perror ("bind");
- close (s);
+ if (bind(s, (struct sockaddr *) &a, sizeof(a)) < 0) {
+ perror("bind");
+ close(s);
return \-1;
}
- printf ("accepting connections on port %d\\n",
- (int) listen_port);
- listen (s, 10);
+ printf("accepting connections on port %d\\n", listen_port);
+ listen(s, 10);
return s;
}
-static int connect_socket (int connect_port,
- char *address) {
+static int
+connect_socket(int connect_port, char *address)
+{
struct sockaddr_in a;
int s;
- if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
- perror ("socket");
- close (s);
+ if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ perror("socket");
+ close(s);
return \-1;
}
- memset (&a, 0, sizeof (a));
- a.sin_port = htons (connect_port);
+ memset(&a, 0, sizeof(a));
+ a.sin_port = htons(connect_port);
a.sin_family = AF_INET;
- if (!inet_aton
- (address,
- (struct in_addr *) &a.sin_addr.s_addr)) {
- perror ("bad IP address format");
- close (s);
+ if (!inet_aton(address, (struct in_addr *) &a.sin_addr.s_addr)) {
+ perror("bad IP address format");
+ close(s);
return \-1;
}
- if (connect
- (s, (struct sockaddr *) &a,
- sizeof (a)) < 0) {
- perror ("connect()");
- shutdown (s, SHUT_RDWR);
- close (s);
+ if (connect(s, (struct sockaddr *) &a, sizeof(a)) < 0) {
+ perror("connect()");
+ shutdown(s, SHUT_RDWR);
+ close(s);
return \-1;
}
return s;
#define SHUT_FD1 { \\
if (fd1 >= 0) { \\
- shutdown (fd1, SHUT_RDWR); \\
- close (fd1); \\
+ shutdown(fd1, SHUT_RDWR); \\
+ close(fd1); \\
fd1 = \-1; \\
} \\
}
#define SHUT_FD2 { \\
if (fd2 >= 0) { \\
- shutdown (fd2, SHUT_RDWR); \\
- close (fd2); \\
+ shutdown(fd2, SHUT_RDWR); \\
+ close(fd2); \\
fd2 = \-1; \\
} \\
}
#define BUF_SIZE 1024
-int main (int argc, char **argv) {
+int
+main(int argc, char **argv)
+{
int h;
int fd1 = \-1, fd2 = \-1;
char buf1[BUF_SIZE], buf2[BUF_SIZE];
int buf2_avail, buf2_written;
if (argc != 4) {
- fprintf (stderr,
- "Usage\\n\\tfwd <listen-port> \\
-<forward-to-port> <forward-to-ip-address>\\n");
- exit (1);
+ fprintf(stderr,
+ "Usage\\n\\tfwd <listen-port> "
+ "<forward-to-port> <forward-to-ip-address>\\n");
+ exit(1);
}
- signal (SIGPIPE, SIG_IGN);
+ signal(SIGPIPE, SIG_IGN);
- forward_port = atoi (argv[2]);
+ forward_port = atoi(argv[2]);
- h = listen_socket (atoi (argv[1]));
+ h = listen_socket(atoi(argv[1]));
if (h < 0)
- exit (1);
+ exit(1);
for (;;) {
int r, nfds = 0;
fd_set rd, wr, er;
- FD_ZERO (&rd);
- FD_ZERO (&wr);
- FD_ZERO (&er);
- FD_SET (h, &rd);
- nfds = max (nfds, h);
+ FD_ZERO(&rd);
+ FD_ZERO(&wr);
+ FD_ZERO(&er);
+ FD_SET(h, &rd);
+ nfds = max(nfds, h);
if (fd1 > 0 && buf1_avail < BUF_SIZE) {
- FD_SET (fd1, &rd);
- nfds = max (nfds, fd1);
+ FD_SET(fd1, &rd);
+ nfds = max(nfds, fd1);
}
if (fd2 > 0 && buf2_avail < BUF_SIZE) {
- FD_SET (fd2, &rd);
- nfds = max (nfds, fd2);
+ FD_SET(fd2, &rd);
+ nfds = max(nfds, fd2);
}
if (fd1 > 0
&& buf2_avail \- buf2_written > 0) {
- FD_SET (fd1, &wr);
- nfds = max (nfds, fd1);
+ FD_SET(fd1, &wr);
+ nfds = max(nfds, fd1);
}
if (fd2 > 0
&& buf1_avail \- buf1_written > 0) {
- FD_SET (fd2, &wr);
- nfds = max (nfds, fd2);
+ FD_SET(fd2, &wr);
+ nfds = max(nfds, fd2);
}
if (fd1 > 0) {
- FD_SET (fd1, &er);
- nfds = max (nfds, fd1);
+ FD_SET(fd1, &er);
+ nfds = max(nfds, fd1);
}
if (fd2 > 0) {
- FD_SET (fd2, &er);
- nfds = max (nfds, fd2);
+ FD_SET(fd2, &er);
+ nfds = max(nfds, fd2);
}
- r = select (nfds + 1, &rd, &wr, &er, NULL);
+ r = select(nfds + 1, &rd, &wr, &er, NULL);
if (r == \-1 && errno == EINTR)
continue;
if (r < 0) {
- perror ("select()");
- exit (1);
+ perror("select()");
+ exit(1);
}
- if (FD_ISSET (h, &rd)) {
+ if (FD_ISSET(h, &rd)) {
unsigned int l;
struct sockaddr_in client_address;
- memset (&client_address, 0, l =
- sizeof (client_address));
- r = accept (h, (struct sockaddr *)
- &client_address, &l);
+ memset(&client_address, 0, l = sizeof(client_address));
+ r = accept(h, (struct sockaddr *) &client_address, &l);
if (r < 0) {
- perror ("accept()");
+ perror("accept()");
} else {
SHUT_FD1;
SHUT_FD2;
buf2_avail = buf2_written = 0;
fd1 = r;
fd2 =
- connect_socket (forward_port,
- argv[3]);
+ connect_socket(forward_port, argv[3]);
if (fd2 < 0) {
SHUT_FD1;
} else
- printf ("connect from %s\\n",
- inet_ntoa
- (client_address.sin_addr));
+ printf("connect from %s\\n",
+ inet_ntoa(client_address.sin_addr));
}
}
/* NB: read oob data before normal reads */
if (fd1 > 0)
- if (FD_ISSET (fd1, &er)) {
+ if (FD_ISSET(fd1, &er)) {
char c;
errno = 0;
- r = recv (fd1, &c, 1, MSG_OOB);
+ r = recv(fd1, &c, 1, MSG_OOB);
if (r < 1) {
SHUT_FD1;
} else
- send (fd2, &c, 1, MSG_OOB);
+ send(fd2, &c, 1, MSG_OOB);
}
if (fd2 > 0)
- if (FD_ISSET (fd2, &er)) {
+ if (FD_ISSET(fd2, &er)) {
char c;
errno = 0;
- r = recv (fd2, &c, 1, MSG_OOB);
+ r = recv(fd2, &c, 1, MSG_OOB);
if (r < 1) {
SHUT_FD1;
} else
- send (fd1, &c, 1, MSG_OOB);
+ send(fd1, &c, 1, MSG_OOB);
}
if (fd1 > 0)
- if (FD_ISSET (fd1, &rd)) {
+ if (FD_ISSET(fd1, &rd)) {
r =
- read (fd1, buf1 + buf1_avail,
+ read(fd1, buf1 + buf1_avail,
BUF_SIZE \- buf1_avail);
if (r < 1) {
SHUT_FD1;
buf1_avail += r;
}
if (fd2 > 0)
- if (FD_ISSET (fd2, &rd)) {
+ if (FD_ISSET(fd2, &rd)) {
r =
- read (fd2, buf2 + buf2_avail,
+ read(fd2, buf2 + buf2_avail,
BUF_SIZE \- buf2_avail);
if (r < 1) {
SHUT_FD2;
buf2_avail += r;
}
if (fd1 > 0)
- if (FD_ISSET (fd1, &wr)) {
+ if (FD_ISSET(fd1, &wr)) {
r =
- write (fd1,
- buf2 + buf2_written,
- buf2_avail \-
- buf2_written);
+ write(fd1, buf2 + buf2_written,
+ buf2_avail \- buf2_written);
if (r < 1) {
SHUT_FD1;
} else
buf2_written += r;
}
if (fd2 > 0)
- if (FD_ISSET (fd2, &wr)) {
+ if (FD_ISSET(fd2, &wr)) {
r =
- write (fd2,
- buf1 + buf1_written,
- buf1_avail \-
- buf1_written);
+ write(fd2, buf1 + buf1_written,
+ buf1_avail \- buf1_written);
if (r < 1) {
SHUT_FD2;
} else
buf2_written = buf2_avail = 0;
/* one side has closed the connection, keep
writing to the other side until empty */
- if (fd1 < 0
- && buf1_avail \- buf1_written == 0) {
+ if (fd1 < 0 && buf1_avail \- buf1_written == 0) {
SHUT_FD2;
}
- if (fd2 < 0
- && buf2_avail \- buf2_written == 0) {
+ if (fd2 < 0 && buf2_avail \- buf2_written == 0) {
SHUT_FD1;
}
}
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 200000; /* 0.2 seconds */
- select (0, NULL, NULL, NULL, &tv);
+ select(0, NULL, NULL, NULL, &tv);
.fi
.PP
This is only guaranteed to work on Unix systems, however.
and
.I clear_child_tid
that are NULL by default.
-
.SS set_child_tid
If a process is started using
.BR clone (2)
.I set_child_tid
is set, the very first thing the new process does
is writing its PID at this address.
-
.SS clear_child_tid
If a process is started using
.BR clone (2)
Precisely the same holds for
.BR setegid ()
with "group" instead of "user".
-
.\" When
.\" .I euid
.\" equals \-1, nothing is changed.
and if any member of the newly-orphaned process group is stopped, then a
SIGHUP signal followed by a SIGCONT signal will be sent to each process
in the newly-orphaned process group.
-
.SH "RETURN VALUE"
On success,
.BR setpgid ()
of the current process (and always modifies the file system GID
to be the same as the effective GID),
with the same restrictions for non-privileged processes.
-
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno
.BR setregid ()
sets real and effective group ID's of the current process,
and all of the above holds with "group" instead of "user".
-
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno
unsigned long swap_attempts; /* Unused since Linux 2.4 */
unsigned long swap_successes; /* Unused since Linux 2.4 */
};
-
.in -2n
.fi
.TP
POLL_PRI:high priority input available
POLL_HUP:device disconnected
.TE
-
.SH "RETURN VALUE"
.BR sigaction ()
returns 0 on success and \-1 on error.
prescribes the synonyms S_IRUSR, S_IWUSR, S_IXUSR.
.SH "OTHER SYSTEMS"
Values that have been (or are) in use on various systems:
-.P
.TS
l l l l l.
hex name ls octal description
.TP
.B EOVERFLOW
Some values were too large to be represented in the returned struct.
-.PP
.SH "CONFORMING TO"
Linux specific.
The Linux
structure defined approximately as follows:
.nf
- struct statvfs {
+struct statvfs {
unsigned long f_bsize; /* file system block size */
unsigned long f_frsize; /* fragment size */
fsblkcnt_t f_blocks; /* size of fs in f_frsize units */
unsigned long f_fsid; /* file system ID */
unsigned long f_flag; /* mount flags */
unsigned long f_namemax; /* maximum filename length */
- };
+};
.fi
Here the types
Set-user-ID/set-group-ID bits are ignored by
.BR exec (2).
.LP
-
It is unspecified whether all members of the returned struct
have meaningful values on all filesystems.
.TP
.B EOVERFLOW
Some values were too large to be represented in the returned struct.
-.PP
.SH "CONFORMING TO"
POSIX.1-2001
.SH NOTES
.PP
.nf
struct __sysctl_args {
- int *name; /* integer vector describing variable */
- int nlen; /* length of this vector */
- void *oldval; /* 0 or address where to store old value */
- size_t *oldlenp; /* available room for old value,
- overwritten by actual size of old value */
- void *newval; /* 0 or address of new value */
- size_t newlen; /* size of new value */
+ int *name; /* integer vector describing variable */
+ int nlen; /* length of this vector */
+ void *oldval; /* 0 or address where to store old value */
+ size_t *oldlenp; /* available room for old value,
+ overwritten by actual size of old value */
+ void *newval; /* 0 or address of new value */
+ size_t newlen; /* size of new value */
};
.fi
.PP
.IR /proc/sys ,
and if the requested item is found calls some appropriate routine
to read or modify the value.
-
.SH EXAMPLE
.nf
#include <linux/unistd.h>
int sysctl(int *name, int nlen, void *oldval, size_t *oldlenp,
void *newval, size_t newlen)
{
- struct __sysctl_args args={name,nlen,oldval,oldlenp,newval,newlen};
- return _sysctl(&args);
+ struct __sysctl_args args = { name, nlen, oldval, oldlenp,
+ newval, newlen };
+ return _sysctl(&args);
}
#define SIZE(x) sizeof(x)/sizeof(x[0])
int osnamelth;
int name[] = { CTL_KERN, KERN_OSTYPE };
-main(){
- osnamelth = sizeof(osname);
- if (sysctl(name, SIZE(name), osname, &osnamelth, 0, 0))
- perror("sysctl");
- else
- printf("This machine is running %*s\en", osnamelth, osname);
- return 0;
+int
+main(void)
+{
+ osnamelth = sizeof(osname);
+ if (sysctl(name, SIZE(name), osname, &osnamelth, 0, 0))
+ perror("sysctl");
+ else
+ printf("This machine is running %*s\en", osnamelth, osname);
+ return 0;
}
.fi
-
.SH "RETURN VALUE"
Upon successful completion,
.BR _sysctl ()
call and the information returned depends on the
.I option
in effect:
-
.TP
.B 1
Translate the file-system identifier string
.B 3
Return the total number of file system types currently present in the
kernel.
-
.PP
The numbering of the file-system type indexes begins with zero.
.SH "RETURN VALUE"
is out-of-bounds;
.I option
is invalid.
-.PP
.SH "CONFORMING TO"
SVr4.
.SH NOTE
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */
.fi
-
.SH "RETURN VALUE"
In case of error, \-1 is returned, and \fIerrno\fP is set. Otherwise,
for \fItype\fP equal to 2, 3 or 4, \fBsyslog\fP() returns the number
.BR SYS_klog .
In glibc 2.0 the syscall is baptised
.BR klogctl ().
-
.SH "SEE ALSO"
.BR syslog (3)
and
.BR delete_module (2)
only exist when the Linux kernel was built with support for them.
-
.SH "SEE ALSO"
.BR obsolete (2)
and
.BR mmap (2),
the following may also be returned:
-
.TP
.B EACCES
The library specified by
is a device number identifying a device containing
a mounted file system.
.I ubuf
-is a pointer to a ustat structure that contains the following
+is a pointer to a \fIustat\fP structure that contains the following
members:
-
-.sp
.RS
.nf
-.ne 7
-.ta 8n 16n 32n
-daddr_t f_tfree; /* Total free blocks */
-ino_t f_tinode; /* Number of free inodes */
-char f_fname[6]; /* Filsys name */
-char f_fpack[6]; /* Filsys pack name */
-.ta
+
+daddr_t f_tfree; /* Total free blocks */
+ino_t f_tinode; /* Number of free inodes */
+char f_fname[6]; /* Filsys name */
+char f_fpack[6]; /* Filsys pack name */
.fi
.RE
.PP
-
The last two fields, f_fname and f_fpack, are not implemented and will
always be filled with null bytes ('\\0').
.SH "RETURN VALUE"
[1]+ Done ./a.out
$
-
#include <sys/wait.h>
#include <stdlib.h>
#include <unistd.h>
.BR HUGE_VALL
expand to constants of types double, float and long double, respectively,
that represent a large positive value, possibly plus infinity.
-
.SH AVAILABILITY
On a glibc system, the macro HUGE_VAL is always available.
Availability of the NAN macro can be tested using
.I <math.h>
if _ISOC99_SOURCE or _GNU_SOURCE is defined, or __STDC_VERSION__ is defined
and has a value not less than 199901L.
-
.SH "CONFORMING TO"
C99
.SH "SEE ALSO"
.B #include <i386/fpu_control.h>
.sp
.BI "void __setfpucw((unsigned short) " control_word );
-.br
.SH DESCRIPTION
.BR __setfpucw ()
transfers
was used to control floating point precision, rounding and floating point
exceptions.
.SH EXAMPLE
-
.BR __setfpucw(0x1372)
Set fpu control word on i386 architecture to
\- rounding to nearest
.br
\- exceptions on overflow, zero divide and NaN
-.br
.SH AVAILABILITY
As of glibc 2.1 this function does not exist anymore.
There are new functions from C99, with prototypes in
.BI "long a64l(char *" str64 );
.sp
.BI "char *l64a(long " value );
-.sp
.SH DESCRIPTION
These functions provide a conversion between 32-bit long integers
and little-endian base-64 ASCII strings (of length zero to six).
The 64 digits in the base 64 system are:
.RS
.nf
+
\&'.' represents a 0
\&'/' represents a 1
0-9 represent 2-11
A-Z represent 12-37
a-z represent 38-63
+
.fi
.RE
-.br
So 123 = 59*64^0 + 1*64^1 = "v/".
.SH NOTES
The value returned by
.\" or the control block of the operation
must not be accessed during the operation or undefined results may
occur. The memory areas involved must remain valid.
-
.SH "CONFORMING TO"
POSIX.1-2001
.SH "SEE ALSO"
.TP
.B ENOSYS
This function is not supported.
-
.SH NOTES
It is a good idea to zero out the control block before use.
This control block must not be changed while the write operation
.\" or the control block of the operation
must not be accessed during the operation or undefined results may
occur. The memory areas involved must remain valid.
-
.SH "CONFORMING TO"
POSIX.1-2001
.SH "SEE ALSO"
#include <stdlib.h>
#include <unistd.h>
-void bye(void) {
- printf("That was all, folks\en");
+void
+bye(void)
+{
+ printf("That was all, folks\en");
}
-int main(){
- long a;
- int i;
+int
+main(void)
+{
+ long a;
+ int i;
- a = sysconf(_SC_ATEXIT_MAX);
- printf("ATEXIT_MAX = %ld\en", a);
+ a = sysconf(_SC_ATEXIT_MAX);
+ printf("ATEXIT_MAX = %ld\en", a);
- i = atexit(bye);
- if (i != 0) {
- fprintf(stderr, "cannot set exit function\en");
- return EXIT_FAILURE;
- }
- return EXIT_SUCCESS;
+ i = atexit(bye);
+ if (i != 0) {
+ fprintf(stderr, "cannot set exit function\en");
+ return EXIT_FAILURE;
+ }
+ return EXIT_SUCCESS;
}
.fi
.SH NOTES
.I canonicalize_file_name(path)
is equivalent to the call
.IR "realpath(path,\ NULL)" .
-
.SH "CONFORMING TO"
The function is a GNU extension.
.SH "SEE ALSO"
It invalidates any subsequent references to the message catalog
defined by
.IR catalog .
-.LP
.SH "RETURN VALUE"
The function
.BR catopen ()
.I <stdlib.h>
and sometimes in
.IR <malloc.h> .
-.LP
.SS "3-arg cfree"
Some SCO and Solaris versions have malloc libraries with a 3-argument
.BR cfree (),
pairs and sets the value of the external variable
.I environ
to NULL.
-
.SH "RETURN VALUE"
The \fBclearenv\fP() function returns zero on success, and a non-zero
value on failure.
.\" Most versions of Unix return -1 on error, or do not even have errors.
.\" Glibc info and the Watcom C library document "a non-zero value".
-
.SH AVAILABILITY
Not in libc4, libc5. In glibc since glibc 2.0.
-
.SH "CONFORMING TO"
Various Unix variants (DG/UX, HP-UX, QNX, ...).
POSIX.9 (bindings for FORTRAN77).
later issue of this standard (cf. B.4.6.1).
However, POSIX.1-2001
only adds \fIputenv\fP(), and rejected \fBclearenv\fP().
-
.SH NOTES
Used in security-conscious applications. If it is unavailable
the assignment
CMSG_ALIGN, CMSG_SPACE, CMSG_NXTHDR, CMSG_FIRSTHDR \- Access ancillary data
.SH SYNOPSIS
.B #include <sys/socket.h>
-.br
-.sp 2
+.sp
.BI "struct cmsghdr *CMSG_FIRSTHDR(struct msghdr *" msgh );
.br
.BI "struct cmsghdr *CMSG_NXTHDR(struct msghdr *" msgh ", struct cmsghdr *" cmsg );
.BI "unsigned char *CMSG_DATA(struct cmsghdr *" cmsg );
.sp
.nf
-.ta 8n 20n 32n
struct cmsghdr {
- socklen_t cmsg_len; /* data byte count, including header */
- int cmsg_level; /* originating protocol */
- int cmsg_type; /* protocol-specific type */
-/* followed by unsigned char cmsg_data[]; */
+ socklen_t cmsg_len; /* data byte count, including header */
+ int cmsg_level; /* originating protocol */
+ int cmsg_type; /* protocol-specific type */
+ /* followed by unsigned char cmsg_data[]; */
};
-.ta
.fi
.SH DESCRIPTION
These macros are used to create and access control messages (also called
is the 8-byte initialization
vector for the chaining. It is updated to the next initialization
vector upon return.
-.LP
.SH "SEE ALSO"
.BR des (1),
.BR crypt (3)
.\" .BR ( stat )
.BI DES_FAILED( stat )
is false only for the first two statuses.
-
.\" So far the Sun page
.\" Some additions - aeb
.SH AVAILABILITY
does the same as
.BR dlsym ()
but takes a version string as an additional argument.
-
.SH EXAMPLE
Load the math library, and print the cosine of 2.0:
.RS
#include <stdlib.h>
#include <dlfcn.h>
-int main(int argc, char **argv) {
+int
+main(int argc, char **argv)
+{
void *handle;
double (*cosine)(double);
char *error;
- handle = dlopen ("libm.so", RTLD_LAZY);
+ handle = dlopen("libm.so", RTLD_LAZY);
if (!handle) {
- fprintf (stderr, "%s\en", dlerror());
+ fprintf(stderr, "%s\en", dlerror());
exit(1);
}
.\" the dlsym() casting problem
*(void **) (&cosine) = dlsym(handle, "cos");
if ((error = dlerror()) != NULL) {
- fprintf (stderr, "%s\en", error);
+ fprintf(stderr, "%s\en", error);
exit(1);
}
- printf ("%f\en", (*cosine)(2.0));
+ printf("%f\en", (*cosine)(2.0));
dlclose(handle);
return 0;
}
.BR "#include <time.h>"
.sp
.BI "int dysize(int " year );
-.sp
.SH DESCRIPTION
The function returns 365 for a normal year and 366 for a leap year.
The calculation for leap year is based on:
.nf
#include <crypt.h>
-main() {
- char key[64]; /* bit pattern for key */
- char txt[64]; /* bit pattern for messages */
- setkey(key);
- encrypt(txt, 0); /* encode */
- encrypt(txt, 1); /* decode */
+int
+main(void)
+{
+ char key[64]; /* bit pattern for key */
+ char txt[64]; /* bit pattern for messages */
+
+ setkey(key);
+ encrypt(txt, 0); /* encode */
+ encrypt(txt, 1); /* decode */
}
.fi
.SH "NOTE"
.sp
.BI "void"
.BI "envz_strip(char **" envz ", size_t *" envz_len );
-.sp
.SH DESCRIPTION
These functions are glibc-specific.
.LP
.nf
#include <stdio.h>
#include <envz.h>
+
int
-main(int argc, char *argv[], char *envp[]) {
- int i, e_len = 0;
- char *str;
+main(int argc, char *argv[], char *envp[])
+{
+ int i, e_len = 0;
+ char *str;
- for (i=0; envp[i] != NULL; i++)
- e_len += strlen(envp[i]) + 1;
+ for (i=0; envp[i] != NULL; i++)
+ e_len += strlen(envp[i]) + 1;
- str = envz_entry(*envp, e_len, "HOME");
- printf("%s\en", str);
- str = envz_get(*envp, e_len, "HOME");
- printf("%s\en", str);
- return 0;
+ str = envz_entry(*envp, e_len, "HOME");
+ printf("%s\en", str);
+ str = envz_get(*envp, e_len, "HOME");
+ printf("%s\en", str);
+ return 0;
}
.fi
.SH "CONFORMING TO"
.BR isinf ()
functions return 1 if \fIx\fP is plus infinity, \-1 is \fIx\fP
is minus infinity, and 0 otherwise.
-
.SH NOTE
Note that these functions are obsolete. C99 defines macros
isfinite(), isinf() and isnan() (for all types) replacing them.
Otherwise, NULL is returned and the global variable
.I errno
is set to indicate the error.
-
.SH "EXAMPLE"
The program below uses
.BR fmemopen ()
#include <stdio.h>
#include <stdlib.h>
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
FILE *out, *in;
int v, s;
exit(EXIT_SUCCESS);
}
.fi
-.sp
.SH "CONFORMING TO"
These functions are GNU extensions.
.\" Jan 06: But they appear to be going up for standardization by
fmtmsg \- print formatted error messages
.SH SYNOPSIS
.nf
-.sp
.B #include <fmtmsg.h>
.sp
.BI "int fmtmsg(long " classification ", const char *" label ,
.BI " int " severity ", const char *" text ,
.br
.BI " const char *" action ", const char *" tag );
-.sp
.fi
.SH DESCRIPTION
This function displays a message described by its parameters on the device(s)
#include <stdio.h>
#include <fmtmsg.h>
-int main() {
- long class = MM_PRINT | MM_SOFT | MM_OPSYS | MM_RECOVER;
- int err;
- err = fmtmsg(class, "util-linux:mount", MM_ERROR,
- "unknown mount option", "See mount(8).", "util-linux:mount:017");
- switch(err) {
+int
+main(void)
+{
+ long class = MM_PRINT | MM_SOFT | MM_OPSYS | MM_RECOVER;
+ int err;
+ err = fmtmsg(class, "util-linux:mount", MM_ERROR,
+ "unknown mount option", "See mount(8).",
+ "util-linux:mount:017");
+ switch(err) {
case MM_OK:
- break;
+ break;
case MM_NOTOK:
- printf("Nothing printed\en");
- break;
+ printf("Nothing printed\en");
+ break;
case MM_NOMSG:
- printf("Nothing printed to stderr\en");
- break;
+ printf("Nothing printed to stderr\en");
+ break;
case MM_NOCON:
- printf("No console output\en");
- break;
+ printf("No console output\en");
+ break;
default:
- printf("Unknown error from fmtmsg()\en");
- }
- return 0;
+ printf("Unknown error from fmtmsg()\en");
+ }
+ return 0;
}
.fi
.PP
.SH DESCRIPTION
For the definition of the Gamma function, see
.BR tgamma (3).
-.PP
.SS "*BSD version"
4.4BSD and FreeBSD libm have a
.BR gamma ()
.TH GETDATE 3 2001-12-26 "" "Linux Programmer's Manual"
.SH NAME
getdate \- convert a string to struct tm
-.br
.SH SYNOPSIS
.B "#define _XOPEN_SOURCE"
.br
.BI "struct tm *getdate(const char *" string );
.sp
.BI "extern int getdate_err;"
-.sp 2
+.sp
.B "#define _GNU_SOURCE"
.br
.B "#include <time.h>"
.sp
.BI "int getdate_r (const char *" string ", struct tm *" res );
-.br
.SH DESCRIPTION
The function
.BR getdate ()
.BR getfsspec ()
only return the first occurrence, these two functions are not suitable
for use under Linux.
-.LP
.SH "SEE ALSO"
.BR getmntent (3),
.BR fstab (5)
.RS
.nf
struct group {
- char *gr_name; /* group name */
- char *gr_passwd; /* group password */
- gid_t gr_gid; /* group ID */
- char **gr_mem; /* group members */
+ char *gr_name; /* group name */
+ char *gr_passwd; /* group password */
+ gid_t gr_gid; /* group ID */
+ char **gr_mem; /* group members */
};
.ta
.fi
#include <stdio.h>
#define BUFLEN 4096
-int main() {
- struct group grp, *grpp;
- char buf[BUFLEN];
- int i;
+int
+main(void)
+{
+ struct group grp, *grpp;
+ char buf[BUFLEN];
+ int i;
- setgrent();
- while (1) {
- i = getgrent_r(&grp, buf, BUFLEN, &grpp);
- if (i)
- break;
- printf("%s (%d):", grpp->gr_name, grpp->gr_gid);
- for (i = 0; ; i++) {
- if (grpp->gr_mem[i] == NULL)
- break;
- printf(" %s", grpp->gr_mem[i]);
- }
- printf("\en");
- }
- endgrent();
- return 0;
+ setgrent();
+ while (1) {
+ i = getgrent_r(&grp, buf, BUFLEN, &grpp);
+ if (i)
+ break;
+ printf("%s (%d):", grpp->gr_name, grpp->gr_gid);
+ for (i = 0; ; i++) {
+ if (grpp->gr_mem[i] == NULL)
+ break;
+ printf(" %s", grpp->gr_mem[i]);
+ }
+ printf("\en");
+ }
+ endgrent();
+ return 0;
}
.fi
.\" perhaps add error checking - should use strerror_r
FILE **gr_fp);
.in
.fi
-.sp
.SH NOTES
The function
.BR getgrent_r ()
#include <grp.h>
#include <pwd.h>
-int main() {
- int i, ng = 0;
- char *user = "who"; /* username here */
- gid_t *groups = NULL;
- struct passwd *pw = getpwnam(user);
- if (pw == NULL)
- return 0;
+int
+main(void)
+{
+ int i, ng = 0;
+ char *user = "who"; /* username here */
+ gid_t *groups = NULL;
+ 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);
- }
+ if (pw == NULL)
+ return 0;
- for(i = 0; i < ng; i++)
- printf("%d\en", groups[i]);
+ if (getgrouplist(user, pw->pw_gid, NULL, &ng) < 0) {
+ groups = (gid_t *) malloc(ng * sizeof (gid_t));
+ getgrouplist(user, pw->pw_gid, groups, &ng);
+ }
- return 0;
+ for(i = 0; i < ng; i++)
+ printf("%d\en", groups[i]);
+
+ return 0;
}
.fi
.SH "SEE ALSO"
#include <stdio.h>
#include <stdlib.h>
-int main(void)
+int
+main(void)
{
- FILE * fp;
- char * line = NULL;
- size_t len = 0;
- ssize_t read;
- fp = fopen("/etc/motd", "r");
- if (fp == NULL)
- exit(EXIT_FAILURE);
- while ((read = getline(&line, &len, fp)) != \-1) {
- printf("Retrieved line of length %zu :\en", read);
- printf("%s", line);
- }
- if (line)
- free(line);
- return EXIT_SUCCESS;
+ FILE * fp;
+ char * line = NULL;
+ size_t len = 0;
+ ssize_t read;
+ fp = fopen("/etc/motd", "r");
+ if (fp == NULL)
+ exit(EXIT_FAILURE);
+ while ((read = getline(&line, &len, fp)) != \-1) {
+ printf("Retrieved line of length %zu :\en", read);
+ printf("%s", line);
+ }
+ if (line)
+ free(line);
+ return EXIT_SUCCESS;
}
.fi
.SH "CONFORMING TO"
#include <getopt.h>
int
-main (int argc, char **argv) {
+main(int argc, char **argv) {
int c;
int digit_optind = 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);
if (c == \-1)
break;
switch (c) {
case 0:
- printf ("option %s", long_options[option_index].name);
+ printf("option %s", long_options[option_index].name);
if (optarg)
- printf (" with arg %s", optarg);
- printf ("\\n");
+ printf(" with arg %s", optarg);
+ printf("\\n");
break;
case '0':
case '1':
case '2':
if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\\n");
+ printf("digits occur in two different argv-elements.\\n");
digit_optind = this_option_optind;
- printf ("option %c\\n", c);
+ printf("option %c\\n", c);
break;
case 'a':
- printf ("option a\\n");
+ printf("option a\\n");
break;
case 'b':
- printf ("option b\\n");
+ printf("option b\\n");
break;
case 'c':
- printf ("option c with value '%s'\\n", optarg);
+ printf("option c with value '%s'\\n", optarg);
break;
case 'd':
- printf ("option d with value '%s'\\n", optarg);
+ printf("option d with value '%s'\\n", optarg);
break;
case '?':
break;
default:
- printf ("?? getopt returned character code 0%o ??\\n", c);
+ printf("?? getopt returned character code 0%o ??\\n", c);
}
}
if (optind < argc) {
- printf ("non-option ARGV-elements: ");
+ printf("non-option ARGV-elements: ");
while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\\n");
+ printf("%s ", argv[optind++]);
+ printf("\\n");
}
- exit (0);
+ exit(0);
}
.fi
.SH BUGS
.BI "open(" \fI"/dev/ptmx" , O_RDWR|O_NOCTTY )
on Linux systems, though the pseudo-terminal master is located
elsewhere on some systems that use GNU Libc.
-
.SH "RETURN VALUE"
.BR getpt ()
returns an open file descriptor upon successful completion. Otherwise, it
.RS
.nf
struct passwd {
- char *pw_name; /* user name */
- char *pw_passwd; /* user password */
- uid_t pw_uid; /* user ID */
- gid_t pw_gid; /* group ID */
- char *pw_gecos; /* real name */
- char *pw_dir; /* home directory */
- char *pw_shell; /* shell program */
+ char *pw_name; /* user name */
+ char *pw_passwd; /* user password */
+ uid_t pw_uid; /* user ID */
+ gid_t pw_gid; /* group ID */
+ char *pw_gecos; /* real name */
+ char *pw_dir; /* home directory */
+ char *pw_shell; /* shell program */
};
.fi
.RE
#include <stdio.h>
#define BUFLEN 4096
-int main() {
- struct passwd pw, *pwp;
- char buf[BUFLEN];
- int i;
+int
+main(void)
+{
+ struct passwd pw, *pwp;
+ char buf[BUFLEN];
+ int i;
- setpwent();
- while (1) {
- i = getpwent_r(&pw, buf, BUFLEN, &pwp);
- if (i)
- break;
- printf("%s (%d)\etHOME %s\etSHELL %s\en",
- pwp->pw_name, pwp->pw_uid,
- pwp->pw_dir, pwp->pw_shell);
- }
- endpwent();
- return 0;
+ setpwent();
+ while (1) {
+ i = getpwent_r(&pw, buf, BUFLEN, &pwp);
+ if (i)
+ break;
+ printf("%s (%d)\etHOME %s\etSHELL %s\en", pwp->pw_name,
+ pwp->pw_uid, pwp->pw_dir, pwp->pw_shell);
+ }
+ endpwent();
+ return 0;
}
.fi
.\" perhaps add error checking - should use strerror_r
FILE **pw_fp);
.in
.fi
-.sp
.SH NOTES
The function
.BR getpwent_r ()
int number;
.LP
.ft B
-setrpcent (stayopen)
+setrpcent(stayopen)
int stayopen;
.LP
.ft B
-endrpcent ()
+endrpcent()
.fi
.SH DESCRIPTION
.LP
.BI "int sgetspent_r(const char *" s ", struct spwd *" spbuf ,
.br
.BI " char *" buf ", size_t " buflen ", struct spwd **" spbufp );
-.sp
.fi
.SH DESCRIPTION
Long ago it was considered safe to have encrypted passwords openly
.BR getttyent ()
opens the file _PATH_TTYS (if necessary) and returns the first entry.
If the file is already open, the next entry.
-
.SS "The ttyent structure"
.nf
struct ttyent {
#include <unistd.h>
#include <utmp.h>
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
- struct utmp entry;
+ struct utmp entry;
- system("echo before adding entry:;who");
+ system("echo before adding entry:;who");
- entry.ut_type=USER_PROCESS;
- entry.ut_pid=getpid();
- strcpy(entry.ut_line,ttyname(0)+strlen("/dev/"));
- /* only correct for ptys named /dev/tty[pqr][0\-9a\-z] */
- strcpy(entry.ut_id,ttyname(0)+strlen("/dev/tty"));
- time(&entry.ut_time);
- strcpy(entry.ut_user,getpwuid(getuid())\->pw_name);
- memset(entry.ut_host,0,UT_HOSTSIZE);
- entry.ut_addr=0;
- setutent();
- pututline(&entry);
+ entry.ut_type=USER_PROCESS;
+ entry.ut_pid=getpid();
+ strcpy(entry.ut_line,ttyname(0)+strlen("/dev/"));
+ /* only correct for ptys named /dev/tty[pqr][0\-9a\-z] */
+ strcpy(entry.ut_id,ttyname(0)+strlen("/dev/tty"));
+ time(&entry.ut_time);
+ strcpy(entry.ut_user,getpwuid(getuid())\->pw_name);
+ memset(entry.ut_host,0,UT_HOSTSIZE);
+ entry.ut_addr=0;
+ setutent();
+ pututline(&entry);
- system("echo after adding entry:;who");
+ system("echo after adding entry:;who");
- entry.ut_type=DEAD_PROCESS;
- memset(entry.ut_line,0,UT_LINESIZE);
- entry.ut_time=0;
- memset(entry.ut_user,0,UT_NAMESIZE);
- setutent();
- pututline(&entry);
+ entry.ut_type=DEAD_PROCESS;
+ memset(entry.ut_line,0,UT_LINESIZE);
+ entry.ut_time=0;
+ memset(entry.ut_user,0,UT_NAMESIZE);
+ setutent();
+ pututline(&entry);
- system("echo after removing entry:;who");
+ system("echo after removing entry:;who");
- endutent();
- return 0;
+ endutent();
+ return 0;
}
.fi
.SH FILES
.BI "int getw(FILE *" stream );
.br
.BI "int putw(int " w ", FILE *" stream );
-.br
.SH DESCRIPTION
\fBgetw\fP() reads a word (that is, an \fIint\fP) from \fIstream\fP. It's
provided for compatibility with SVr4. We recommend you use
.BI "ENTRY *hsearch(ENTRY " item ", ACTION " action );
.sp
.B "void hdestroy(void);"
-.sp 2
+.sp
.B #define _GNU_SOURCE
.br
.B #include <search.h>
some of them.
.nf
- #include <stdio.h>
- #include <stdlib.h>
- #include <search.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <search.h>
- char *data[] = { "alpha", "bravo", "charlie", "delta",
- "echo", "foxtrot", "golf", "hotel", "india", "juliet",
- "kilo", "lima", "mike", "november", "oscar", "papa",
- "quebec", "romeo", "sierra", "tango", "uniform",
- "victor", "whisky", "x-ray", "yankee", "zulu"
- };
+char *data[] = { "alpha", "bravo", "charlie", "delta",
+ "echo", "foxtrot", "golf", "hotel", "india", "juliet",
+ "kilo", "lima", "mike", "november", "oscar", "papa",
+ "quebec", "romeo", "sierra", "tango", "uniform",
+ "victor", "whisky", "x-ray", "yankee", "zulu"
+};
- int main() {
- ENTRY e, *ep;
- int i;
+int main() {
+ ENTRY e, *ep;
+ int i;
- /* starting with small table, and letting it grow does not work */
- hcreate(30);
- for (i = 0; i < 24; i++) {
- e.key = data[i];
- /* data is just an integer, instead of a
- pointer to something */
- e.data = (void *)i;
- ep = hsearch(e, ENTER);
- /* there should be no failures */
- if (ep == NULL) {
+ /* starting with small table, and letting it grow does not work */
+ hcreate(30);
+ for (i = 0; i < 24; i++) {
+ e.key = data[i];
+ /* data is just an integer, instead of a
+ pointer to something */
+ e.data = (void *)i;
+ ep = hsearch(e, ENTER);
+ /* there should be no failures */
+ if (ep == NULL) {
fprintf(stderr, "entry failed\\n");
exit(1);
- }
- }
- for (i = 22; i < 26; i++) {
- /* print two entries from the table, and
- show that two are not in the table */
- e.key = data[i];
- ep = hsearch(e, FIND);
- printf("%9.9s \-> %9.9s:%d\\n", e.key,
- ep ? ep\->key : "NULL",
- ep ? (int)(ep->data) : 0);
- }
- return 0;
+ }
}
-
+ for (i = 22; i < 26; i++) {
+ /* print two entries from the table, and
+ show that two are not in the table */
+ e.key = data[i];
+ ep = hsearch(e, FIND);
+ printf("%9.9s \-> %9.9s:%d\\n", e.key,
+ ep ? ep\->key : "NULL", ep ? (int)(ep->data) : 0);
+ }
+ return 0;
+}
.fi
.SH "SEE ALSO"
.BR bsearch (3),
(255.255.255.255), and \fBinet_aton\fP() provides a cleaner way
to indicate error return.
.PP
-
The \fBinet_network\fP() function extracts
a number in host byte order suitable for use as an Internet address
from \fIcp\fP, which is a string in numbers-and-dots notation.
.sp
.RS
.nf
-.ne 7
-.ta 8n 16n
struct in_addr {
- unsigned long int s_addr;
+ unsigned long int s_addr;
}
-.ta
.fi
.RE
.PP
.BI "int key_setsecret(const char *" key );
.sp
.B "int key_secretkey_is_set(void);"
-.sp
.SH DESCRIPTION
The functions here are used within the RPC's secure authentication
mechanism (AUTH_DES). There should be no need for user programs to
.BR key_secretkey_is_set ()
can be used to determine whether a key has been
set for the effective UID of the calling process.
-
.SH NOTE
Note that we talk about two types of encryption here. One is
asymmetric using a public and secret key. The other is symmetric, the
64-bit DES.
.br
The routines were part of the linux/doors-project, abandoned by now.
-
.SH "RETURN VALUES"
The functions return 1 on success and 0 on failure.
-
.SH "SEE ALSO"
.BR crypt (3)
.sp
.fi
in which case it is a 64-bit signed type.
-
.SS lseek64
Prototype:
.nf
.\" in glibc 2.0.94, not in 2.0.6
is available since glibc 2.1, and is defined to be an alias for
.BR llseek ().
-
.SS llseek
Prototype:
.nf
.sp
This makes this function unusable if one desires a warning-free
compilation.
-
.SS _llseek
All the above functions are implemented in terms of this system call.
The prototype is:
void (*__malloc_initialize_hook) (void) = my_init_hook;
static void
-my_init_hook(void) {
+my_init_hook(void)
+{
old_malloc_hook = __malloc_hook;
__malloc_hook = my_malloc_hook;
}
static void *
-my_malloc_hook (size_t size, const void *caller) {
+my_malloc_hook(size_t size, const void *caller)
+{
void *result;
/* Restore all old hooks */
__malloc_hook = old_malloc_hook;
/* Call recursively */
- result = malloc (size);
+ result = malloc(size);
/* Save underlying hooks */
old_malloc_hook = __malloc_hook;
/* `printf' might call `malloc', so protect it too. */
- printf ("malloc(%u) called from %p returns %p\\n",
- (unsigned int) size, caller, result);
+ printf("malloc(%u) called from %p returns %p\\n",
+ (unsigned int) size, caller, result);
/* Restore our own hooks */
__malloc_hook = my_malloc_hook;
.B EINVAL
The last six characters of \fItemplate\fP were not XXXXXX.
Now \fItemplate\fP is unchanged.
-
-.TP
+.PP
Also see \fBmkdir(2)\fP for other possible values for \fIerrno\fP.
-
.SH "CONFORMING TO"
This funtion is present on the BSDs.
.\" As at 2006, this function is being considered for a revision of POSIX.1
for auxiliary data. The buffer passed to and from a netlink socket should
be only accessed using these macros.
.TP
-.TP
NLMSG_ALIGN
Round the length of a netlink message up to align it properly.
.TP
.B nlmsg_len
field of the
.IR nlmsghdr .
-
.TP
NLMSG_SPACE
Return the number of bytes a netlink message with payload of the passed length
NLMSG_PAYLOAD
Return the length of the payload associated with the
.IR nlmsghdr .
-
.SH NOTES
It is often better to use netlink via
.B libnetlink
than via the low level kernel interface.
-
.SH "SEE ALSO"
.BR netlink (7)
.PP
.PP
Examples for the locale elements that can be specified in \fIitem\fP
using the constants defined in <langinfo.h> are:
-
.TP
.BR CODESET \ (LC_CTYPE)
Return a string with the name of the character encoding used in the
"locale charmap". For a list of character encoding names,
try "locale \-m", cf.\&
.BR locale (1).
-
.TP
.BR D_T_FMT \ (LC_TIME)
Return a string that can be used as a format string for
.BR strftime (3)
to represent time and date in a locale-specific way.
-
.TP
.BR D_FMT \ (LC_TIME)
Return a string that can be used as a format string for
.BR strftime (3)
to represent a date in a locale-specific way.
-
.TP
.BR T_FMT \ (LC_TIME)
Return a string that can be used as a format string for
.BR strftime (3)
to represent a time in a locale-specific way.
-
.TP
.BR DAY_ "{1\(en7} (LC_TIME)"
Return name of the \fIn\fP-th day of the week. [Warning: this follows
the US convention DAY_1 = Sunday, not the international convention
(ISO 8601) that Monday is the first day of the week.]
-
.TP
.BR ABDAY_ "{1\(en7} (LC_TIME)"
Return abbreviated name of the \fIn\fP-th day of the week.
-
.TP
.BR MON_ "{1\(en12} (LC_TIME)"
Return name of the \fIn\fP-th month.
-
.TP
.BR ABMON_ "{1\(en12} (LC_TIME)"
Return abbreviated name of the \fIn\fP-th month.
-
.TP
.BR RADIXCHAR \ (LC_NUMERIC)
Return radix character (decimal dot, decimal comma, etc.).
-
.TP
.BR THOUSEP \ (LC_NUMERIC)
Return separator character for thousands (groups of three digits).
-
.TP
.BR YESEXPR \ (LC_MESSAGES)
Return a regular expression that can be used with the
.BR regex (3)
function to recognize a positive response to a yes/no question.
-
.TP
.BR NOEXPR \ (LC_MESSAGES)
Return a regular expression that can be used with the
.BR regex (3)
function to recognize a negative response to a yes/no question.
-
.TP
.BR CRNCYSTR \ (LC_MONETARY)
Return the currency symbol, preceded by "\-" if the symbol should
#include <stdio.h>
#include <stdlib.h>
-int main()
+int
+main(void)
{
struct s {
int i;
the value of
.I errno
should be saved.
-
.SH "CONFORMING TO"
The function
.BR perror ()
.IR "memalign(sysconf(_SC_PAGESIZE),size)" .
For all three routines, the memory is not zeroed.
-
.SH "RETURN VALUE"
.BR memalign ()
and
next section on failure. Note that
.IR errno
is not set.
-
.SH "ERRORS"
.TP
.B EINVAL
.TP
.B ENOMEM
There was insufficient memory to fulfill the allocation request.
-
.SH NOTES
On many systems there are alignment restrictions, e.g. on buffers
used for direct block device I/O. POSIX specifies the
.BR malloc ()
always returns 8-byte aligned memory addresses, so these routines are only
needed if you require larger alignment values.
-
.SH AVAILABILITY
The functions
.BR memalign ()
The function
.BR posix_memalign ()
is available since glibc 2.1.91.
-
.SH "CONFORMING TO"
The function
.BR valloc ()
The function
.BR posix_memalign ()
comes from POSIX.1d.
-
.SH HEADERS
Everybody agrees that
.BR posix_memalign ()
(namely, if _GNU_SOURCE is defined, or _BSD_SOURCE is defined, or,
for glibc, if _XOPEN_SOURCE_EXTENDED is defined, or, equivalently,
_XOPEN_SOURCE is defined to a value not less than 500).
-
.SH "SEE ALSO"
.BR brk (2),
.BR getpagesize (2),
.BR Lf ,
.BR Lg ,
.BR LG ).
-
.SS "The conversion specifier"
A character that specifies the type of conversion to be applied.
The conversion specifiers and their meanings are:
.B %
A `%' is written. No argument is converted. The complete conversion
specification is `%%'.
-.PP
.SH EXAMPLE
.br
.if \w'\*(Pi'=0 .ds Pi pi
char *p, *np;
va_list ap;
- if ((p = malloc (size)) == NULL)
+ if ((p = malloc(size)) == NULL)
return NULL;
while (1) {
/* Try to print in the allocated space. */
va_start(ap, fmt);
- n = vsnprintf (p, size, fmt, ap);
+ n = vsnprintf(p, size, fmt, ap);
va_end(ap);
/* If that worked, return the string. */
if (n > \-1 && n < size)
}
.fi
.RE
-
.SH NOTES
The glibc implementation of the functions
.BR snprintf ()
.\" .PP
.\" Some floating point conversions under early libc4
.\" caused memory leaks.
-
.SH "SEE ALSO"
.BR printf (1),
.BR asprintf (3),
return a non-negative number on success, or
.B EOF
on error.
-.PP
.SH "CONFORMING TO"
C89, C99
.SH BUGS
#ifdef PATH_MAX
path_max = PATH_MAX;
#else
- path_max = pathconf (path, _PC_PATH_MAX);
+ path_max = pathconf(path, _PC_PATH_MAX);
if (path_max <= 0)
path_max = 4096;
#endif
.BI "float remquof(float " x ", float " y ", int *" quo );
.br
.BI "long double remquol(long double " x ", long double " y ", int *" quo );
-.sp
.fi
.SH DESCRIPTION
These functions compute the remainder and part of the quotient
For example, remquo(29.0,3.0) returns \-1.0 and might store 2.
Note that the actual quotient might not fit in an integer.
-
.\" A possible application of this function might be the computation
.\" of sin(x). Compute remquo(x, pi/2, &quo) or so.
.\"
\fI<resolv.h>\fP. The only field that is normally manipulated by the
user is \fI_res.options\fP. This field can contain the bitwise ``or''
of the following options:
-.sp
.TP
.B RES_INIT
True if \fBres_init\fP() has been called.
int use_tcp = 0;
char *servername = "linux";
-int main() {
+int
+main(void)
+{
struct sockaddr_in name;
struct rpc_timeval time1 = {0,0};
struct rpc_timeval timeout = {1,0};
struct hostent *hent;
int ret;
- memset((char *)&name, 0, sizeof(name));
+ memset((char *) &name, 0, sizeof(name));
sethostent(1);
hent = gethostbyname(servername);
- memcpy((char *)&name.sin_addr, hent->h_addr, hent->h_length);
+ memcpy((char *) &name.sin_addr, hent->h_addr, hent->h_length);
ret = rtime(&name, &time1, use_tcp ? NULL : &timeout);
if (ret < 0)
.I <sys/time.h>
instead of
.IR <rpc/auth_des.h> .
-
.SH "BUGS"
.BR rtime ()
in glibc <= 2.2.5 does not work properly on 64bit machines.
rta->rta_len = sizeof(unsigned int);
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) +
RTA_LENGTH(sizeof(mtu));
- memcpy(RTA_DATA(rta), &mtu, sizeof (mtu));
+ memcpy(RTA_DATA(rta), &mtu, sizeof(mtu));
send(rtnetlink_sk, &req, req.n.nlmsg_len);
.fi
.SH BUGS
.nf
/* print files in current directory in reverse order */
#include <dirent.h>
-main(){
+
+int
+main(void)
+{
struct dirent **namelist;
int n;
This structure is defined as follows:
.nf
-.in +0.25i
+.in +0.5i
struct timespec {
time_t tv_sec; /* Seconds */
long tv_nsec; /* Nanoseconds [0 .. 999999999] */
};
-
-.in -0.25i
+.in -0.5i
.fi
.PP
If the timeout has already expired by the time of the call,
int sval;
printf("sem_post() from handler\\n");
- if (sem_post(&sem) == -1) die("sem_post");
+ if (sem_post(&sem) == -1)
+ die("sem_post");
- if (sem_getvalue(&sem, &sval) == -1) die("sem_getvalue");
+ if (sem_getvalue(&sem, &sval) == -1)
+ die("sem_getvalue");
printf("sem_getvalue() from handler; value = %d\\n", sval);
} /* handler */
assert(argc == 3); /* Usage: ./a.out alarm-secs wait-secs */
- if (sem_init(&sem, 0, 0) == -1) die("sem_init");
+ if (sem_init(&sem, 0, 0) == -1)
+ die("sem_init");
/* Establish SIGALRM handler; set alarm timer using argv[1] */
sa.sa_handler = handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
- if (sigaction(SIGALRM, &sa, NULL) == -1) die("sigaction");
+ if (sigaction(SIGALRM, &sa, NULL) == -1)
+ die("sigaction");
alarm(atoi(argv[1]));
#include <stdlib.h>
#include <errno.h>
-int main() {
- struct aliasent *al;
- setaliasent();
- for (;;) {
- al = getaliasent();
- if (al == NULL) break;
- printf("Name: %s\\n", al->alias_name);
- }
- if (errno) {
- perror("reading alias");
- exit(EXIT_FAILURE);
- }
- endaliasent();
- exit(EXIT_SUCCESS);
+int
+main(void)
+{
+ struct aliasent *al;
+ setaliasent();
+ for (;;) {
+ al = getaliasent();
+ if (al == NULL)
+ break;
+ printf("Name: %s\\n", al->alias_name);
+ }
+ if (errno) {
+ perror("reading alias");
+ exit(EXIT_FAILURE);
+ }
+ endaliasent();
+ exit(EXIT_SUCCESS);
}
.fi
.SH "CONFORMING TO"
.nf
.sp
#include <stdio.h>
-int main()
+
+int
+main(void)
{
char buf[BUFSIZ];
setbuf(stdin, buf);
return 0;
}
.fi
-.sp
.SH "SEE ALSO"
.BR fclose (3),
.BR fflush (3),
using code such as the following:
.nf
- vec.sv_mask = sigmask(SIGQUIT) | sigpause (SIGABRT);
+ vec.sv_mask = sigmask(SIGQUIT) | sigpause(SIGABRT);
/* Block SIGQUIT and SIGABRT during
handler execution */
.fi
main (void)
{
char *to = buffer;
- to = stpcpy (to, "foo");
- to = stpcpy (to, "bar");
- printf ("%s\\n", buffer);
+ to = stpcpy(to, "foo");
+ to = stpcpy(to, "bar");
+ printf("%s\\n", buffer);
}
.fi
.SH "CONFORMING TO"
#include <stdio.h>
#include <time.h>
-int main() {
+int
+main(void)
+{
struct tm tm;
char buf[255];
a sequence of characters, followed by ')'.
The character string specifies in an implementation-dependent
way the type of NAN.
-
.SH "RETURN VALUE"
These functions return the converted value, if any.
.B #include <stdarg.h>
.sp
.BI "void vsyslog(int " priority ", const char *" format ", va_list " ap );
-.br
.SH DESCRIPTION
.BR closelog ()
closes the descriptor being used to write to the system logger. The use of
.TP
.B LOG_UUCP
UUCP subsystem
-
.SS level
This determines the importance of the message. The levels are, in order
of decreasing importance:
it may be necessary to follow this call with a further call to
.BR tcgetattr ()
to check that all changes have been performed successfully.
-
.SH NOTES
Unix V7 and several later systems have a list of baud rates
where after the fourteen values B0, ..., B9600 one finds the
void *root = NULL;
-void *xmalloc(unsigned n)
+void *
+xmalloc(unsigned n)
{
void *p;
p = malloc(n);
exit(1);
}
-int compare(const void *pa, const void *pb) {
+int
+compare(const void *pa, const void *pb)
+{
if (*(int *) pa < *(int *) pb)
return \-1;
if (*(int *) pa > *(int *) pb)
return 0;
}
-void action(const void *nodep, const VISIT which, const int depth) {
+void
+action(const void *nodep, const VISIT which, const int depth)
+{
int *datap;
switch(which) {
}
}
-int main() {
+int
+main(void)
+{
int i, *ptr;
void *val;
.B 4
(Implemented but no symbolic constant provided.)
Return the maximum number of files that the calling process can open.
-
.SH "RETURN VALUE"
On success,
.BR ulimit ()
.SH NAME
wordexp, wordfree \- perform word expansion like a posix-shell
.SH SYNOPSIS
-.sp
.B "#include <wordexp.h>"
.sp
.BI "int wordexp(const char *" s ", wordexp_t *" p ", int " flags );
.sp
.BI "void wordfree(wordexp_t *" p );
-.sp
.SH DESCRIPTION
The function
.BR wordexp ()
its argument, but it frees the array
.I we_wordv
and the strings that points to.
-
.SH EXAMPLE
First a small example. The output is approximately that of "ls [a-c]*.c".
.LP
#include <stdio.h>
#include <wordexp.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
wordexp_t p;
char **w;
contains a word that starts with an unquoted comment character #,
then it is unspecified whether that word and all following words
are ignored, or the # is treated as a non-comment character.
-
.SS "The expansion"
The expansion done consists of the following stages:
tilde expansion (replacing ~user by user's home directory),
.LP
Field splitting is done using the environment variable $IFS.
If it is not set, the field separators are space, tab and newline.
-
.SS "The output array"
The array
.I we_wordv
contains the words found, followed by a NULL.
-
.SS "The flags argument"
The
.I flag
.B WRDE_SYNTAX
Shell syntax error, such as unbalanced parentheses or
unmatched quotes.
-
.SH "CONFORMING TO"
POSIX.1-2001
-
.SH "SEE ALSO"
.BR fnmatch (3),
.BR glob (3)
.SH NAME
xencrypt, xdecrypt, passwd2des \- RFS password encryption
.SH SYNOPSIS
-.sp
.B "#include <rpc/des_crypt.h>"
.sp
.BI "void passwd2des(char " *passwd ", char *" key ");"
.BI "int xencrypt(char *" secret ", char *" passwd ");"
.sp
.BI "int xdecrypt(char *" secret ", char *" passwd ");"
-.sp
.SH DESCRIPTION
The function
.BR passwd2des ()
(formerly \fBdisalloc\fP)
will free the memory taken by the screen buffers for consoles
that no longer have any associated process.
-
.SH PROPERTIES
Consoles carry a lot of state. I hope to document that some other time.
The most important fact is that the consoles simulate vt100 terminals.
characters ESC c.
All escape sequences can be found in
.BR console_codes (4).
-
-.LP
.SH FILES
.I /dev/console
.br
an echoed function key.)
.PP
The action of a CSI sequence is determined by its final character.
-.PP
.TS
l l l.
@ ICH Insert the indicated # of blank characters.
semicolons.
An empty parameter (between semicolons or string initiator or
terminator) is interpreted as a zero.
-.LP
.TS
l l.
param result
LED_CAP 0x04 caps lock led
LEC_NUM 0x02 num lock led
LED_SCR 0x01 scroll lock led
-
.IP \fBKDSETLED\fP
Set the LEDs. The LEDs are set to correspond to the lower three bits of
\fIargp\fP. However, if a higher order bit is set,
flags. Since 1.1.54 the leds can be made to display arbitrary
information, but by default they display the keyboard flags.
The following two ioctl's are used to access the keyboard flags.
-
.IP \fBKDGKBLED\fP
Get keyboard flags CapsLock, NumLock, ScrollLock (not lights).
\fIargp\fP points to a char which is set to the flag state.
The low order three bits (mask 0x7) get the current flag state,
and the low order bits of the next nibble (mask 0x70) get
the default flag state. (Since 1.1.54.)
-
.IP \fBKDSKBLED\fP
Set keyboard flags CapsLock, NumLock, ScrollLock (not lights).
\fIargp\fP has the desired flag state.
The low order three bits (mask 0x7) have the flag state,
and the low order bits of the next nibble (mask 0x70) have
the default flag state. (Since 1.1.54.)
-
.IP \fBKDGKBTYPE\fP
Get keyboard type. This returns the value KB_101, defined as 0x02.
-
.IP \fBKDADDIO\fP
Add I/O port as valid. Equivalent to ioperm(arg,1,1).
-
.IP \fBKDDELIO\fP
Delete I/O port as valid. Equivalent to ioperm(arg,1,0).
-
.IP \fBKDENABIO\fP
Enable I/O to video board. Equivalent to ioperm(0x3b4, 0x3df-0x3b4+1, 1).
-
.IP \fBKDDISABIO\fP
Disable I/O to video board. Equivalent to ioperm(0x3b4, 0x3df-0x3b4+1, 0).
-
.IP \fBKDSETMODE\fP
Set text/graphics mode. \fIargp\fP is one of these:
KD_TEXT 0x00
KD_GRAPHICS 0x01
-
.IP \fBKDGETMODE\fP
Get text/graphics mode. \fIargp\fP points to a long which is set to one
of the above values.
-
.IP \fBKDMKTONE\fP
Generate tone of specified length.
The lower 16 bits of \fIargp\fP specify the period in clock cycles,
For example, \fIargp\fP = (125<<16) + 0x637 would specify
the beep normally associated with a ctrl-G.
(Thus since 0.99pl1; broken in 2.1.49-50.)
-
.IP \fBKIOCSOUND\fP
Start or stop sound generation. The lower 16 bits of
\fIargp\fP specify the period in clock cycles
(that is, \fIargp\fP = 1193180/frequency).
\fIargp\fP = 0 turns sound off.
In either case, control returns immediately.
-
.IP \fBGIO_CMAP\fP
Get the current default colour map from kernel. \fIargp\fP points to
a 48-byte array. (Since 1.3.3.)
-
.IP \fBPIO_CMAP\fP
Change the default text-mode colour map. \fIargp\fP points to a
48-byte array which contains, in order, the Red, Green, and Blue
green, brown, dark blue, dark purple, dark cyan, light grey, dark
grey, bright red, bright green, yellow, bright blue, bright purple,
bright cyan and white. (Since 1.3.3.)
-
.IP \fBGIO_FONT\fP
Gets 256-character screen font in expanded form. \fIargp\fP points to
an 8192 byte array. Fails with error code \fBEINVAL\fP if the
currently loaded font is a 512-character font, or if the console is
not in text mode.
-
.IP \fBGIO_FONTX\fP
Gets screen font and associated information. \fIargp\fP points to a
-struct consolefontdesc (see \fBPIO_FONTX\fP). On call, the
+\fIstruct consolefontdesc\fP (see \fBPIO_FONTX\fP). On call, the
\fIcharcount\fP field should be set to the maximum number of
characters that would fit in the buffer pointed to by \fIchardata\fP.
On return, the \fIcharcount\fP and \fIcharheight\fP are filled with
\fIcharcount\fP indicated enough space was available; otherwise the
buffer is untouched and \fIerrno\fP is set to \fBENOMEM\fP. (Since
1.3.1.)
-
.IP \fBPIO_FONT\fP
Sets 256-character screen font. Load font into the EGA/VGA character
generator. \fIargp\fP points to a 8192 byte map, with 32 bytes per
character. Only first \fIN\fP of them are used for an 8x\fIN\fP font
(0 < \fIN\fP <= 32). This call also invalidates the Unicode mapping.
-
.IP \fBPIO_FONTX\fP
Sets screen font and associated rendering information. \fIargp\fP
points to a
.nf
struct consolefontdesc {
- u_short \fIcharcount\fP; /* characters in font (256 or 512) */
- u_short \fIcharheight\fP; /* scan lines per character (1-32) */
- char *\fIchardata\fP; /* font data in expanded form */
+ u_short \fIcharcount\fP; /* characters in font (256 or 512) */
+ u_short \fIcharheight\fP; /* scan lines per character (1-32) */
+ char *\fIchardata\fP; /* font data in expanded form */
};
.fi
If necessary, the screen will be appropriately resized, and
\fBSIGWINCH\fP sent to the appropriate processes. This call also
invalidates the Unicode mapping. (Since 1.3.1.)
-
.IP \fBPIO_FONTRESET\fP
Resets the screen font, size and Unicode mapping to the bootup
defaults. \fIargp\fP is unused, but should be set to NULL to
ensure compatibility with future versions of Linux. (Since 1.3.28.)
-
.IP \fBGIO_SCRNMAP\fP
Get screen mapping from kernel. \fIargp\fP points to an area of size
E_TABSZ, which is loaded with the font positions used to display each
character. This call is likely to return useless information if the
currently loaded font is more than 256 characters.
-
.IP \fBGIO_UNISCRNMAP\fP
Get full Unicode screen mapping from kernel. \fIargp\fP points to an
area of size E_TABSZ*sizeof(unsigned short), which is loaded with the
Unicodes each character represent. A special set of Unicodes,
starting at U+F000, are used to represent ``direct to font'' mappings.
(Since 1.3.1.)
-
.IP \fBPIO_SCRNMAP\fP
Loads the ``user definable'' (fourth) table in the kernel which maps
bytes into console screen symbols. \fIargp\fP points to an area of
size E_TABSZ.
-
.IP \fBPIO_UNISCRNMAP\fP
Loads the ``user definable'' (fourth) table in the kernel which maps
bytes into Unicodes, which are then translated into screen symbols
according to the currently loaded Unicode-to-font map. Special
Unicodes starting at U+F000 can be used to map directly to the font
symbols. (Since 1.3.1.)
-
.IP \fBGIO_UNIMAP\fP
Get Unicode-to-font mapping from kernel. \fIargp\fP points to a
.nf
struct unimapdesc {
- u_short \fIentry_ct\fP;
- struct unipair *\fIentries\fP;
+ u_short \fIentry_ct\fP;
+ struct unipair *\fIentries\fP;
};
.fi
.nf
struct unipair {
- u_short \fIunicode\fP;
- u_short \fIfontpos\fP;
+ u_short \fIunicode\fP;
+ u_short \fIfontpos\fP;
};
.fi
(Since 1.1.92.)
-
.IP \fBPIO_UNIMAP\fP
Put unicode-to-font mapping in kernel. \fIargp\fP points to a
-struct unimapdesc. (Since 1.1.92)
-
+\fIstruct unimapdesc\fP. (Since 1.1.92)
.IP \fBPIO_UNIMAPCLR\fP
Clear table, possibly advise hash algorithm. \fIargp\fP points to a
.nf
struct unimapinit {
- u_short \fIadvised_hashsize\fP; /* 0 if no opinion */
- u_short \fIadvised_hashstep\fP; /* 0 if no opinion */
- u_short \fIadvised_hashlevel\fP; /* 0 if no opinion */
+ u_short \fIadvised_hashsize\fP; /* 0 if no opinion */
+ u_short \fIadvised_hashstep\fP; /* 0 if no opinion */
+ u_short \fIadvised_hashlevel\fP; /* 0 if no opinion */
};
.fi
(Since 1.1.92.)
-
.IP \fBKDGKBMODE\fP
Gets current keyboard mode. \fIargp\fP points to a long which is set to one
of these:
K_XLATE 0x01
K_MEDIUMRAW 0x02
K_UNICODE 0x03
-
.IP \fBKDSKBMODE\fP
Sets current keyboard mode.
\fIargp\fP is a long equal to one of the above values.
-
.IP \fBKDGKBMETA\fP
Gets meta key handling mode. \fIargp\fP points to a long which is
set to one of these:
K_METABIT 0x03 set high order bit
K_ESCPREFIX 0x04 escape prefix
-
.IP \fBKDSKBMETA\fP
Sets meta key handling mode.
\fIargp\fP is a long equal to one of the above values.
-
.IP \fBKDGKBENT\fP
Gets one entry in key translation table (keycode to action code).
\fIargp\fP points to a
\fIkb_value\fP is set to the corresponding action code,
or K_HOLE if there is no such key,
or K_NOSUCHMAP if \fIkb_table\fP is invalid.
-
.IP \fBKDSKBENT\fP
-Sets one entry in translation table. \fIargp\fP points to a struct kbentry.
-
+Sets one entry in translation table. \fIargp\fP points to
+a \fIstruct kbentry\fP.
.IP \fBKDGKBSENT\fP
Gets one function key string. \fIargp\fP points to a
\fIkb_string\fP is set to the (NULL terminated) string corresponding to
the \fIkb_func\fPth function key action code.
-
.IP \fBKDSKBSENT\fP
-Sets one function key string entry. \fIargp\fP points to a struct kbsentry.
-
+Sets one function key string entry. \fIargp\fP points to
+a \fIstruct kbsentry\fP.
.IP \fBKDGKBDIACR\fP
Read kernel accent table. \fIargp\fP points to a
where \fIkb_cnt\fP is the number of entries in the array, each of which
is a
-struct kbdiacr { u_char \fIdiacr\fP, \fIbase\fP, \fIresult\fP;
+.nf
+struct kbdiacr {
+ u_char \fIdiacr\fP;
+ u_char \fIbase\fP;
+ u_char \fIresult\fP;
};
-
.IP \fBKDGETKEYCODE\fP
Read kernel keycode table entry (scan code to keycode).
\fIargp\fP points to a
.nf
-struct kbkeycode { unsigned int \fIscancode\fP, \fIkeycode\fP; };
+struct kbkeycode {
+ unsigned int \fIscancode\fP;
+ unsigned int \fIkeycode\fP;
+};
.fi
\fIkeycode\fP is set to correspond to the given \fIscancode\fP.
(89 <= \fIscancode\fP <= 255 only.
For 1 <= \fIscancode\fP <= 88, \fIkeycode\fP==\fIscancode\fP.)
(Since 1.1.63.)
-
.IP \fBKDSETKEYCODE\fP
-Write kernel keycode table entry. \fIargp\fP points to struct kbkeycode.
+Write kernel keycode table entry. \fIargp\fP points to
+a \fIstruct kbkeycode\fP.
(Since 1.1.63.)
-
.IP \fBKDSIGACCEPT\fP
The calling process indicates its willingness to accept the signal
\fIargp\fP when it is generated by pressing an appropriate key combination.
(1 <= \fIargp\fP <= NSIG).
(See spawn_console() in linux/drivers/char/keyboard.c.)
-
.IP \fBVT_OPENQRY\fP
Returns the first available (non-opened) console.
\fIargp\fP points to an int which is set to the
number of the vt (1 <= \fI*argp\fP <= MAX_NR_CONSOLES).
-
.IP \fBVT_GETMODE\fP
Get mode of active vt. \fIargp\fP points to a
};
.fi
-\&...which is set to the mode of the active vt.
+which is set to the mode of the active vt.
\fImode\fP is set to one of these values:
VT_AUTO auto vt switching
VT_PROCESS process controls switching
VT_ACKACQ acknowledge switch
-
.IP \fBVT_SETMODE\fP
-Set mode of active vt. \fIargp\fP points to a struct vt_mode.
-
+Set mode of active vt. \fIargp\fP points to
+a \fIstruct vt_mode\fP.
.IP \fBVT_GETSTATE\fP
Get global vt state info. \fIargp\fP points to a
For each vt in use, the corresponding bit in the \fIv_state\fP member is set.
(Kernels 1.0 through 1.1.92.)
-
.IP \fBVT_RELDISP\fP
Release a display.
-
.IP \fBVT_ACTIVATE\fP
Switch to vt \fIargp\fP (1 <= \fIargp\fP <= MAX_NR_CONSOLES).
-
.IP \fBVT_WAITACTIVE\fP
Wait until vt \fIargp\fP has been activated.
-
.IP \fBVT_DISALLOCATE\fP
Deallocate the memory associated with vt \fIargp\fP.
(Since 1.1.54.)
-
.IP \fBVT_RESIZE\fP
Set the kernel's idea of screensize. \fIargp\fP points to a
See
.BR resizecons (8).
(Since 1.1.54.)
-
.IP \fBVT_RESIZEX\fP
Set the kernel's idea of various screen parameters. \fIargp\fP
points to a
this does not change the videomode. See
.BR resizecons(8).
(Since 1.3.3.)
-
.PP
The action of the following ioctls depends on the first byte in the struct
pointed to by \fIargp\fP, referred to here as the \fIsubcode\fP.
Dump the screen.
Disappeared in 1.1.92. (With kernel 1.1.92 or later, read from
/dev/vcsN or /dev/vcsaN instead.)
-
.IP "\fBTIOCLINUX, subcode=1\fP"
Get task information. Disappeared in 1.1.92.
-
.IP "\fBTIOCLINUX, subcode=2\fP"
Set selection.
\fIargp\fP points to a
+.nf
- struct {char \fIsubcode\fP;
- short \fIxs\fP, \fIys\fP, \fIxe\fP, \fIye\fP;
- short \fIsel_mode\fP;
- }
+struct {
+ char \fIsubcode\fP;
+ short \fIxs\fP, \fIys\fP, \fIxe\fP, \fIye\fP;
+ short \fIsel_mode\fP;
+}
+.fi
\fIxs\fP and \fIys\fP are the starting column and row.
\fIxe\fP and \fIye\fP are the ending
column and row. (Upper left corner is row=column=1.)
or 2 for line-by-line selection.
The indicated screen characters are highlighted and saved
in the static array sel_buffer in devices/char/console.c.
-
.IP "\fBTIOCLINUX, subcode=3\fP"
Paste selection.
The characters in the selection buffer are
written to \fIfd\fP.
-
.IP "\fBTIOCLINUX, subcode=4\fP"
Unblank the screen.
-
.IP "\fBTIOCLINUX, subcode=5\fP"
Sets contents of a 256-bit look up table defining characters in a "word",
for word-by-word selection. (Since 1.1.32.)
-
.IP "\fBTIOCLINUX, subcode=6\fP"
\fIargp\fP points to a char which is set to the value of the kernel
variable \fIshift_state\fP. (Since 1.1.32.)
-
.IP "\fBTIOCLINUX, subcode=7\fP"
\fIargp\fP points to a char which is set to the value of the kernel
variable \fIreport_mouse\fP. (Since 1.1.33.)
-
.IP "\fBTIOCLINUX, subcode=8\fP"
Dump screen width and height, cursor position, and all the
character-attribute pairs.
(Kernels 1.1.67 through 1.1.91 only.
With kernel 1.1.92 or later, read from /dev/vcsa* instead.)
-
.IP "\fBTIOCLINUX, subcode=9\fP"
Restore screen width and height, cursor position, and all the
character-attribute pairs.
(Kernels 1.1.67 through 1.1.91 only.
With kernel 1.1.92 or later, write to /dev/vcsa* instead.)
-
.IP "\fBTIOCLINUX, subcode=10\fP"
Handles the Power Saving
feature of the new generation of monitors.
(\fICaution:\fP Powering down frequently will damage the monitor.)
(Since 1.1.76.)
-
.SH "RETURN VALUE"
On success, 0 is returned. On error \-1 is returned, and \fIerrno\fP is set.
.SH ERRORS
\fIerrno\fP may take on these values:
-
.TP
.B EBADF
The file descriptor is invalid.
on future versions of Linux.
Use POSIX functions.
-
.SH "SEE ALSO"
.BR dumpkeys (1),
.BR kbd_mode (1),
.PP
Drive independent device files which automatically detect the media
format and capacity:
-.PP
.TS
l l.
Name Base minor #
.TE
.PP
5.25 inch double density device files:
-.PP
.TS
lw(1i) l l l l l.
Name Capac. Cyl. Sect. Heads Base minor #
.TE
.PP
5.25 inch high density device files:
-.PP
.TS
lw(1i) l l l l l.
Name Capac. Cyl. Sect. Heads Base minor #
.TE
.PP
3.5 inch double density device files:
-.PP
.TS
lw(1i) l l l l l.
Name Capac. Cyl. Sect. Heads Base minor #
.TE
.PP
3.5 inch high density device files:
-.PP
.TS
lw(1i) l l l l l.
Name Capac. Cyl. Sect. Heads Base minor #
.TE
.PP
3.5 inch extra density device files:
-.PP
.TS
lw(1i) l l l l l.
Name Capac. Cyl. Sect. Heads Base minor #
mknod \-m 666 /dev/full c 1 7
chown root:root /dev/full
-
.fi
.SH FILES
/dev/full
.IP "\fBint ioctl(int \fP\fIfd\fP\fB, LPGETSTATUS, int *\fP\fIarg\fP\fB)\fP"
Stores the value of the status port in \fIarg\fP. The bits have the following
meaning:
-.sp
.TS
l l.
LP_PBUSY inverted busy input, active high
mknod \-m 660 /dev/mem c 1 1
.br
chown root:kmem /dev/mem
-.sp
.RE
.LP
The file
mknod \-m 640 /dev/kmem c 1 2
.br
chown root:kmem /dev/kmem
-.sp
.RE
.LP
\fBport\fP is similar to
mknod \-m 660 /dev/port c 1 4
.br
chown root:mem /dev/port
-.sp
.RE
.SH FILES
.I /dev/mem
.SH DESCRIPTION
.SS Introduction
The pinout of the usual 9 pin plug as used for serial mice is:
-
.TS
center;
r c l.
speeds 9600, 4800, 2400 and 1200 bit/s, each time writing the two characters
from the table below and waiting 0.1 seconds. The following table shows
available speeds and the strings that select them:
-
.TS
center;
l l.
3-byte packets. The \fIdx\fP and \fIdy\fP movements are sent as
two's-complement, \fIlb\fP (\fIrb\fP) are set when the left (right)
button is pressed:
-
.TS
center;
r c c c c c c c.
values, \fIdy\fP is send as negated sum of the two two's-complement
values. \fIlb\fP (\fImb\fP, \fIrb\fP) are cleared when the left (middle,
right) button is pressed:
-
.TS
center;
r c c c c c c c c.
packets. \fIdx\fP and \fIdy\fP are sent as single signed values, the
sign bit indicating a negative value. \fIlb\fP (\fImb\fP, \fIrb\fP) are
set when the left (middle, right) button is pressed:
-
.TS
center;
r c c c c c c c c.
2 0 dx6 dx5 dx4 dx3 dx2 dx1 dx0
3 0 dy6 dy5 dy4 dy3 dy2 dy1 dy0
.TE
-
.SH FILES
.TP
.I /dev/mouse
A commonly used symlink pointing to a mouse device.
-
.SH "SEE ALSO"
.BR ttyS (4),
.BR gpm (8)
mknod \-m 666 /dev/zero c 1 5
.br
chown root:root /dev/null /dev/zero
-.sp
.RE
.SH NOTES
If these devices are not writable and readable for all users, many
mknod \-m 660 /dev/ram b 1 1
.br
chown root:disk /dev/ram
-.sp
.RE
.SH FILES
/dev/ram
Devices are typically created by:
.RS
.nf
+
mknod \-m 666 /dev/st0 c 9 0
mknod \-m 666 /dev/st0l c 9 32
mknod \-m 666 /dev/st0m c 9 64
The driver returns an EIO error if the drive rejects an operation.
.PP
.nf
-.ta +.4i +.7i +1i
/* Structure for \s-1MTIOCTOP\s+1 \- mag tape op command: */
struct mtop {
- short mt_op; /* operations defined below */
- int mt_count; /* how many of them */
+ short mt_op; /* operations defined below */
+ int mt_count; /* how many of them */
};
.fi
.PP
.nf
/* structure for \s-1MTIOCGET\s+1 \- mag tape get status command */
struct mtget {
- long mt_type;
- long mt_resid;
+ long mt_type;
+ long mt_resid;
/* the following registers are device dependent */
- long mt_dsreg;
- long mt_gstat;
- long mt_erreg;
+ long mt_dsreg;
+ long mt_gstat;
+ long mt_erreg;
/* The next two fields are not always used */
- daddr_t mt_fileno;
- daddr_t mt_blkno;
+ daddr_t mt_fileno;
+ daddr_t mt_blkno;
};
.fi
.IP \fBmt_type\fP 11
.PP
.nf
/* structure for \s-1MTIOCPOS\s+1 \- mag tape get position command */
-struct mtpos {
- long mt_blkno; /* current block number */
+struct mtpos {
+ long mt_blkno; /* current block number */
};
-
.fi
.SH "RETURN VALUE"
.IP EIO 14
mknod \-m 660 /dev/ttyS3 c 4 67 # base address 0x2e8
.br
chown root:tty /dev/ttyS[0\-3]
-.sp
.RE
.SH FILES
/dev/ttyS[0\-3]
.BR "#include <termios.h>"
.sp
.BI "int ioctl(int " fd ", int " cmd ", ...);"
-.sp
.SH DESCRIPTION
The
.BR ioctl ()
makes for non-portable programs. Use the POSIX interface described in
.BR termios (3)
whenever possible.
-
.SS "Get and Set Terminal Attributes"
.TP
.BI "TCGETS struct termios *" argp
.BI "TCSETAW const struct termio *" argp
.TP
.BI "TCSETAF const struct termio *" argp
-
.SS "Locking the termios structure"
The termios structure of a tty can be locked. The lock is itself
a termios structure, with non-zero bits or fields indicating a
.BI "TIOCSLCKTRMIOS const struct termios *" argp
Sets the locking status of the termios structure of
the terminal. Only root can do this.
-
.SS "Get and Set Window Size"
Window sizes are kept in the kernel, but not used by the kernel
(except in the case of virtual consoles, where the kernel will
.nf
struct winsize {
- unsigned short ws_row;
- unsigned short ws_col;
- unsigned short ws_xpixel; /* unused */
- unsigned short ws_ypixel; /* unused */
+ unsigned short ws_row;
+ unsigned short ws_col;
+ unsigned short ws_xpixel; /* unused */
+ unsigned short ws_ypixel; /* unused */
};
.fi
When the window size changes, a SIGWINCH signal is sent to the
foreground process group.
-
.SS "Sending a Break"
.TP
.BI "TCSBRK int " arg
.TP
.BI "TIOCCBRK void"
Turn break off, that is, stop sending zero bits.
-
.SS "Software flow control"
.TP
.BI "TCXONC int " arg
See
.BR tcflow (3)
for the argument values TCOOFF, TCOON, TCIOFF, TCION.
-
.SS "Buffer count and flushing"
.TP
.BI "FIONREAD int *" argp
See
.BR tcflush (3)
for the argument values TCIFLUSH, TCOFLUSH, TCIOFLUSH.
-
.SS "Faking input"
.TP
.BI "TIOCSTI const char *" argp
Insert the given byte in the input queue.
-
.SS "Redirecting console output"
.TP
.BI "TIOCCONS void"
.I /dev/console
or
.IR /dev/tty0 .
-
.SS "Controlling tty"
.TP
.BI "TIOCSCTTY int " arg
give up this controlling tty. If the process was session leader,
then send SIGHUP and SIGCONT to the foreground process group
and all processes in the current session lose their controlling tty.
-
.SS "Process group and session ID"
.TP
.BI "TIOCGPGRP pid_t *" argp
.BI "TIOCGSID pid_t *" argp
Get the session ID of the given tty. This will fail with ENOTTY
in case the tty is not a master pty and not our controlling tty. Strange.
-
.SS "Exclusive mode"
.TP
.BI "TIOCEXCL void"
.TP
.BI "TIOCNXCL void"
Disable exclusive mode.
-
.SS "Line discipline"
.TP
.BI "TIOCGETD int *" argp
.TP
.BI "TIOCSETD const int *" argp
Set the line discipline of the tty.
-
.SS "Pseudo-tty ioctls"
.TP
.BI "TIOCPKT const int *" argp
The BSD ioctls TIOCSTOP, TIOCSTART, TIOCUCNTL, TIOCREMOTE
have not been implemented under Linux.
-
.SS "Modem control"
.TP
.BI "TIOCMGET int *" argp
TIOCM_RI see TIOCM_RNG
TIOCM_DSR DSR (data set ready)
.fi
-
.SS "Marking a line as local"
.TP
.BI "TIOCGSOFTCAR int *" argp
If CLOCAL is set, the line behaves as if DCD is always asserted.
The software carrier flag is usually turned on for local devices,
and is off for lines with modems.
-
.SS "Linux specific"
For the TIOCLINUX ioctl, see
.BR console_ioctl (4).
-
.SS "Kernel debugging"
.sp
.BR "#include <linux/tty.h>"
-.sp
.TP
.BI "TIOCTTYGSTRUCT struct tty_struct *" argp
Get the tty_struct corresponding to
.\" .TP
.\" .BI "TIOCSSERIAL const struct serial_struct *" argp
.\" Set serial info.
-
.SH "RETURN VALUE"
The
.BR ioctl ()
system call returns 0 on success. On error it returns \-1 and sets
.I errno
appropriately.
-
.SH ERRORS
.TP
.B ENOIOCTLCMD
#include <fcntl.h>
#include <sys/ioctl.h>
-main() {
+int
+main(void)
+{
int fd, serial;
fd = open("/dev/ttyS0", O_RDONLY);
close(fd);
}
.fi
-
.SH "SEE ALSO"
.BR ioctl (2),
.BR termios (3),
there:
.nf
- #include <unistd.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
- int main() {
- int fd;
- char *device = "/dev/vcsa2";
- struct {unsigned char lines, cols, x, y;} scrn;
- char ch, attrib;
+int
+main(void)
+{
+ int fd;
+ char *device = "/dev/vcsa2";
+ struct {unsigned char lines, cols, x, y;} scrn;
+ char ch, attrib;
- fd = open(device, O_RDWR);
- if (fd < 0) {
- perror(device);
- exit(1);
- }
- (void) read(fd, &scrn, 4);
- (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0);
- (void) read(fd, &ch, 1);
- (void) read(fd, &attrib, 1);
- printf("ch='%c' attrib=0x%02x\\n", ch, attrib);
- attrib ^= 0x10;
- (void) lseek(fd, \-1, 1);
- (void) write(fd, &attrib, 1);
- return 0;
+ fd = open(device, O_RDWR);
+ if (fd < 0) {
+ perror(device);
+ exit(1);
}
+ (void) read(fd, &scrn, 4);
+ (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0);
+ (void) read(fd, &ch, 1);
+ (void) read(fd, &attrib, 1);
+ printf("ch='%c' attrib=0x%02x\\n", ch, attrib);
+ attrib ^= 0x10;
+ (void) lseek(fd, \-1, 1);
+ (void) write(fd, &attrib, 1);
+ return 0;
+}
.fi
-
.SH FILES
/dev/vcs[0\-63]
.br
number sign (
.B #
).
-
.PP
The charmap-definition itself starts with the keyword
.B CHARMAP
.TP
.I <symbolic-name> <encoding> <comments>
This form defines exactly one character and its encoding.
-
.TP
.I <symbolic-name>...<symbolic-name> <encoding> <comments>
This form defines a couple of characters. This is only useful for
mutlibyte-characters, which are currently not implemented.
-
.PP
The last line in a charmap-definition file must contain
.B END CHARMAP.
terminal-specific one.
.PP
The following statements are recognized; case is insignificant:
-.PP
.TP
.B TERM \fIterminal-type\fR
Starts a terminal-specific section and specifies which terminal it
for the mount command, and for the available mount options.
Below a short description of a few of the available filesystems.
-
.TP
.B "minix"
is the filesystem used in the Minix operating system, the first to run
appropriate configuration information. The keywords recognized are
.IR order ", " trim ", " multi ", " nospoof ", " spoof ", and " reorder .
These keywords are described below.
-
.TP
.I order
This keyword specifies how host lookups are to be performed. It
is followed by a character that will be used as the
comment-character for the rest of the file. It defaults to the
number sign (#).
-
.PP
The locale definition has one part for each locale category.
Each part can be copied from another existing locale or
the only valid keyword in the definition is
.B copy
followed by the name of the locale which should be copied.
-
.\" FIXME glibc 2.2.2 added new non-standard locale categories:
.\" LC_ADDRESS, LC_IDENTIFICATION, LC_MEASUREMENT, LC_NAME,
.\" LC_PAPER, LC_TELEPHONE. These need to be documented.
in the first column.
There are the following keywords allowed:
-
.TP
.I upper
followed by a list of uppercase letters. The letters
or
.B space
are not allowed.
-
.TP
.I lower
followed by a list of lowercase letters. The letters
or
.B space
are not allowed.
-
.TP
.I alpha
followed by a list of letters. All character specified as either
or
.B space
are not allowed.
-
.TP
.I digit
followed by the characters classified as numeric digits. Only the
trough
.B 9
are allowed. They are included by default in this class.
-
.TP
.I space
followed by a list of characters defined as white-space
and
.B <vertical-tab>
are automatically included.
-
.TP
.I cntrl
followed by a list of control characters.
or the
.B <space>
character are not allowed.
-
.TP
.I graph
followed by a list of printable characters, not including the
Characters also specified as
.B cntrl
are not allowed.
-
.TP
.I print
followed by a list of printable characters, including the
Characters also specified as
.B cntrl
are not allowed.
-
.TP
.I xdigit
followed by a list of characters classified as hexadecimal
.B A
trough
.BR F .
-
.TP
.I blank
followed by a list of characters classified as
and
.B <tab>
are automatically included.
-
.TP
.I toupper
followed by a list of mappings from lowercase to uppercase
followed by a list of mappings from uppercase to lowercase
letters. If the keyword tolower is not present, the reverse of the
toupper list is used.
-
.PP
The
.B LC_CTYPE
definition ends with the string
.I END LC_CYTPE.
-
.SS LC_COLLATE
The
.B LC_COLLATE
in the first column.
There are the following keywords allowed:
-
.TP
.I collating-element
-
.TP
.I collating-symbol
-
.PP
The order-definition starts with a line:
.TP
.TP
.IR order_end .
.PP
-
For more details see the sources in
.I /usr/lib/nls/src
notably the examples
.B Example
and
.B Example2
-
.PP
The
.B LC_COLLATE
definition ends with the string
.IR END LC_COLLATE .
-
.SS LC_MONETARY
The definition starts with the string
.B LC_MONETARY
in the first column.
There are the following keywords allowed:
-
.TP
.I int_curr_symbol
followed by the international currency symbol. This must be a
.B LC_MONETARY
definition ends with the string
.I END LC_MONETARY.
-
.SS LC_NUMERIC
The definition starts with the string
.B LC_NUMERIC
in the first column.
The following keywords are allowed:
-
.TP
.I decimal_point
followed by the string that will be used as the decimal delimiter
.B LC_NUMERIC
definition ends with the string
.I END LC_NUMERIC.
-
.SS LC_TIME
The definition starts with the string
.B LC_TIME
in the first column.
The following keywords are allowed:
-
.TP
.I abday
followed by a list of abbreviated weekday names. The list starts with
.B LC_TIME
definition ends with the string
.I END LC_TIME.
-
.SS LC_MESSAGES
The definition starts with the string
.B LC_MESSAGES
in the first column.
The following keywords are allowed:
-
.TP
.I yesexpr
followed by a regular expression that describes possible
.I noexpr
followed by a regular expression that describes possible
no-responses.
-
.PP
The
.B LC_MESSAGES
comment; following characters, up to the end of the line,
are not interpreted by nscd.
-
-Valid services are passwd, group, or hosts.
+Valid services are \fIpasswd\fI, \fIgroup\fI, or \fIhosts\fI.
.B logfile
.I debug-file-name
that they can directly search in them instead of having to ask the
daemon over the socket each time a lookup is performed.
.RE
-
.SH "SEE ALSO"
.BR nscd (8)
.SH AUTHOR
The service is temporarily unavailable. This could mean a file is
locked or a server currently cannot accept more connections. The
default action is `continue'.
-.LP
.SS Interaction with +/\- syntax (compat mode)
Linux libc5 without NYS does not have the name service switch but does
allow the user some policy control. In
.RE
.sp
The field descriptions are:
-.sp
.RS
.TP 1.0in
.I account
.TH PROC 5 2005-05-12 "" "Linux Programmer's Manual"
.SH NAME
proc \- process information pseudo-filesystem
-
.SH DESCRIPTION
The
.I proc
.TP
.IR /proc/vmstat " (since Linux 2.6)"
This file displays various virtual memory statistics.
-
.TP
.IR /proc/zoneinfo " (since Linux 2.6.13)"
This file display information about memory zones.
of the line following it are ignored.
The field descriptions are:
-
.TP
.I protocol
the native name for the protocol. For example ip, tcp, or udp.
.I aliases
optional aliases for the protocol.
.LP
-
This file might be distributed over a network using a networkwide
naming service like Yellow Pages/NIS or BIND/Hesiod.
-
.SH FILES
.TP
.I /etc/protocols
service (but see the BUGS section below). Again, the names are case
sensitive.
.PP
-
Either spaces or tabs may be used to separate the fields.
Comments are started by the hash sign (#) and continue until the end
ftp 21/tcp
# 22 \- unassigned
telnet 23/tcp
-.sp
.fi
.RE
.SH BUGS
.nf
echo "\fIcache_name limit batchcount\fP" > /proc/slabinfo
.fi
-
.SH AVAILABILITY
.I /proc/slabinfo
exists since Linux 2.1.23.
SMP per-CPU caches exist since Linux 2.4.0-test3.
-
.SH FILES
.I <linux/slab.h>
con80x25 tty1
.br
vt320 ttys0
-.sp
.RE
.SH FILES
.TP
#define UT_HOSTSIZE 256
struct exit_status {
- short int e_termination; /* process termination status */
- short int e_exit; /* process exit status */
+ short int e_termination; /* process termination status */
+ short int e_exit; /* process exit status */
};
struct utmp {
- short ut_type; /* type of login */
- pid_t ut_pid; /* PID of login process */
- char ut_line[UT_LINESIZE]; /* device name of tty \- "/dev/" */
- char ut_id[4]; /* init id or abbrev. ttyname */
- char ut_user[UT_NAMESIZE]; /* user name */
- char ut_host[UT_HOSTSIZE]; /* hostname for remote login */
- struct exit_status ut_exit; /* The exit status of a process
- marked as DEAD_PROCESS */
+ short ut_type; /* type of login */
+ pid_t ut_pid; /* PID of login process */
+ char ut_line[UT_LINESIZE]; /* device name of tty \- "/dev/" */
+ char ut_id[4]; /* init id or abbrev. ttyname */
+ char ut_user[UT_NAMESIZE]; /* user name */
+ char ut_host[UT_HOSTSIZE]; /* hostname for remote login */
+ struct exit_status ut_exit; /* The exit status of a process
+ marked as DEAD_PROCESS */
- /* The ut_session and ut_tv fields must be the same size when
- compiled 32- and 64-bit. This allows data files and shared
- memory to be shared between 32- and 64-bit applications */
+ /* The ut_session and ut_tv fields must be the same size when
+ compiled 32- and 64-bit. This allows data files and shared
+ memory to be shared between 32- and 64-bit applications */
#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
- int32_t ut_session; /* Session ID, used for windowing */
- struct {
- int32_t tv_sec; /* Seconds */
- int32_t tv_usec; /* Microseconds */
- } ut_tv; /* Time entry was made */
+ int32_t ut_session; /* Session ID, used for windowing */
+ struct {
+ int32_t tv_sec; /* Seconds */
+ int32_t tv_usec; /* Microseconds */
+ } ut_tv; /* Time entry was made */
#else
- long int ut_session; /* Session ID, used for windowing */
- struct timeval ut_tv; /* Time entry was made */
+ long int ut_session; /* Session ID, used for windowing */
+ struct timeval ut_tv; /* Time entry was made */
#endif
- int32_t ut_addr_v6[4]; /* IP address of remote host */
- char __unused[20]; /* Reserved for future use */
+ int32_t ut_addr_v6[4]; /* IP address of remote host */
+ char __unused[20]; /* Reserved for future use */
};
/* Backwards compatibility hacks. */
.sp
.ta 3i
gettimeofday((struct timeval *) &ut.ut_tv, NULL);
-.sp
.fi
.RE
gettimeofday(&tv, NULL);
ut.ut_tv.tv_sec = tv.tv_sec;
ut.ut_tv.tv_usec = tv.tv_usec;
-.sp
.fi
.RE
.SH FILES
receives a request for an address it forwards to and proxy arp is
enabled on the receiving interface.
When there is a reject route for the target no proxy arp entry is added.
-
.SH IOCTLS
Three ioctls are available on all
.B PF_INET
.IR arp_dev .
.I arp_dev
is a zero-terminated string which names a device.
-
+.RS
.TS
tab(:) allbox;
c s
ATF_NETMASK:Use a netmask
ATF_DONTPUB:Don't answer
.TE
+.RE
.PP
-
If the
.B ATF_NETMASK
flag is set, then
should be set to 0xffffffff, or 0 to remove an existing proxy arp entry.
.B ATF_USETRAILERS
is obsolete and should not be used.
-
.SH SYSCTLS
ARP supports a sysctl interface to configure parameters on a global
or per-interface basis.
The maximum number of packets which may be queued for each unresolved
address by other network layers.
Defaults to 3.
-
.SH BUGS
Some timer settings are specified in jiffies, which is architecture
related.
This man page mashes IPv4 specific and shared between IPv4 and IPv6
functionality together.
-
.SH VERSIONS
The
.I struct arpreq
forwarding and proxy arp is enabled for the interface).
The neigh/* sysctls did not exist before Linux 2.2.
-
.SH "SEE ALSO"
.BR capabilities (7),
.BR ip (7)
The following table contains the 128 ASCII characters.
.LP
C program \f(CW'\eX'\fP escapes are noted.
-.LP
.if t \{\
.in 1i
.ft CW
(iii) kernel startup, (iv) init and inittab,
(v) boot scripts.
We will describe each of these in more detail below.
-
.SS "Hardware\-boot"
After power\-on or hard reset, control is given
to a program stored on read only memory (normally
Then the hardware boot stage accesses the boot device,
loads the OS Loader, which is located on a fixed position
on the boot device, and transfers control to it.
-
.TP
Note:
We do not cover here booting from network. Those who want
to investigate this subject may want to research:
DHCP, TFTP, PXE, Etherboot.
-
.SS "OS Loader"
In PC, the OS Loader is located in the first sector
of the boot device \- this is the \fBMBR\fR
kernel (maybe a backup in case the last compiled one
isn't functioning) and to pass optional parameters
to the kernel.
-
.SS "Kernel Startup"
When the kernel is loaded, it initializes the devices (via
their drivers), starts the swapper (it is a "kernel process",
program
.IR /sbin/init ,
passing any parameters that weren't handled by the kernel already.
-
.SS "init and inittab"
When init starts it reads
.I /etc/inittab
However, since it is not convenient to manage individual services
by editing this file, inittab only bootstraps a set of scripts
that actually start/stop the individual services.
-
.SS "Boot Scripts"
.TP
Suse, Caldera). Some systems (Slackware Linux, FreeBSD, OpenBSD)
have a somewhat different scheme of boot scripts.
.LP
-
For each managed service (mail, nfs server, cron, etc.) there is
a single startup script located in a specific directory
.RI ( /etc/init.d
accept other "convenience" parameters (e.g: 'restart', to stop and then
start, 'status' do display the service status). Running the script
without parameters displays the possible arguments.
-
.SS "Sequencing Directories"
To make specific scripts start/stop at specific run-levels and in
specific order, there are \fIsequencing directories\fR. These
However, on many versions of Linux, there are tools to help with this task
(e.g:
.BR chkconfig (8)).
-
.SS "Boot Configuration"
Usually the daemons started may optionally receive command line options
and parameters. To allow system administrators to change these
.IR /etc/init.d/ ,
.IR /etc/rc[S0\-6].d/ .
.I /etc/sysconfig/
-
.SH "SEE ALSO"
.BR inittab (5),
.BR bootparam (7),
into a SB compatible mode. Booting DOS with the supplied driver, and
then loading Linux from the DOS prompt with loadlin avoids the reset
of the card that happens if one rebooted instead.
-
.SH "THE ARGUMENT LIST"
-
The kernel command line is parsed into a list of strings
(boot arguments) separated by spaces. Most of the boot args
take the form of:
to boot the computer in single user mode, and not launch all the usual
daemons. Check the manual page for the version of init installed on
your system to see what arguments it accepts.
-
.SH "GENERAL NON-DEVICE SPECIFIC BOOT ARGS"
-
.SS "`init=...'"
-
This sets the initial command to be executed by the kernel.
If this is not set, or cannot be found, the kernel will try
.IR /etc/init ,
then
.IR /bin/sh
and panic if all of this fails.
-
.SS "`nfsaddrs=...'"
-
This sets the nfs boot address to the given string.
This boot address is used in case of a net boot.
-
.SS "`nfsroot=...'"
-
This sets the nfs root name to the given string. If this string
does not begin with '/' or ',' or a digit, then it is prefixed by
`/tftpboot/'. This root name is used in case of a net boot.
-
.SS "`no387'"
-
(Only when CONFIG_BUGi386 is defined.)
Some i387 coprocessor chips have bugs that show up when used in 32 bit
protected mode. For example, some of the early ULSI-387 chips would
Using the `no387' boot arg causes Linux to ignore the maths
coprocessor even if you have one. Of course you must then have your
kernel compiled with math emulation support!
-
.SS "`no-hlt'"
-
(Only when CONFIG_BUGi386 is defined.)
Some of the early i486DX-100 chips have a problem with the `hlt'
instruction, in that they can't reliably return to operating mode
Linux to just run an infinite loop when there is nothing else to do,
and to not halt the CPU. This allows people with these broken chips
to use Linux.
-
.SS "`root=...'"
-
This argument tells the kernel what device is to be used as the root
filesystem while booting. The default of this setting is determined
at compile time, and usually is the value of the root device of the
possible root devices in major/minor format is also accepted. (E.g.,
/dev/sda3 is major 8, minor 3, so you could use `root=0x803' as an
alternative.)
-
.SS "`ro' and `rw'"
-
The `ro' option tells the kernel to mount the root filesystem
as `readonly' so that filesystem consistency check programs (fsck)
can do their work on a quiescent file system. No processes can
The choice between read-only and read/write can also be set using
.BR rdev (8).
-
.SS "`reserve=...'"
-
This is used to protect I/O port regions from probes. The form of the
command is:
.IP
.LP
keeps all device drivers except the driver for `blah' from probing
0x300-0x31f.
-
.SS "`mem=...'"
-
The BIOS call defined in the PC specification that returns
the amount of installed memory was only designed to be able
to report up to 64MB. Linux uses this BIOS call at boot to
You can also use the boot argument `mem=nopentium' to turn off 4 MB
pagetables on kernels configured for IA32 systems with a pentium or newer
CPU.
-
.SS "`panic=N'"
By default the kernel will not reboot after a panic, but this option
will cause a kernel reboot after N seconds (if N > 0).
This panic timeout can also be set by "echo N > /proc/sys/kernel/panic".
-
.SS "`reboot=[warm|cold][,[bios|hard]]'"
(Only when CONFIG_BUGi386 is defined.)
Since 2.0.22 a reboot is by default a cold reboot.
to pulse the reset line low, but there is at least one type
of motherboard where that doesn't work. The option `reboot=bios' will
instead jump through the BIOS.
-
.SS "`nosmp'" and "`maxcpus=N'"
(Only when __SMP__ is defined.)
A command-line option of `nosmp' or `maxcpus=0' will disable SMP
activation entirely; an option `maxcpus=N' limits the maximum number
of CPUs activated in SMP mode to N.
-
-
.SH "BOOT ARGUMENTS FOR USE BY KERNEL DEVELOPERS"
-
.SS "`debug'"
-
Kernel messages are handed off to the kernel log daemon klogd so that they
may be logged to disk. Messages with a priority above
.I console_loglevel
The console loglevel can also be set at run time via an option
to klogd. See
.BR klogd (8).
-
.SS "`profile=N'"
-
It is possible to enable a kernel profiling function,
if one wishes to find out where the kernel is spending its CPU cycles.
Profiling is enabled by setting the variable
Writing to
.I /proc/profile
will clear the counters.
-
.SS "`swap=N1,N2,N3,N4,N5,N6,N7,N8'"
Set the eight parameters max_page_age, page_advance, page_decline,
page_initial_age, age_cluster_fract, age_cluster_min, pageout_weight,
bufferout_weight that control the kernel swap algorithm.
For kernel tuners only.
-
.SS "`buff=N1,N2,N3,N4,N5,N6'"
Set the six parameters max_buff_age, buff_advance, buff_decline,
buff_initial_age, bufferout_weight, buffermem_grace that control
kernel buffer memory management. For kernel tuners only.
-
-
-
.SH "BOOT ARGUMENTS FOR RAMDISK USE"
(Only if the kernel was compiled with CONFIG_BLK_DEV_RAM.)
In general it is a bad idea to use a ramdisk under Linux \(em
.IR /usr/src/linux/Documentation/ramdisk.txt .
There are four parameters, two boolean and two integral.
-
.SS "`load_ramdisk=N'"
If N=1, do load a ramdisk. If N=0, do not load a ramdisk.
(This is the default.)
-
.SS "`prompt_ramdisk=N'"
If N=1, do prompt for insertion of the floppy. (This is the default.)
If N=0, do not prompt. (Thus, this parameter is never needed.)
-
.SS "`ramdisk_size=N' or (obsolete) `ramdisk=N'"
Set the maximal size of the ramdisk(s) to N kB. The default is 4096 (4 MB).
-
.SS "`ramdisk_start=N'"
Sets the starting block number (the offset on the floppy where
the ramdisk starts) to N.
This is needed in case the ramdisk follows a kernel image.
-
.SS "`noinitrd'"
(Only if the kernel was compiled with CONFIG_BLK_DEV_RAM
and CONFIG_BLK_DEV_INITRD.)
(This device can be used only once: the data is freed as soon as
the last process that used it has closed
.IR /dev/initrd .)
-
-
.SH "BOOT ARGUMENTS FOR SCSI DEVICES"
-
General notation for this section:
.I iobase
one indicates parity checking is enabled, and a zero disables parity
checking. Again, not all adapters will support selection of parity
behaviour as a boot argument.
-
.SS "`max_scsi_luns=...'"
-
A SCSI device can have a number of `sub-devices' contained within
itself. The most common example is one of the new SCSI CD-ROMs that
handle more than one disk at a time. Each CD is addressed as a
`max_scsi_luns=n' as a boot arg, where n is a number between one and
eight. To avoid problems as described above, one would use n=1 to
avoid upsetting such broken devices.
-
.SS "SCSI tape configuration"
-
Some boot time configuration of the SCSI tape driver can be achieved
by using the following:
.IP
.LP
Full details can be found in the README.st file that is in the scsi
directory of the kernel source tree.
-
.SS "Adaptec aha151x, aha152x, aic6260, aic6360, SB16-SCSI configuration"
-
The aha numbers refer to cards and the aic numbers refer to the actual
SCSI chip on these type of cards, including the Soundblaster-16 SCSI.
Note that the parameters must be specified in order, meaning that if
you want to specify a parity setting, then you will have to specify an
iobase, irq, scsi-id and reconnect value as well.
-
.SS "Adaptec aha154x configuration"
-
The aha1542 series cards have an i82077 floppy controller onboard,
while the aha1540 series cards do not. These are busmastering cards,
and have parameters to set the ``fairness'' that is used to share
soft-configuration, older cards use jumpers. You can use values up to
10MB/s assuming that your motherboard is capable of handling it.
Experiment with caution if using values over 5MB/s.
-
.SS "Adaptec aha274x, aha284x, aic7xxx configuration"
-
These boards can accept an argument of the form:
.IP
.BI aic7xxx= extended,no_reset
.I no_reset
value, if non-zero, tells the driver not to reset the SCSI bus when
setting up the host adaptor at boot.
-
.SS "AdvanSys SCSI Hosts configuration (`advansys=')"
-
The AdvanSys driver can accept up to four i/o addresses that will be
probed for an AdvanSys SCSI card. Note that these values (if used) do
not effect EISA or PCI probing in any way. They are only used for
compiled with debugging enabled, the level of debugging output can be
set by adding an 0xdeb[0-f] parameter. The 0-f allows setting the
level of the debugging messages to any of 16 levels of verbosity.
-
.SS "AM53C974"
.IP
.BI AM53C974= host-scsi-id,target-scsi-id,max-rate,max-offset
-.LP
-
.SS "BusLogic SCSI Hosts configuration (`BusLogic=')"
.IP
.BI BusLogic= N1,N2,N3,N4,N5,S1,S2,...
Error Recovery (ER:Default, ER:HardReset, ER:BusDeviceReset,
ER:None, ER:<Per-Target-Spec>), and over Host Adapter Probing
(NoProbe, NoProbeISA, NoSortPCI).
-
.SS "EATA/DMA configuration"
The default list of i/o ports to be probed can be changed by
.IP
.BI eata= iobase,iobase,... .
-.LP
-
.SS "Future Domain TMC-16x0 configuration"
.IP
.BI fdomain= iobase,irq[,adapter_id]
-.LP
-
.SS "Great Valley Products (GVP) SCSI controller configuration"
.IP
.BI gvp11= dma_transfer_bitmask
-.LP
-
.SS "Future Domain TMC-8xx, TMC-950 configuration"
.IP
.BI tmc8xx= mem_base,irq
value is the value of the memory mapped I/O region that
the card uses. This will usually be one of the following values:
0xc8000, 0xca000, 0xcc000, 0xce000, 0xdc000, 0xde000.
-
.SS "IN2000 configuration"
.IP
.BI in2000= S
ioport:addr, noreset, nosync:x, period:ns, disconnect:x,
debug:x, proc:x. For the function of these parameters, see
.IR /usr/src/linux/drivers/scsi/in2000.c .
-
.SS "NCR5380 and NCR53C400 configuration"
The boot arg is of the form
.IP
disable interrupts. An IRQ value of 254 means to autoprobe. More
details can be found in the file
.IR /usr/src/linux/drivers/scsi/README.g_NCR5380 .
-
.SS "NCR53C8xx configuration"
.IP
.BI ncr53c8xx= S
verb (verbose), debug (debug), burst (burst_max).
For the function of the assigned values, see
.IR /usr/src/linux/drivers/scsi/ncr53c8xx.c .
-
.SS "NCR53c406a configuration"
.IP
.BI ncr53c406a= iobase[,irq[,fastpio]]
.LP
Specify irq = 0 for non-interrupt driven mode.
Set fastpio = 1 for fast pio mode, 0 for slow mode.
-
.SS "Pro Audio Spectrum configuration"
-
The PAS16 uses a NC5380 SCSI chip, and newer models support
jumperless configuration. The boot arg is of the form:
.IP
The only difference is that you can specify an IRQ value of 255, which
will tell the driver to work without using interrupts, albeit at a
performance loss. The iobase is usually 0x388.
-
.SS "Seagate ST-0x configuration"
-
If your card is not detected at boot time,
you will then have to use a boot arg of the form:
.IP
value is the value of the memory mapped I/O region that
the card uses. This will usually be one of the following values:
0xc8000, 0xca000, 0xcc000, 0xce000, 0xdc000, 0xde000.
-
.SS "Trantor T128 configuration"
-
These cards are also based on the NCR5380 chip, and accept the
following options:
.IP
The valid values for
.I mem_base
are as follows: 0xcc000, 0xc8000, 0xdc000, 0xd8000.
-
.SS "UltraStor 14F/34F configuration"
The default list of i/o ports to be probed can be changed by
.IP
.BI eata= iobase,iobase,... .
-.LP
-
.SS "WD7000 configuration"
.IP
.BI wd7000= irq,dma,iobase
-.LP
-
.SS "Commodore Amiga A2091/590 SCSI controller configuration"
.IP
.BI wd33c93= S
nosync:bitmask, nodma:x, period:ns, disconnect:x, debug:x,
clock:x, next. For details, see
.IR /usr/src/linux/drivers/scsi/wd33c93.c .
-
.SH "HARD DISKS"
-
.SS "IDE Disk/CD-ROM Driver Parameters"
-
The IDE driver accepts a number of parameters, which range from disk
geometry specifications, to support for broken controller chips. Drive
specific options are specified by using `hdX=' with X in `a'-`h'.
drive in the (a, ..., h) sequence. For the following discussions,
the `hd=' option will be cited for brevity. See the file
README.ide in linux/drivers/block for more details.
-
.SS "The `hd=cyls,heads,sects[,wpcom[,irq]]' options"
-
These options are used to specify the physical geometry of the disk.
Only the first three values are required. The cylinder/head/sectors
values will be those used by fdisk. The write precompensation value
is ignored for IDE disks. The IRQ value specified will be the IRQ
used for the interface that the drive resides on, and is not really a
drive specific parameter.
-
.SS "The `hd=serialize' option"
-
The dual IDE interface CMD-640 chip is broken as designed such that
when drives on the secondary interface are used at the same time as
drives on the primary interface, it will corrupt your data. Using this
option tells the driver to make sure that both interfaces are never
used at the same time.
-
.SS "The `hd=dtc2278' option"
-
This option tells the driver that you have a DTC-2278D IDE interface.
The driver then tries to do DTC specific operations to enable the
second interface and to enable faster transfer modes.
-
.SS "The `hd=noprobe' option"
-
Do not probe for this drive. For example,
.IP
hdb=noprobe hdb=1166,7,17
would disable the probe, but still specify the drive geometry so
that it would be registered as a valid block device, and hence
usable.
-
.SS "The `hd=nowerr' option"
-
Some drives apparently have the WRERR_STAT bit stuck on permanently.
This enables a work-around for these broken devices.
-
.SS "The `hd=cdrom' option"
-
This tells the IDE driver that there is an ATAPI compatible CD-ROM
attached in place of a normal IDE hard disk. In most cases the CD-ROM
is identified automatically, but if it isn't then this may help.
-
.SS "Standard ST-506 Disk Driver Options (`hd=')"
-
The standard disk driver can accept geometry arguments for the disks
similar to the IDE driver. Note however that it only expects three
values (C/H/S); any more or any less and it will silently ignore
.LP
If there are two disks installed, the above is repeated with the
geometry parameters of the second disk.
-
.SS "XT Disk Driver Options (`xd=')"
-
If you are unfortunate enough to be using one of these old 8 bit cards
that move data at a whopping 125kB/s then here is the scoop.
If the card is not recognised, you will have to use a boot arg of the form:
using the `default' XT controller parameters:
.IP
xd=2,5,0x320,3
-.LP
-
.SS "Syquest's EZ* removable disks"
.IP
.BI ez= iobase[,irq[,rep[,nybble]]]
-.LP
-
.SH "IBM MCA BUS DEVICES"
See also
.IR /usr/src/linux/Documentation/mca.txt .
-
.SS "PS/2 ESDI hard disks"
It is possible to specify the desired geometry at boot time:
.IP
For a ThinkPad-720, add the option
.IP
.BR tp720=1 .
-.LP
-
.SS "IBM Microchannel SCSI Subsystem configuration"
.IP
.BI ibmmcascsi= N
.LP
where N is the \fIpun\fP (SCSI ID) of the subsystem.
-
-.SH "CD-ROMs (Non-SCSI/ATAPI/IDE)"
-
.SS "The Aztech Interface"
-
The syntax for this type of card is:
.IP
aztcd=iobase[,magic_number]
If you set the magic_number to 0x79 then the driver will try and run
anyway in the event of an unknown firmware version. All other values
are ignored.
-
.SS "Parallel port CD-ROM drives"
Syntax:
.IP
and `dly' is a small integer for slowing down port accesses. The
`nice' parameter controls the driver's use of idle CPU time, at the
expense of some speed.
-
.SS "The CDU-31A and CDU-33A Sony Interface"
-
This CD-ROM interface is found on some of the Pro Audio Spectrum sound
cards, and other Sony supplied interface cards. The syntax is as
follows:
.I is_pas_card
should be entered as `PAS' if using a Pro Audio Spectrum card,
and otherwise it should not be specified at all.
-
.SS "The CDU-535 Sony Interface"
-
The syntax for this CD-ROM interface is:
.IP
sonycd535=iobase[,irq]
.LP
A zero can be used for the I/O base as a `placeholder' if one wishes
to specify an IRQ value.
-
.SS "The GoldStar Interface"
-
The syntax for this CD-ROM interface is:
.IP
gscd=iobase
-.LP
-
.SS "The ISP16 CD-ROM Interface"
Syntax:
.IP
(three integers and a string). If the type is given as `noisp16',
the interface will not be configured. Other recognized types
are: `Sanyo", `Sony', `Panasonic' and `Mitsumi'.
-
.SS "The Mitsumi Standard Interface"
-
The syntax for this CD-ROM interface is:
.IP
mcd=iobase,[irq[,wait_value]]
depending on a compile time #define.
The Mitsumi FX400 is an IDE/ATAPI CD-ROM player and does not use
the mcd driver.
-
.SS "The Mitsumi XA/MultiSession Interface"
-
This is for the same hardware as above, but the driver has extended features.
Syntax:
.IP
mcdx=iobase[,irq]
-.LP
-
.SS "The Optics Storage Interface"
-
The syntax for this type of card is:
.IP
optcd=iobase
-.LP
-
.SS "The Phillips CM206 Interface"
-
The syntax for this type of card is:
.IP
cm206=[iobase][,irq]
.LP
-
The driver assumes numbers between 3 and 11 are IRQ values, and
numbers between 0x300 and 0x370 are I/O ports, so you can specify one,
or both numbers, in any order. It also accepts `cm206=auto' to enable
autoprobing.
-
.SS "The Sanyo Interface"
-
The syntax for this type of card is:
.IP
sjcd=iobase[,irq[,dma_channel]]
-.LP
-
.SS "The SoundBlaster Pro Interface"
-
The syntax for this type of card is:
.IP
sbpcd=iobase,type
where type is one of the following (case sensitive) strings:
`SoundBlaster', `LaserMate', or `SPEA'. The I/O base is that of the
CD-ROM interface, and not that of the sound portion of the card.
-
.SH "ETHERNET DEVICES"
-
Different drivers make use of different parameters, but they all at
least share having an IRQ, an I/O port base value, and a name. In its
most generic form, it looks something like this:
cards and on the card/driver specific implementation
of the param_n values where used. Interested readers should refer to
the section in that document on their particular card.
-
.SH "THE FLOPPY DISK DRIVER"
-
There are many floppy driver options, and they are all listed in
README.fd in linux/drivers/block. This information is taken directly
from that file.
-
.SS "floppy=mask,allowed_drive_mask"
-
Sets the bitmask of allowed drives to mask. By default, only units 0
and 1 of each floppy controller are allowed. This is done because
certain non-standard hardware (ASUS PCI motherboards) mess up the
keyboard when accessing units 2 or 3. This option is somewhat
obsoleted by the cmos option.
-
.SS "floppy=all_drives"
-
Sets the bitmask of allowed drives to all drives. Use this if you have
more than two drives connected to a floppy controller.
-
.SS "floppy=asus_pci"
-
Sets the bitmask to allow only units 0 and 1. (The default)
-
.SS "floppy=daring"
-
Tells the floppy driver that you have a well behaved floppy
controller. This allows more efficient and smoother operation, but
may fail on certain controllers. This may speed up certain operations.
-
.SS "floppy=0,daring"
-
Tells the floppy driver that your floppy controller should be used
with caution.
-
.SS "floppy=one_fdc"
-
Tells the floppy driver that you have only floppy controller (default)
-
.SS "floppy=two_fdc or floppy=address,two_fdc"
-
Tells the floppy driver that you have two floppy controllers. The
second floppy controller is assumed to be at address. If address is
not given, 0x370 is assumed.
-
.SS "floppy=thinkpad"
-
Tells the floppy driver that you have a Thinkpad. Thinkpads use an
inverted convention for the disk change line.
-
.SS "floppy=0,thinkpad"
-
Tells the floppy driver that you don't have a Thinkpad.
-
.SS "floppy=drive,type,cmos"
-
Sets the cmos type of drive to type. Additionally, this drive is
allowed in the bitmask. This is useful if you have more than two
floppy drives (only two can be described in the physical cmos), or if
your BIOS uses non-standard CMOS types. Setting the CMOS to 0 for the
first two drives (default) makes the floppy driver read the physical
cmos for those drives.
-
.SS "floppy=unexpected_interrupts"
-
Print a warning message when an unexpected interrupt is received
(default behaviour)
-
.SS "floppy=no_unexpected_interrupts or floppy=L40SX"
-
Don't print a message when an unexpected interrupt is received. This
is needed on IBM L40SX laptops in certain video modes. (There seems to
be an interaction between video and floppy. The unexpected interrupts
only affect performance, and can safely be ignored.)
-
.SH "THE SOUND DRIVER"
-
The sound driver can also accept boot args to override the compiled in
values. This is not recommended, as it is rather complex. It is
described in the Readme.Linux file, in linux/drivers/sound. It accepts
As you can see it gets pretty messy, and you are better off to compile
in your own personal values as recommended. Using a boot arg of
`sound=0' will disable the sound driver entirely.
-
-
.SH "ISDN DRIVERS"
-
.SS "The ICN ISDN driver"
Syntax:
.IP
.LP
where icn_id1,icn_id2 are two strings used to identify the
card in kernel messages.
-
.SS "The PCBIT ISDN driver"
Syntax:
.IP
where membaseN is the shared memory base of the N'th card, and irqN is
the interrupt setting of the N'th card. The default is IRQ 5 and
membase 0xD0000.
-
.SS "The Teles ISDN driver"
Syntax:
.IP
where iobase is the i/o port address of the card, membase is the
shared memory base address of the card, irq is the interrupt channel
the card uses, and teles_id is the unique ASCII string identifier.
-
.SH "SERIAL PORT DRIVERS"
-
.SS "The RISCom/8 Multiport Serial Driver (`riscom8=')"
Syntax:
.IP
.LP
More details can be found in
.IR /usr/src/linux/Documentation/riscom8.txt .
-
.SS "The DigiBoard Driver (`digi=')"
If this option is used, it should have precisely six parameters.
Syntax:
.LP
More details can be found in
.IR /usr/src/linux/Documentation/digiboard.txt .
-
.SS "The Baycom Serial/Parallel Radio Modem"
Syntax:
.IP
ser12/par96 chooses between the supported modem types.
For more details, see
.IR /usr/src/linux/drivers/net/README.baycom .
-
.SS "Soundcard radio modem driver"
Syntax:
.IP
The mode parameter is a string with syntax hw:modem,
where hw is one of sbc, wss, wssfdx and modem is one of
afsk1200, fsk9600.
-
.SH "THE LINE PRINTER DRIVER"
-
.SS "`lp='"
Syntax:
.IP
lp=none,parport0 would use the first parallel port for lp1, and
disable lp0. To disable the printer driver entirely, one can use
lp=0.
-
.SS "WDT500/501 driver"
Syntax:
.IP
wdt=io,irq
-.LP
-
.SH "MOUSE DRIVERS"
-
.SS "`bmouse=irq'"
The busmouse driver only accepts one parameter, that being the
hardware IRQ value to be used.
-
.SS "`msmouse=irq'"
And precisely the same is true for the msmouse driver.
-
.SS "ATARI mouse setup"
.LP
atamouse=threshold[,y-threshold]
x-threshold and y-threshold. Otherwise, the first argument
is the x-threshold, and the second the y-threshold.
These values must lie between 1 and 20 (inclusive); the default is 2.
-
.SH "VIDEO HARDWARE"
-
.SS "`no-scroll'"
This option tells the console driver not to use hardware scroll
(where a scroll is effected by moving the screen origin in video
memory, instead of moving the data). It is required by certain
Braille machines.
-
.SH AUTHORS
Linus Torvalds (and many others)
-
.SH "SEE ALSO"
.BR lilo.conf (5),
.BR klogd (8),
2.2.3 is: ISO-8859-{1,2,3,5,6,7,8,9,13,15}, CP1251, UTF-8, EUC-{KR,JP,TW},
KOI8-{R,U}, GB2312, GB18030, GBK, BIG5, BIG5-HKSCS and TIS-620 (in no
particular order.) (Romanian may be switching to ISO-8859-16.)
-
.SH ASCII
ASCII (American Standard Code For Information Interchange) is the original
7-bit character set, originally designed for American English. It is
.LP
As Linux was written for hardware designed in the US, it natively
supports ASCII.
-
.SH ISO 8859
ISO 8859 is a series of 15 8-bit character sets all of which have US
ASCII in their low (7-bit) half, invisible control characters in
Console support for KOI8-R is available under Linux through user-mode
utilities that modify keyboard bindings and the EGA graphics table,
and employ the "user mapping" font table in the console driver.
-
.\" Thanks to Tomohiro KUBOTA for the following sections about
.\" national standards.
.SH JIS X 0208
and includes US ASCII and JIS X 0208. In EUC-JP, JIS X 0208
characters are expressed in two bytes, each of which is the
JIS X 0208 code plus 0x80.
-
.SH KS X 1001
KS X 1001 is a Korean national standard character set. Just as
JIS X 0208, characters are mapped into a 94x94 two-byte matrix.
to construct encodings such as EUC-KR, Johab, and ISO-2022-KR.
EUC-KR is the most important encoding for Linux and includes
US ASCII and KS X 1001. KS C 5601 is an older name for KS X 1001.
-
.SH GB 2312
GB 2312 is a mainland Chinese national standard character set used
to express simplified Chinese. Just like JIS X 0208, characters are
mapped into a 94x94 two-byte matrix used to construct EUC-CN. EUC-CN
is the most important encoding for Linux and includes US ASCII and
GB 2312. Note that EUC-CN is often called as GB, GB 2312, or CN-GB.
-
.SH Big5
Big5 is a popular character set in Taiwan to express traditional
Chinese. (Big5 is both a character set and an encoding.) It is a
bytes. Bytes 0xa1-0xfe are used as leading bytes for two-byte
characters. Big5 and its extension is widely used in Taiwan and Hong
Kong. It is not ISO 2022-compliant.
-
.SH TIS 620
TIS 620 is a Thai national standard character set and a superset
of US ASCII. Like ISO 8859 series, Thai characters are mapped into
0xa1-0xfe. TIS 620 is the only commonly used character set under
Linux besides UTF-8 to have combining characters.
-
.SH UNICODE
Unicode (ISO 10646) is a standard which aims to unambiguously represent every
character in every human language. Unicode's structure permits 20.1 bits
At the current time, the console driver does not handle combining
characters. So Thai, Sioux and any other script needing combining
characters can't be handled on the console.
-
.SH "ISO 2022 AND ISO 4873"
The ISO 2022 and 4873 standards describe a font-control model
based on VT100 practice. This model is (partially) supported
In particular, ^N and ^O are not used anymore, ESC ( xx
can be used only with xx=B, and ESC ) xx, ESC * xx, ESC + xx
are equivalent to ESC \- xx, ESC . xx, ESC / xx, respectively.
-
.SH "SEE ALSO"
.BR console (4),
.BR console_codes (4),
Link with \-lm. The imaginary unit is represented by I.
.sp
.nf
-/* check that exp(i*pi) == \-1 */
+/* check that exp(i * pi) == \-1 */
#include <math.h> /* for atan */
#include <complex.h>
-main() {
- double pi = 4*atan(1);
- complex z = cexp(I*pi);
- printf("%f+%f*i\\n", creal(z), cimag(z));
+
+int
+main(void)
+{
+ double pi = 4 * atan(1);
+ complex z = cexp(I * pi);
+ printf("%f + %f * i\\n", creal(z), cimag(z));
}
.fi
.SH "SEE ALSO"
.PP
The default values match the specification and should never need to be
changed.
-
.SH IOCTLS
All ioctls described in
.BR socket (7)
apply to ddp.
.\" FIXME Add a section about multicasting
-
.SH NOTES
Be very careful with the
.B SO_BROADCAST
.BR epoll_wait (2)
is done.
.PP
-
If the
.B RFD
file descriptor has been added to the
for(;;) {
nfds = epoll_wait(kdpfd, events, maxevents, \-1);
- for(n = 0; n < nfds; ++n) {
- if(events[n].data.fd == listener) {
+ for (n = 0; n < nfds; ++n) {
+ if (events[n].data.fd == listener) {
client = accept(listener, (struct sockaddr *) &local,
&addrlen);
if(client < 0){
client);
return \-1;
}
- }
- else
+ } else {
do_use_fd(events[n].data.fd);
+ }
}
}
.fi
.BR epoll_ctl (2)
with
.BR EPOLL_CTL_MOD .
-
.SH QUESTIONS AND ANSWERS
-
.TP
.B Q1
What happens if you add the same fd to an epoll_set twice?
is not specific to
.BR epoll .
.PP
-.PP
The solution is to maintain a ready list and mark the file descriptor as ready
in its associated data structure, thereby allowing the application to
remember which files need to be processed but still round robin amongst
A `*' (not between brackets) matches any string,
including the empty string.
-
.SS "Character classes"
An expression `[...]' where the first character after the
leading `[' is not an `!' matches a single character,
therefore `]' can be allowed between the brackets, provided
that it is the first character. (Thus, `[][!]' matches the
three characters `[', `]' and `!'.)
-
.SS Ranges
There is one special convention:
two characters separated by `\-' denote a range.
(Thus, `[]\-]' matches just the two characters `]' and `\-',
and `[\-\-0]' matches the three characters `\-', `.', `0', since `/'
cannot be matched.)
-
.SS Complementation
An expression `[!...]' matches a single character, namely
any character that is not matched by the expression obtained
a shell command line, enclosing them in quotes.
Between brackets these characters stand for themselves.
Thus, `[[?*\e]' matches the four characters `[', `?', `*' and `\e'.
-
.SH PATHNAMES
Globbing is applied on each of the components of a pathname
separately. A `/' in a pathname cannot be matched by a `?' or `*'
If a filename starts with a `.', this character must be matched explicitly.
(Thus, `rm *' will not remove .profile, and `tar c *' will not
archive all your files; `tar c .' is better.)
-
.SH "EMPTY LISTS"
The nice and simple rule given above: `expand a wildcard pattern
into the list of matching pathnames' was the original Unix
to avoid error messages from
.I rm
called with an empty argument list.)
-
.SH NOTES
.SS Regular expressions
Note that wildcard patterns are not regular expressions,
Now that regular expressions have bracket expressions where
the negation is indicated by a `^', POSIX has declared the
effect of a wildcard pattern `[^...]' to be undefined.
-
.SS Character classes and Internationalization
Of course ranges were originally meant to be ASCII ranges,
so that `[\ \-%]' stands for `[\ !"#$%]' and `[a\-z]' stands
by the LC_COLLATE category in the current locale.
(iv) Named character classes, like
-.br
.nf
+
[:alnum:] [:alpha:] [:blank:] [:cntrl:]
[:digit:] [:graph:] [:lower:] [:print:]
[:punct:] [:space:] [:upper:] [:xdigit:]
+
.fi
so that one can say `[[:lower:]]' instead of `[a\-z]', and have
things work in Denmark, too, where there are three letters past `z'
current locale. For example, `[[=a=]]' might be equivalent
to `[aáà äâ]' (warning: Latin-1 here), that is,
to `[a[.a-acute.][.a-grave.][.a-umlaut.][.a-circumflex.]]'.
-
.SH "SEE ALSO"
.BR sh (1),
.BR fnmatch (3),
This raw socket may appear in
.BR netstat (8)
output with a zero inode.
-.PP
.SH VERSIONS
Support for the
.B ICMP_ADDRESS
.B SO_REUSEADDR
flag has been set. Care should be taken when using this flag as it
makes TCP less reliable.
-
.SH "ADDRESS FORMAT"
An IP socket address is defined as a combination of an IP interface
address and a 16-bit port number.
.B INADDR_ANY
for historical reasons.
.SH "SOCKET OPTIONS"
-
IP supports some protocol specific socket options that can be set with
.BR setsockopt (2)
and read with
binding to a reserved port without superuser privileges (the
.B CAP_NET_BIND_SERVICE
capability).
-
.TP
.B EADDRINUSE
Tried to bind to an address already in use.
.br
.B #include <netinet/in.h>
.sp
-.sp
.IB tcp6_socket " = socket(PF_INET6, SOCK_STREAM, 0);"
.br
.IB raw6_socket " = socket(PF_INET6, SOCK_RAW, " protocol ");"
.sp
.RS
.nf
-.ta 4n 5n 20n
struct sockaddr_in6 {
- u_int16_t sin6_family; /* AF_INET6 */
- u_int16_t sin6_port; /* port number */
- u_int32_t sin6_flowinfo; /* IPv6 flow information */
- struct in6_addr sin6_addr; /* IPv6 address */
- u_int32_t sin6_scope_id; /* Scope ID (new in 2.4) */
+ u_int16_t sin6_family; /* AF_INET6 */
+ u_int16_t sin6_port; /* port number */
+ u_int32_t sin6_flowinfo; /* IPv6 flow information */
+ struct in6_addr sin6_addr; /* IPv6 address */
+ u_int32_t sin6_scope_id; /* Scope ID (new in 2.4) */
};
struct in6_addr {
- unsigned char s6_addr[16]; /* IPv6 address */
+ unsigned char s6_addr[16]; /* IPv6 address */
};
-.ta
.fi
.RE
.sp
of ISO 10646 (Unicode).
.SS "ISO 8859 Alphabets"
The full set of ISO 8859 alphabets includes:
-.P
.TS
l l.
ISO 8859-1 West European languages (Latin-1)
.BR ascii (7)
manual page. The fourth column will only show the proper glyphs
in an environment configured for ISO 8859-1.
-
.TS
l l l c lp-1.
Oct Dec Hex Char Description
Scottish Gaelic, Spanish, and Swedish.
.SS "ISO 8859 Alphabets"
The full set of ISO 8859 alphabets includes:
-.P
.TS
l l.
ISO 8859-1 West European languages (Latin-1)
.BR ascii (7)
manual page. The fourth column will only show the proper glyphs
in an environment configured for ISO 8859-15.
-
.TS
l l l c lp-1.
Oct Dec Hex Char Description
.P
Also note that the following Cyrillic-based languages have one-to-one
transliterations to Latin 10: Macedonian and Serbian.
-.P
.SS "ISO 8859 Alphabets"
The full set of ISO 8859 alphabets includes:
-.P
.TS
l l.
ISO 8859-1 West European languages (Latin-1)
.BR ascii (7)
manual page. The fourth column will only show the proper glyphs
in an environment configured for ISO 8859-16.
-
.TS
l l l c lp-1.
Oct Dec Hex Char Description
.P
Also note that the following Cyrillic-based languages have one-to-one
transliterations to Latin 2: Macedonian and Serbian.
-.P
.SS "ISO 8859 Alphabets"
The full set of ISO 8859 alphabets includes:
-.P
.TS
l l.
ISO 8859-1 West European languages (Latin-1)
.BR ascii (7)
manual page. The fourth column will only show the proper glyphs
in an environment configured for ISO 8859-2.
-
.TS
l l l c lp-1.
Oct Dec Hex Char Description
characters used in modern monotonic Greek.
.SS "ISO 8859 Alphabets"
The full set of ISO 8859 alphabets includes:
-.P
.TS
l l.
ISO 8859-1 West European languages (Latin-1)
.BR ascii (7)
manual page. The fourth column will only show the proper glyphs
in an environment configured for ISO 8859-7.
-
.TS
l l l c lp-1.
Oct Dec Hex Char Description
the "Latin Alphabet No. 5", encodes the characters used in Turkish.
.SS "ISO 8859 Alphabets"
The full set of ISO 8859 alphabets includes:
-.P
.TS
l l.
ISO 8859-1 West European languages (Latin-1)
.BR ascii (7)
manual page. The fourth column will only show the proper glyphs
in an environment configured for ISO 8859-9.
-
.TS
l l l c lp-1.
Oct Dec Hex Char Description
.PP
KOI8-R is defined by RFC\ 1489 (Registration of a Cyrillic Character
Set).
-
.SH NOTE
KOI8-R was designed for mixed Russian/English texts and covers
only Russian Cyrillic characters, so if you're looking for Ukrainian,
.PP
A more complete set of Cyrillic characters is also defined by the
ISO-8859-5 character set.
-
.SS "KOI8-R Characters"
The following table displays the characters in KOI8-R, which
are printable and unlisted in the
.B ifr_name
to the name of the interface. All other members of the structure may
share memory.
-
.SH IOCTLS
If an ioctl is marked as privileged then using it requires an effective
user ID of 0 or the
capability. If this is not the case
.B EPERM
will be returned.
-
.TP
.B SIOCGIFNAME
Given the
.BR ifr_name .
This is the only ioctl which returns its result in
.BR ifr_name .
-
.TP
.B SIOCGIFINDEX
Retrieve the interface index of the interface into
.BR ifr_ifindex .
-
.TP
.BR SIOCGIFFLAGS ", " SIOCSIFFLAGS
Get or set the active flag word of the device.
.B ifr_flags
contains a bitmask of the following values:
-
.TS
tab(:);
c s
The addresses are lost when the interface goes down.
T}
.TE
-
Setting the active flag word is a privileged operation, but any
process may read it.
.TP
error returned by
.BR recvmsg (2))
and resynchronise.
-
.SH "ADDRESS FORMATS"
The
.I sockaddr_nl
capability may send or listen to a netlink multicast group.
Any replies to a message received for a multicast group should be
sent back to the sending PID and the multicast group.
-
.SH EXAMPLE
The following example creates a
.B NETLINK_ROUTE
.nf
struct sockaddr_nl sa;
-memset (&sa, 0, sizeof(sa));
+memset(&sa, 0, sizeof(sa));
snl.nl_family = AF_NETLINK;
snl.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR;
struct msghdr msg;
msg = { (void *)&sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
-memset (&sa, 0, sizeof(sa));
+memset(&sa, 0, sizeof(sa));
sa.nl_family = AF_NETLINK;
nh->nlmsg_pid = 0;
nh->nlmsg_seq = ++sequence_number;
/* Request an ack from kernel by setting NLM_F_ACK. */
nh->nlmsg_flags |= NLM_F_ACK;
-sendmsg (fd, &msg, 0);
+sendmsg(fd, &msg, 0);
.fi
.in -0.25i
struct nlmsghdr *nh;
msg = { (void *)&sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
-len = recvmsg (fd, &msg, 0);
+len = recvmsg(fd, &msg, 0);
for (nh = (struct nlmsghdr *) buf; NLMSG_OK (nh, len);
nh = NLMSG_NEXT (nh, len)) {
}
.fi
.in -0.25i
-
.SH BUGS
This manual page is not complete.
-
.SH NOTES
It is often better to use netlink via
.B libnetlink
or
.B libnl
than via the low level kernel interface.
-
.SH VERSIONS
The socket interface to netlink is a new feature of Linux 2.2.
Linux 2.6.14.
NETLINK_GENERIC and NETLINK_ISCSI appeared in Linux 2.6.15.
-
.SH "SEE ALSO"
.BR cmsg (3),
.BR netlink (3),
.BR recvfrom (2)
the real length of the packet on the wire is always returned,
even when it is longer than the buffer.
-
.SH "ADDRESS TYPES"
The sockaddr_ll is a device independent physical layer address.
and
.B sll_ifindex
are used.
-
.SH "SOCKET OPTIONS"
Packet sockets can be used to configure physical layer multicasting
and promiscuous mode. It works by calling
.BR SIOCADDMULTI ,
.B SIOCDELMULTI
can be used for the same purpose.
-
-
.SH IOCTLS
.B SIOCGSTAMP
can be used to receive the time stamp of the last received packet.
and
.BR socket (7)
are valid on packet sockets.
-
.SH "ERROR HANDLING"
Packet sockets do no error handling other than errors occurred
while passing the packet to the device driver.
They don't have the concept of a pending error.
-
.SH COMPATIBILITY
In Linux 2.0, the only way to get a packet socket was by calling
.BI "socket(PF_INET, SOCK_PACKET, " protocol )\fR.
is the device name as a null terminated string, e.g. eth0.
This structure is obsolete and should not be used in new code.
-
.SH NOTES
For portable programs it is suggested to use
.B PF_PACKET
encapsulation with the protocol filled in.
Packet sockets are not subject to the input or output firewall chains.
-
.SH ERRORS
.TP
.B ENETDOWN
Interface is not up.
-
.TP
.B ENOTCONN
No interface address passed.
-
.TP
.B ENODEV
Unknown device name or interface index specified in interface address.
-
.TP
.B EMSGSIZE
Packet is bigger than interface MTU.
-
.TP
.B ENOBUFS
Not enough memory to allocate the packet.
-
.TP
.B EFAULT
User passed invalid memory address.
-
.TP
.B EINVAL
Invalid argument.
-
.TP
.B ENXIO
Interface address contained illegal interface index.
-
.TP
.B EPERM
User has insufficient privileges to carry out this operation.
-
.TP
.B EADDRNOTAVAIL
Unknown multicast group address passed.
-
.TP
.B ENOENT
No packet received.
.B PF_PACKET
is a new feature in Linux 2.2. Earlier Linux versions supported only
.BR SOCK_PACKET .
-
.SH BUGS
glibc 2.1 does not have a define for
.BR SOL_PACKET .
-The suggested workaround is to use
-.in +0.25i
+The suggested workaround is to use:
+.in +0.5i
.nf
+
#ifndef SOL_PACKET
#define SOL_PACKET 263
#endif
+
.fi
-.in -0.25i
+.in -0.5i
This is fixed in later glibc versions and also does not occur on
libc5 systems.
extension is an ugly hack and should be replaced by a control message.
There is currently no way to get the original destination address of
packets via SOCK_DGRAM.
-
.SH HISTORICAL NOTE
The include file
.I <netpacket/packet.h>
.SS "--- - _POSIX_VDISABLE"
Always present (probably 0). Value to set a changeable special control
character to indicate that it is disabled.
-
.SH "XOPEN EXTENSIONS"
.BR _XOPEN_CRYPT ,
.BR _XOPEN_LEGACY ,
.BR _XOPEN_REALTIME ,
.BR _XOPEN_REALTIME_THREADS ,
.BR _XOPEN_UNIX .
-
.\" To be described.
-
.SH "SEE ALSO"
.BR sysconf (3)
.B #include <netinet/in.h>
.br
.BI "raw_socket = socket(PF_INET, SOCK_RAW, int " protocol );
-
.SH DESCRIPTION
Raw sockets allow new IPv4 protocols to be implemented in user space.
A raw socket receives or sends the raw datagram not
Receiving of all IP protocols via
.B IPPROTO_RAW
is not possible using raw sockets.
-
+.RS
.TS
tab(:) allbox;
c s
Packet Id:Filled in when zero.
Total Length:Always filled in.
.TE
+.RE
+.sp
.PP
-
If
.B IP_HDRINCL
is specified and the IP header has a non-zero destination address then
When a packet is received, it is passed to any raw sockets which have
been bound to its protocol before it is passed to other protocol handlers
(e.g. kernel protocol modules).
-
.SH "ADDRESS FORMAT"
-
Raw sockets use the standard
.I sockaddr_in
address structure defined in
See the
.I <netinet/in.h>
include file for valid IP protocols.
-
.SH "SOCKET OPTIONS"
Raw socket options can be set with
.BR setsockopt (2)
.B IPPROTO_RAW
.\" Or SOL_RAW on Linux
family flag.
-
.TP
.B ICMP_FILTER
Enable a special filter for raw sockets bound to the
.B IPPROTO_ICMP
protocol. The value has a bit set for each ICMP message type which
should be filtered out. The default is to filter no ICMP messages.
-
.PP
In addition all
.BR ip (7)
.B IPPROTO_IP
socket options valid for datagram sockets are supported.
-
.SH NOTES
By default raw sockets do path MTU (Maximum Transmission Unit) discovery.
This means the kernel
this ability was lost in Linux 2.2.
The workaround is to use
.BR IP_HDRINCL .
-
.SH "ERROR HANDLING"
Errors originating from the network are only passed to the user when the
socket is connected or the
with a effective user ID of 0 or the
.B CAP_NET_RAW
attribute may do that.
-
.SH VERSIONS
.B IP_RECVERR
and
raw socket code when the
SO_BSDCOMPAT socket option was set \(em since Linux 2.2,
this option no longer has that effect.
-
.SH BUGS
Transparent proxy extensions are not described.
was specified in the initial
.BR socket (2)
call is always used.
-
.SH AUTHORS
This man page was written by Andi Kleen.
-
.SH "SEE ALSO"
.BR recvmsg (2),
.BR sendmsg (2),
.B #include <sys/socket.h>
.BI "rtnetlink_socket = socket(PF_NETLINK, int " socket_type ", NETLINK_ROUTE);"
-
.SH DESCRIPTION
Rtnetlink allows the kernel's routing tables to be read and altered.
It is used within the kernel to communicate between
sockets. It is based on netlink messages, see
.BR netlink (7)
for more information.
-
.\" FIXME all these macros could be moved to rtnetlink(3)
.SH "ROUTING ATTRIBUTES"
Some rtnetlink messages have optional attributes after the initial header:
These attributes should be only manipulated using the RTA_* macros
or libnetlink, see
.BR rtnetlink (3).
-
.SH MESSAGES
Rtnetlink consists of these message types
(in addition to standard netlink messages):
is the unique interface index,
.B ifi_change
is reserved for future use and should be always set to 0xFFFFFFFF.
-
-
.TS
tab(:);
c
IFA_ANYCAST:raw protocol address:anycast address
IFA_CACHEINFO:struct ifa_cacheinfo:Address information.
.TE
-
.\" FIXME struct ifa_cacheinfo
.TP
.BR RTM_NEWROUTE ", " RTM_DELROUTE ", " RTM_GETROUTE
is a new feature of Linux 2.2.
.SH BUGS
This manual page is lacking and incomplete.
-
.SH "SEE ALSO"
.BR cmsg (3),
.BR rtnetlink (3),
.B #include <sys/socket.h>
.br
.IB mysocket " = socket(int " socket_family ", int " socket_type ", int " protocol );
-
.SH DESCRIPTION
This manual page describes the Linux networking socket layer user
interface. The BSD compatible sockets
See
.BR socket (2)
for more information on families and types.
-
.SH "SOCKET LAYER FUNCTIONS"
These functions are used by the user process to send or receive packets
and to do other socket operations.
.BR poll (2)
or
.BR select (2).
-.PP
.TS
tab(:) allbox;
c s s
.IB error " = ioctl(" ip_socket ", " ioctl_type ", " &value_result ");"
.fi
.in -0.25i
-
.TP
.B SIOCGSTAMP
Return a
that exceed the interface MTU.
However disabling it is not recommended
for performance and reliability reasons.
-
.SH "ADDRESS FORMAT"
UDP uses the IPv4
.B sockaddr_in
address format described in
.BR ip (7).
-
.SH "ERROR HANDLING"
All fatal errors will be passed to the user as an error return even
when the socket is not connected. This includes asynchronous errors
.B ECONNREFUSED
No receiver was associated with the destination address.
This might be caused by a previous packet sent over the socket.
-
.SH VERSIONS
IP_RECVERR is a new feature in Linux 2.2.
-
.SH CREDITS
This man page was written by Andi Kleen.
-
.SH "SEE ALSO"
.BR ip (7),
.BR raw (7),
The SI system of units uses prefixes that indicate powers of ten.
A kilometer is 1000 meter, and a megawatt is 1000000 watt.
Below the standard prefixes.
-
.RS
.TS
l l l.
(and "Ki" starts with a capital 'K'). The names are formed by taking the
first syllable of the names of the decimal prefix with roughly the same
size, followed by "bi" for "binary".
-
.RS
.TS
l l l.
.IB unix_socket " = socket(PF_UNIX, type, 0);"
.br
.IB error " = socketpair(PF_UNIX, type, 0, int *" sv ");"
-
.SH DESCRIPTION
The
.B PF_UNIX
Unix sockets support passing file descriptors or process credentials
to other processes using ancillary data.
-
.SH "ADDRESS FORMAT"
A Unix address is defined as a filename in the filesystem or
as a unique string in the abstract namespace. Sockets created by
bytes in
.BR sun_path .
Note that names in the abstract namespace are not zero-terminated.
-
.SH "SOCKET OPTIONS"
For historical reasons these socket options are specified with a
SOL_SOCKET type even though they are PF_UNIX specific.
When this option is set and the socket is not yet connected
a unique name in the abstract namespace will be generated automatically.
Expects an integer boolean flag.
-
.SH "(UN)SUPPORTED FEATURES"
The following paragraphs describe domain-specific details and
unsupported features of the sockets API for Unix domain sockets on Linux.
This limit is calculated as the doubled (see
.BR socket (7))
option value less 32 bytes used for overhead.
-
.SH "ANCILLARY MESSAGES"
Ancillary data is sent and received using
.BR sendmsg (2)
.B cmsg_type
field to the type. For more information see
.BR cmsg (3).
-
.TP
.B SCM_RIGHTS
Send or receive a set of open file descriptors from another process.
The data portion contains an integer array of the file descriptors.
The passed file descriptors behave as though they have been created with
.BR dup (2).
-
.TP
.B SCM_CREDENTIALS
Send or receive Unix credentials. This can be used for authentication.
message the
.B SO_PASSCRED
option must be enabled on the socket.
-
.SH VERSIONS
.B SCM_CREDENTIALS
and the abstract namespace were introduced with Linux 2.2 and should not
be used in portable programs.
(Some BSD-derived systems also support credential passing,
but the implementation details differ.)
-
.SH NOTES
In the Linux implementation, sockets which are visible in the
filesystem honour the permissions of the directory they are in. Their
absoluteURI = scheme ":" ( hierarchical_part | opaque_part )
.HP
relativeURI = ( net_path | absolute_path | relative_path ) [ "?" query ]
-.sp
.HP
scheme = "http" | "ftp" | "gopher" | "mailto" | "news" | "telnet" | "file" | "man" | "info" | "whatis" | "ldap" | "wais" | \&...
.HP
hierarchical_part = ( net_path | absolute_path ) [ "?" query ]
-.sp
.HP
net_path = "//" authority [ absolute_path ]
.HP
.TH X25 7 1998-12-01 "Linux Man Page" "Linux Programmer's Manual"
.SH NAME
x25, PF_X25 \- ITU-T X.25 / ISO-8208 protocol interface.
-
.SH SYNOPSIS
.B #include <sys/socket.h>
.br
.B #include <linux/x25.h>
.sp
.B x25_socket = socket(PF_X25, SOCK_SEQPACKET, 0);
-
.SH DESCRIPTION
X25 sockets provide an interface to the X.25 packet layer protocol.
This allows applications to
.B \-p
Print the lists of directories and candidate libraries stored in
the current cache.
-
.SH FILES
.PD 0
.TP 20
Note that the shadow file is specifically not cached.
.BR getspnam (3)
calls remain uncached as a result.
-
.SH OPTIONS
.TP
.B "\-\-help"
will give you a list with all options and what they do.
-
.SH NOTES
Nscd doesn't know anything about the underlaying protocols for a
service. This also means, that if you change
.I /etc/nsswitch.conf
to use DNS for host lookups. In such a case, you need to restart
nscd.
-
.SH "SEE ALSO"
.BR nscd.conf (5),
.BR nsswitch.conf (5)