* common code for read and write calls:
* check permissions, set base, count, and offset,
* and switch out to readi, writei, or pipe code.
if((fp
->f_flag
&m
) == 0) {
u
.u_offset
[1] = fp
->f_offset
[1];
u
.u_offset
[0] = fp
->f_offset
[0];
dpadd(fp
->f_offset
, u
.u_arg
[1]-u
.u_count
);
u
.u_ar0
[R0
] = u
.u_arg
[1]-u
.u_count
;
open1(ip
, u
.u_arg
[1], 0);
ip
= maknode(u
.u_arg
[1]&07777&(~ISVTX
));
* common code for open and creat.
* Check permissions, allocate an open file structure,
* and call the device open routine if any.
register struct file
*fp
;
if((rip
->i_mode
&IFMT
) == IFDIR
)
if ((fp
= falloc()) == NULL
)
fp
->f_flag
= m
&(FREAD
|FWRITE
);
u
.u_ofile
[u
.u_ar0
[R0
]] = NULL
;
dpadd(n
, fp
->f_offset
[1]);
n
[0] =+ fp
->f_inode
->i_size0
&0377;
dpadd(n
, fp
->f_inode
->i_size1
);
if((ip
->i_mode
&IFMT
)==IFDIR
&& !suser())
* unlock to avoid possibly hanging the namei
if(u
.u_pdir
->i_dev
!= ip
->i_dev
) {
ip
= maknode(u
.u_arg
[1]);
ip
->i_addr
[0] = u
.u_arg
[2];
* not to be confused with the sleep internal routine.
while(dpcmp(d
[0], d
[1], time
[0], time
[1]) > 0) {
if(dpcmp(tout
[0], tout
[1], time
[0], time
[1]) <= 0 ||
dpcmp(tout
[0], tout
[1], d
[0], d
[1]) > 0) {