code:dup - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki
- 生成新的 u.u_ofile[]项,指向给定的file结构
- 使用1个隐式参数
- 文件描述号 : u.u_ar0[R0]
6065
6066 /*
6067 * the dup system call.
6068 */
6069 dup()
6070 {
6071 register i, *fp;
6072
6074 if(fp == NULL)
- 根据 文件描述号 查找 指定的file结构
6075 return;
6076 if ((i = ufalloc()) < 0)
6077 return;
6079 fp->f_count++;
6080 }
6081 /* ------------------------- */
- (dup = 41.; not in assembler)
- (file descriptor in r0)
- sys dup