svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
dup(2)
dup(2) System Calls dup(2)
NAME
dup - duplicate an open file descriptor
SYNOPSIS
#include <unistd.h>
int dup(int fildes);
DESCRIPTION
The dup() function returns a new file descriptor having the following
in common with the original open file descriptor fildes:
o same open file object
o same file pointer (that is, both file descriptors share one
file pointer)
o same access mode (read, write or read/write).
The new file descriptor is set to remain open across exec() functions
(see fcntl(2)).
The file descriptor returned is the lowest one available.
The dup(fildes) function call is equivalent to:
fcntl(fildes, F_DUPFD, 0)
RETURN VALUES
Upon successful completion, a non-negative integer representing the
file descriptor is returned. Otherwise, −1 is returned and errno is set
to indicate the error.
ERRORS
The dup() function will fail if:
EBADF The fildes argument is not a valid open file descriptor.
EINTR A signal was caught during the execution of the dup() func‐
tion.
EMFILE The process has too many open files (see getrlimit(2)).
ENOLINK The fildes argument is on a remote machine and the link to
that machine is no longer active.
USAGE
Additional options are available via the alternative functions dup2(3C)
and dup3(3C), or by using the F_DUP* command arguments to fcntl(2).
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelAsync-Signal-
Safe _ StandardSee standards(7).
SEE ALSO
exec(2), close(2), creat(2), fcntl(2), getrlimit(2), open(2), pipe(2),
dup2(3C), dup3(3C), lockf(3C), attributes(7), standards(7)
HISTORY
The dup() function has been included in all Sun and Oracle releases of
Solaris.
Oracle Solaris 11.4 30 Jan 2023 dup(2)