Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
d4c64e5d
提交
d4c64e5d
9月 06, 2006
创建
作者:
rsc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
writeable => writable
上级
48b82470
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
11 行增加
和
11 行删除
+11
-11
fd.c
fd.c
+2
-2
fd.h
fd.h
+1
-1
kalloc.c
kalloc.c
+1
-1
pipe.c
pipe.c
+4
-4
syscall.c
syscall.c
+3
-3
没有找到文件。
fd.c
浏览文件 @
d4c64e5d
...
...
@@ -58,7 +58,7 @@ fd_alloc(void)
int
fd_write
(
struct
fd
*
fd
,
char
*
addr
,
int
n
)
{
if
(
fd
->
writ
e
able
==
0
)
if
(
fd
->
writable
==
0
)
return
-
1
;
if
(
fd
->
type
==
FD_PIPE
){
return
pipe_write
(
fd
->
pipe
,
addr
,
n
);
...
...
@@ -114,7 +114,7 @@ fd_close(struct fd *fd)
release
(
&
fd_table_lock
);
if
(
dummy
.
type
==
FD_PIPE
){
pipe_close
(
dummy
.
pipe
,
dummy
.
writ
e
able
);
pipe_close
(
dummy
.
pipe
,
dummy
.
writable
);
}
else
if
(
dummy
.
type
==
FD_FILE
){
idecref
(
dummy
.
ip
);
}
else
{
...
...
fd.h
浏览文件 @
d4c64e5d
...
...
@@ -2,7 +2,7 @@ struct fd {
enum
{
FD_CLOSED
,
FD_NONE
,
FD_PIPE
,
FD_FILE
}
type
;
int
ref
;
// reference count
char
readable
;
char
writ
e
able
;
char
writable
;
struct
pipe
*
pipe
;
struct
inode
*
ip
;
uint
off
;
...
...
kalloc.c
浏览文件 @
d4c64e5d
...
...
@@ -51,7 +51,7 @@ kfree(char *cp, int len)
if
(
len
%
PAGE
)
panic
(
"kfree"
);
//
XXX fill with junk to help debug
//
Fill with junk to catch dangling refs.
for
(
i
=
0
;
i
<
len
;
i
++
)
cp
[
i
]
=
1
;
...
...
pipe.c
浏览文件 @
d4c64e5d
...
...
@@ -37,11 +37,11 @@ pipe_alloc(struct fd **fd1, struct fd **fd2)
initlock
(
&
p
->
lock
,
"pipe"
);
(
*
fd1
)
->
type
=
FD_PIPE
;
(
*
fd1
)
->
readable
=
1
;
(
*
fd1
)
->
writ
e
able
=
0
;
(
*
fd1
)
->
writable
=
0
;
(
*
fd1
)
->
pipe
=
p
;
(
*
fd2
)
->
type
=
FD_PIPE
;
(
*
fd2
)
->
readable
=
0
;
(
*
fd2
)
->
writ
e
able
=
1
;
(
*
fd2
)
->
writable
=
1
;
(
*
fd2
)
->
pipe
=
p
;
return
0
;
oops:
...
...
@@ -59,11 +59,11 @@ pipe_alloc(struct fd **fd1, struct fd **fd2)
}
void
pipe_close
(
struct
pipe
*
p
,
int
writ
e
able
)
pipe_close
(
struct
pipe
*
p
,
int
writable
)
{
acquire
(
&
p
->
lock
);
if
(
writ
e
able
){
if
(
writable
){
p
->
writeopen
=
0
;
wakeup
(
&
p
->
readp
);
}
else
{
...
...
syscall.c
浏览文件 @
d4c64e5d
...
...
@@ -260,13 +260,13 @@ sys_open(void)
fd
->
type
=
FD_FILE
;
if
(
arg1
&
O_RDWR
)
{
fd
->
readable
=
1
;
fd
->
writ
e
able
=
1
;
fd
->
writable
=
1
;
}
else
if
(
arg1
&
O_WRONLY
)
{
fd
->
readable
=
0
;
fd
->
writ
e
able
=
1
;
fd
->
writable
=
1
;
}
else
{
fd
->
readable
=
1
;
fd
->
writ
e
able
=
0
;
fd
->
writable
=
0
;
}
fd
->
ip
=
ip
;
fd
->
off
=
0
;
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论