SETDTABLESIZE(2)

NAME
setdtablesize - set descriptor table size

SYNOPSIS
setdtablesize(size)
	int  size;

DESCRIPTION
This sets the descriptor table size in the calling process to at least the minimum of the size argument and a system-defined maximum number of file descriptors (binary-configurable). The implementation can grant more file descriptors than the number requested. Setdtablesize returns the number of file descriptors the process can now use. A request to decrease the number of file descriptors in a process is honored by closing all open file descriptors with indices equal to or greater than size.

The maximum number of file descriptors is guaranteed to be at least 20, for compatibility with other UNIX systems.

Before setdtablesize can be used to increase the number of file descriptors, MAXNOFILE and NOFILEEXT must be set as options in the binary configuration file. For further information on these and other binary-configurable options, refer to Building DYNIX Systems With Config.

The new descriptor table size is inherited across fork(2) and kept across exec(2) system calls.

CAVEATS
Since standard I/O does not support more than 20 open files, all stdio must be done with file descriptor numbers less than 20.

RETURN VALUES
If successful, the number of usable file descriptors in the calling process is returned. Otherwise, a -1 is returned, and the global variable errno is set to indicate the error.

ERRORS

[ENOMEM]
    The system was temporarily unable to allocate sufficient memory resources to satisfy the request.

[EINVAL]
    The size argument was invalid (size is less than zero).

[ENFILE]
    The system had no free open-file table extension objects.

SEE ALSO
close(2), dup(2), getdtablesize(2), getdtablemax(2), open(2), Building DYNIX Systems With Config