dup.2
来自「UNIX v6源代码 这几乎是最经典的unix版本 unix操作系统设计和莱」· 2 代码 · 共 62 行
2
62 行
.th DUP II 8/5/73.sh NAMEdup \*- duplicate an open file descriptor.sh SYNOPSIS(dup = 41.; not in assembler).br(file descriptor in r0).br.ft Bsys dup.s3dup(fildes).brint fildes;.ft R.sh DESCRIPTIONGivena file descriptor returned froman.it open,.it pipe,or.it creatcall,.it dupwill allocate another file descriptorsynonymouswiththe original.The new file descriptor is returned in r0..s3.it Dupis used more to reassign the valueof file descriptorsthan to genuinelyduplicate a file descriptor.Since the algorithm to allocatefile descriptorsreturns thelowest availablevalue,combinations of.it dupand.it closecan beused tomanipulate file descriptorsin a general way.This is handy formanipulating standard input and/orstandard output..sh "SEE ALSO"creat (II), open (II), close (II), pipe (II).sh DIAGNOSTICSTheerror bit (c-bit)is set if:the given file descriptor is invalid;there are already too many open files.From C, a \*-1 returned value indicates an error.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?