-->

Previous | Table of Contents | Next

Page 744

alarm

alarm—Sets an alarm clock for delivery of a signal

SYNOPSIS


#include <unistd.h>

unsigned int alarm(unsigned int seconds);

DESCRIPTION

alarm arranges for a SIGALRM signal to be delivered to the process in seconds seconds.

If seconds is 0, no new alarm is scheduled.

In any event, any previously set alarm is canceled.

RETURN VALUE

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.

NOTES

alarm and setitimer share the same timer; calls to one will interfere with use of the other.

Scheduling delays can, as ever, cause the execution of the process to be delayed by an arbitrary amount of time.

CONFORMS TO


SVID, AT&T, POSIX, X/OPEN, BSD 4.3

SEE ALSO


setitimer(2), signal(2), sigaction(2),

gettimeofday(2), select(2), pause(2), sleep(3)

Linux, 21 July 1993

bdflush

bdflush—Starts, flushes, or tunes the buffer-dirty-flush daemon

SYNOPSIS


int bdflush(int func, long *address);

int bdflush(int func, long data);

DESCRIPTION

bdflush starts, flushes, or tunes the buffer-dirty-flush daemon. Only the superuser may call bdflush.

If func is negative or 0 and no daemon has been started, bdflush enters the daemon code and never returns.

If func is 1, some dirty buffers are written to disk.

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.

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.

The set of parameters, their values, and their legal ranges are defined in the kernel source file fs/buffer.c.

Page 745

RETURN VALUE

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.

ERRORS

EPERM Caller is not superuser.
EFAULT address points outside your accessible address space.
EBUSY An attempt was made to enter the daemon code after another process has already been entered.
EINVAL An attempt was made to read or write an invalid parameter number, or to write an invalid value to a parameter.

SEE ALSO


fsync(2), sync(2), update(8), sync(8)

Linux 1.2.4, 15 April 1995

bind

bind—Binds a name to a socket

SYNOPSIS


#include <sys/types.h>

#include <sys/socket.h>

int bind(int sockfd, struct sockaddr *my_addr,intaddrlen);

DESCRIPTION

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.)

NOTES

Binding a name in the UNIX domain creates a socket in the file system that must be deleted by the caller—using unlink(2)
—when it is no longer needed.

The rules used in name binding vary between communication domains. Consult the manual entries in section 4 for detailed information.

RETURN VALUE

On success, 0 is returned. On error, _1 is returned, and errno is set appropriately.

ERRORS

EBADF sockfd is not a valid descriptor.
EINVAL The socket is already bound to an address. This may change in the future. See linux/unix/sock.c for details.
EACCES The address is protected and the user is not the superuser.

The following errors are specific to UNIX domain (AF_UNIX) sockets:

EINVAL addr len was wrong, or the socket was not in the AF_UNIX family.
EROFS The socket inode would reside on a read-only file system.
EFAULT my_addr points outside your accessible address space.

Page 746

ENAMETOOLONG my_addr is too long.
ENOENT The file does not exist.
ENOMEM Insufficient kernel memory was available.
ENOTDIR A component of the path prefix is not a directory.
EACCES Search permission is denied on a component of the path prefix.
ELOOP my_addr contains a circular reference (that is, via a symbolic link).

HISTORY

The bind function call appeared in BSD 4.2.

SEE ALSO


accept(2), connect(2), listen(2), socket(2),

getsockname(2)

Linux 0.99.11, 23 July 1993

brk, sbrk

brk, sbrk—Change data segment size

SYNOPSIS


#include <unistd.h>

int brk(void *end_data_segment);

void *sbrk(ptrdiff tincrement);

DESCRIPTION

brk sets the end of the data segment to the value specified by end_data_segment.

end_data_segment must be greater than the end of the text segment and it must be 16KB before the end of the stack.

sbrk increments the program's data space by increment bytes. sbrk isn't a system call; it is just a C library wrapper.

RETURN VALUE

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.

CONFORMS TO

BSD 4.3

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).

SEE ALSO


execve(2), getrlimit(2), malloc(3), end(3)

Linux 0.99.11, 21 July 1993

cacheflush

cacheflush—Flushes contents of the instruction and/or data cache

SYNOPSIS

Previous | Table of Contents | Next