dup.2
来自「unix v7是最后一个广泛发布的研究型UNIX版本」· 2 代码 · 共 63 行
2
63 行
.TH DUP 2 .SH NAMEdup, dup2 \- duplicate an open file descriptor.SH SYNOPSIS.B dup(fildes).br.B int fildes;.PP.B dup2(fildes, fildes2).br.B int fildes, fildes2;.SH DESCRIPTIONGivena file descriptor returned froman.I open,.I pipe,or.I creatcall,.I dupallocates another file descriptorsynonymouswiththe original.The new file descriptor is returned..PPIn the second form of the call,.I fildesis a file descriptor referring to an open file, and.I fildes2is a non-negative integer less than the maximum valueallowed for file descriptors (approximately 19)..I Dup2causes.I fildes2to refer to the same file as.I fildes.If.I fildes2already referred to an open file, it is closed first..SH "SEE ALSO"creat(2), open(2), close(2), pipe(2).SH DIAGNOSTICSThe value \-1 is returned if:the given file descriptor is invalid;there are already too many open files..SH ASSEMBLER(dup = 41.).br(file descriptor in r0).br(new file descriptor in r1).br.B sys dup.br(file descriptor in r0).PPThe.I dup2entry is implemented by adding 0100 to.I fildes.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?