0744-0746.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 446 行
HTML
446 行
<HTML>
<HEAD>
<TITLE>Linux Complete Command Reference:System Calls:EarthWeb Inc.-</TITLE>
</HEAD>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311046 //-->
<!-- TITLE=Linux Complete Command Reference//-->
<!-- AUTHOR=Red Hat//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=02 //-->
<!-- PAGES=0737-0890 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0741-0743.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0747-0750.html">Next</A></CENTER></P>
<A NAME="PAGENUM-744"><P>Page 744</P></A>
<H3><A NAME="ch02_ 8">
alarm
</A></H3>
<P>alarm—Sets an alarm clock for delivery of a signal
</P>
<P><B>
SYNOPSIS
</B></P>
<!-- CODE SNIP //-->
<PRE>
#include <unistd.h>
unsigned int alarm(unsigned int seconds);
</PRE>
<!-- END CODE SNIP //-->
<P><B>
DESCRIPTION
</B></P>
<P>alarm arranges for a SIGALRM signal to be delivered to the process in
seconds seconds.
</P>
<P>If seconds is 0, no new alarm is scheduled.
</P>
<P>In any event, any previously set alarm is canceled.
</P>
<P><B>
RETURN VALUE
</B></P>
<P>alarm returns the number of seconds remaining until any previously scheduled alarm was due to be delivered, or
0 if there was no previously scheduled alarm.
</P>
<P><B>
NOTES
</B></P>
<P>alarm and setitimer share the same timer; calls to one will interfere with use of the other.
</P>
<P>Scheduling delays can, as ever, cause the execution of the process to be delayed by an arbitrary amount of time.
</P>
<P><B>
CONFORMS TO
</B></P>
<!-- CODE SNIP //-->
<PRE>
SVID, AT&T, POSIX, X/OPEN, BSD 4.3
</PRE>
<!-- END CODE SNIP //-->
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
setitimer(2), signal(2), sigaction(2),
gettimeofday(2), select(2), pause(2), sleep(3)
</PRE>
<!-- END CODE SNIP //-->
<P>Linux, 21 July 1993
</P>
<H3><A NAME="ch02_ 9">
bdflush
</A></H3>
<P>bdflush—Starts, flushes, or tunes the buffer-dirty-flush daemon
</P>
<P><B>
SYNOPSIS
</B></P>
<!-- CODE SNIP //-->
<PRE>
int bdflush(int func, long *address);
int bdflush(int func, long data);
</PRE>
<!-- END CODE SNIP //-->
<P><B>
DESCRIPTION
</B></P>
<P>bdflush starts, flushes, or tunes the buffer-dirty-flush daemon. Only the superuser may call
bdflush.
</P>
<P>If func is negative or 0 and no daemon has been started,
bdflush enters the daemon code and never returns.
</P>
<P>If func is 1, some dirty buffers are written to disk.
</P>
<P>If func is 2 or more and is even (low bit is 0),
address is the address of a long word, and the tuning parameter
numbered (func_2)/2 is returned to the caller in that address.
</P>
<P>If func is 3 or more and is odd (low bit is 1),
data is a long word and the kernel sets tuning parameter numbered
(func_3)/2 to that value.
</P>
<P>The set of parameters, their values, and their legal ranges are defined in the kernel source file
fs/buffer.c.
</P>
<A NAME="PAGENUM-745"><P>Page 745</P></A>
<P><B>
RETURN VALUE
</B></P>
<P>If func is negative or 0 and the daemon successfully starts,
bdflush never returns. Otherwise, the return value is
0 on success and _1 on failure, with errno set to indicate the error.
</P>
<P><B>
ERRORS
</B></P>
<TABLE>
<TR><TD>
EPERM
</TD><TD>
Caller is not superuser.
</TD></TR><TR><TD>
EFAULT
</TD><TD>
address points outside your accessible address space.
</TD></TR><TR><TD>
EBUSY
</TD><TD>
An attempt was made to enter the daemon code after another process has already
been entered.
</TD></TR><TR><TD>
EINVAL
</TD><TD>
An attempt was made to read or write an invalid parameter number, or to write an
invalid value to a parameter.
</TD></TR></TABLE>
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
fsync(2), sync(2), update(8), sync(8)
</PRE>
<!-- END CODE SNIP //-->
<P>Linux 1.2.4, 15 April 1995
</P>
<H3><A NAME="ch02_ 10">
bind
</A></H3>
<P>bind—Binds a name to a socket
</P>
<P><B>
SYNOPSIS
</B></P>
<!-- CODE SNIP //-->
<PRE>
#include <sys/types.h>
#include <sys/socket.h>
int bind(int sockfd, struct sockaddr *my_addr,intaddrlen);
</PRE>
<!-- END CODE SNIP //-->
<P><B>
DESCRIPTION
</B></P>
<P>bind gives the socket, sockfd, the local address
my_addr. my_addr is addrlen bytes long. Traditionally, this is called assigning
a name to a socket. (When a socket is created with
socket(2), it exists in a name space—an address family—but has no
name assigned.)
</P>
<P><B>
NOTES
</B></P>
<P>Binding a name in the UNIX domain creates a socket in the file system that must be deleted by the caller—using
unlink(2)<BR>—when it is no longer needed.
</P>
<P>The rules used in name binding vary between communication domains. Consult the manual entries in section 4 for
detailed information.
</P>
<P><B>
RETURN VALUE
</B></P>
<P>On success, 0 is returned. On error, _1 is returned, and
errno is set appropriately.
</P>
<P><B>
ERRORS
</B></P>
<TABLE>
<TR><TD>
EBADF
</TD><TD>
sockfd is not a valid descriptor.
</TD></TR><TR><TD>
EINVAL
</TD><TD>
The socket is already bound to an address. This may change in the future. See
linux/unix/sock.c for details.
</TD></TR><TR><TD>
EACCES
</TD><TD>
The address is protected and the user is not the superuser.
</TD></TR></TABLE>
<P>The following errors are specific to UNIX domain
(AF_UNIX) sockets:
</P>
<TABLE>
<TR><TD>
EINVAL
</TD><TD>
addr len was wrong, or the socket was not in the
AF_UNIX family.
</TD></TR><TR><TD>
EROFS
</TD><TD>
The socket inode would reside on a read-only file system.
</TD></TR><TR><TD>
EFAULT
</TD><TD>
my_addr points outside your accessible address space.
</TD></TR></TABLE>
<A NAME="PAGENUM-746"><P>Page 746</P></A>
<TABLE>
<TR><TD>
ENAMETOOLONG
</TD><TD>
my_addr is too long.
</TD></TR><TR><TD>
ENOENT
</TD><TD>
The file does not exist.
</TD></TR><TR><TD>
ENOMEM
</TD><TD>
Insufficient kernel memory was available.
</TD></TR><TR><TD>
ENOTDIR
</TD><TD>
A component of the path prefix is not a directory.
</TD></TR><TR><TD>
EACCES
</TD><TD>
Search permission is denied on a component of the path prefix.
</TD></TR><TR><TD>
ELOOP
</TD><TD>
my_addr contains a circular reference (that is, via a symbolic link).
</TD></TR></TABLE>
<P><B>
HISTORY
</B></P>
<P>The bind function call appeared in BSD 4.2.
</P>
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
accept(2), connect(2), listen(2), socket(2),
getsockname(2)
</PRE>
<!-- END CODE SNIP //-->
<P>Linux 0.99.11, 23 July 1993
</P>
<H3><A NAME="ch02_ 11">
brk, sbrk
</A></H3>
<P>brk, sbrk—Change data segment size
</P>
<P><B>
SYNOPSIS
</B></P>
<!-- CODE SNIP //-->
<PRE>
#include <unistd.h>
int brk(void *end_data_segment);
void *sbrk(ptrdiff tincrement);
</PRE>
<!-- END CODE SNIP //-->
<P><B>
DESCRIPTION
</B></P>
<P>brk sets the end of the data segment to the value specified by
end_data_segment.
</P>
<P>end_data_segment must be greater than the end of the text segment and it must be 16KB before the end of the stack.
</P>
<P>sbrk increments the program's data space by
increment bytes. sbrk isn't a system call; it is just a C library wrapper.
</P>
<P><B>
RETURN VALUE
</B></P>
<P>On success, brk returns 0, and sbrk returns a pointer to the start of the new area. On error,
_1 is returned and errno is set to ENOMEM.
</P>
<P><B>
CONFORMS TO
</B></P>
<P>BSD 4.3
</P>
<P>brk and sbrk are not defined in the C standard and are deliberately excluded from the POSIX.1 standard (see
paragraphs B.1.1.1.3 and B.8.3.3).
</P>
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
execve(2), getrlimit(2), malloc(3), end(3)
</PRE>
<!-- END CODE SNIP //-->
<P>Linux 0.99.11, 21 July 1993
</P>
<H3><A NAME="ch02_ 12">
cacheflush
</A></H3>
<P>cacheflush—Flushes contents of the instruction and/or data cache
</P>
<P><B>
SYNOPSIS
</B></P>
<P><CENTER>
<a href="0741-0743.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0747-0750.html">Next</A></CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?