sys_dup [fs/fcntl.c]
Duplicates a file descriptor. After a successful return the old and new file descriptors may be used interchangeably. They refer to the same open file description (see sys_open) and thus share file offset and file status flags; for example, if the file offset is modified by using sys_lseek on one of the descriptors, the offset is also changed for the other. Arguments
eax | 41
ebx | File descriptor to duplicate.
Return values If the system call succeeds the return value is the new file descriptor. If the system call fails the return value is one of the following errno values:
`-EBADF` | ebx isn't an open file descriptor.
`-EMFILE` | The process already has the maximum number of file descriptors open and tried to open a new one.
Remarks The two descriptors do not share file descriptor flags (the close-on-exec flag). The close-on-exec flag (FD_CLOEXEC; see sys_fcntl) for the duplicate descriptor is off. Compatibility n/a