Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
7834cca6
提交
7834cca6
8月 28, 2007
创建
作者:
rsc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove _ from pipe; be like file
上级
76f09d7d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
12 行增加
和
12 行删除
+12
-12
defs.h
defs.h
+4
-4
file.c
file.c
+3
-3
pipe.c
pipe.c
+4
-4
sysfile.c
sysfile.c
+1
-1
没有找到文件。
defs.h
浏览文件 @
7834cca6
...
...
@@ -92,10 +92,10 @@ void irq_enable(int);
void
pic_init
(
void
);
// pipe.c
int
pipe
_
alloc
(
struct
file
**
,
struct
file
**
);
void
pipe
_
close
(
struct
pipe
*
,
int
);
int
pipe
_
read
(
struct
pipe
*
,
char
*
,
int
);
int
pipe
_
write
(
struct
pipe
*
,
char
*
,
int
);
int
pipealloc
(
struct
file
**
,
struct
file
**
);
void
pipeclose
(
struct
pipe
*
,
int
);
int
piperead
(
struct
pipe
*
,
char
*
,
int
);
int
pipewrite
(
struct
pipe
*
,
char
*
,
int
);
// proc.c
struct
proc
*
copyproc
(
struct
proc
*
);
...
...
file.c
浏览文件 @
7834cca6
...
...
@@ -65,7 +65,7 @@ fileclose(struct file *f)
release
(
&
file_table_lock
);
if
(
ff
.
type
==
FD_PIPE
)
pipe
_
close
(
ff
.
pipe
,
ff
.
writable
);
pipeclose
(
ff
.
pipe
,
ff
.
writable
);
else
if
(
ff
.
type
==
FD_INODE
)
iput
(
ff
.
ip
);
else
...
...
@@ -94,7 +94,7 @@ fileread(struct file *f, char *addr, int n)
if
(
f
->
readable
==
0
)
return
-
1
;
if
(
f
->
type
==
FD_PIPE
)
return
pipe
_
read
(
f
->
pipe
,
addr
,
n
);
return
piperead
(
f
->
pipe
,
addr
,
n
);
if
(
f
->
type
==
FD_INODE
){
ilock
(
f
->
ip
);
if
((
r
=
readi
(
f
->
ip
,
addr
,
f
->
off
,
n
))
>
0
)
...
...
@@ -114,7 +114,7 @@ filewrite(struct file *f, char *addr, int n)
if
(
f
->
writable
==
0
)
return
-
1
;
if
(
f
->
type
==
FD_PIPE
)
return
pipe
_
write
(
f
->
pipe
,
addr
,
n
);
return
pipewrite
(
f
->
pipe
,
addr
,
n
);
if
(
f
->
type
==
FD_INODE
){
ilock
(
f
->
ip
);
if
((
r
=
writei
(
f
->
ip
,
addr
,
f
->
off
,
n
))
>
0
)
...
...
pipe.c
浏览文件 @
7834cca6
...
...
@@ -18,7 +18,7 @@ struct pipe {
};
int
pipe
_
alloc
(
struct
file
**
f0
,
struct
file
**
f1
)
pipealloc
(
struct
file
**
f0
,
struct
file
**
f1
)
{
struct
pipe
*
p
;
...
...
@@ -58,7 +58,7 @@ pipe_alloc(struct file **f0, struct file **f1)
}
void
pipe
_
close
(
struct
pipe
*
p
,
int
writable
)
pipeclose
(
struct
pipe
*
p
,
int
writable
)
{
acquire
(
&
p
->
lock
);
if
(
writable
){
...
...
@@ -76,7 +76,7 @@ pipe_close(struct pipe *p, int writable)
//PAGEBREAK: 20
int
pipe
_
write
(
struct
pipe
*
p
,
char
*
addr
,
int
n
)
pipewrite
(
struct
pipe
*
p
,
char
*
addr
,
int
n
)
{
int
i
;
...
...
@@ -99,7 +99,7 @@ pipe_write(struct pipe *p, char *addr, int n)
}
int
pipe
_
read
(
struct
pipe
*
p
,
char
*
addr
,
int
n
)
piperead
(
struct
pipe
*
p
,
char
*
addr
,
int
n
)
{
int
i
;
...
...
sysfile.c
浏览文件 @
7834cca6
...
...
@@ -379,7 +379,7 @@ sys_pipe(void)
if
(
argptr
(
0
,
(
void
*
)
&
fd
,
2
*
sizeof
(
fd
[
0
]))
<
0
)
return
-
1
;
if
(
pipe
_
alloc
(
&
rf
,
&
wf
)
<
0
)
if
(
pipealloc
(
&
rf
,
&
wf
)
<
0
)
return
-
1
;
fd0
=
-
1
;
if
((
fd0
=
fdalloc
(
rf
))
<
0
||
(
fd1
=
fdalloc
(
wf
))
<
0
){
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论