Modula-2 || Compiler & Tools || Library || Search Engine


Ulm's Modula-2 Library:
SysDup


NAME

SysDup - duplicate an open file descriptor

SYNOPSIS

PROCEDURE Dup(fd: CARDINAL; VAR newfd: CARDINAL) : BOOLEAN;
PROCEDURE Dup2(fd, newfd: CARDINAL) : BOOLEAN;

DESCRIPTION

A duplicated file descriptor shares all properties with the original file descriptor and works as alias. While Dup returns the lowest file descriptor available in newfd, Dup2 enforces newfd as alias (if newfd was open it is closed first).

DIAGNOSTICS

On failures, FALSE is returned and Errno.errno is set.

SEE ALSO

dup(2), fcntl(2), SysFcntl

HISTORY

Dup2 was a native system call on UNIX Edition VII and BSD-systems but may be implemented on base of fcntl(2) on UNIX System V.
Edited by: borchert, last change: 1997/02/25, revision: 1.1, converted to HTML: 1997/04/28

Modula-2 || Compiler & Tools || Library || Search Engine