Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
a6c28c97
提交
a6c28c97
8月 26, 2006
创建
作者:
rtm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mkdir check error from mknod
chdir return -1 if target not a dir
上级
a84585de
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
80 行增加
和
9 行删除
+80
-9
Notes
Notes
+1
-8
fstests.c
fstests.c
+76
-0
syscall.c
syscall.c
+3
-1
没有找到文件。
Notes
浏览文件 @
a6c28c97
...
...
@@ -114,17 +114,10 @@ why does shell often ignore first line of input?
test: one process unlinks a file while another links to it
test: one process opens a file while another deletes it
test: mkdir. deadlock d/.. vs ../d
test: sub-sub directories. mkdir("d1/d2")
test: mkdir. deadlock d/.. vs ../d, two processes.
test: dup() shared fd->off
test: indirect blocks. files and directories.
test: sbrk
test: does echo foo > x truncate x?
test: does create/mkdir/link extract last component correctly?
does namei insist that all the intermediate directories exist?
test: creat/link/mkdir w/ / in name
test: try to create dir ents when intermediate dir doesn't exist
or is a file, not a dir
make proc[0] runnable
cpu early tss and gdt
...
...
fstests.c
浏览文件 @
a6c28c97
...
...
@@ -450,6 +450,19 @@ subdir()
exit
();
}
if
(
chdir
(
"dd"
)
!=
0
){
puts
(
"chdir dd failed
\n
"
);
exit
();
}
if
(
chdir
(
"dd/../../dd"
)
!=
0
){
puts
(
"chdir dd/../../dd failed
\n
"
);
exit
();
}
if
(
chdir
(
"./.."
)
!=
0
){
puts
(
"chdir ./.. failed
\n
"
);
exit
();
}
fd
=
open
(
"dd/dd/ffff"
,
0
);
if
(
fd
<
0
){
puts
(
"open dd/dd/ffff failed
\n
"
);
...
...
@@ -506,6 +519,14 @@ subdir()
puts
(
"unlink dd/ff/ff succeeded!
\n
"
);
exit
();
}
if
(
chdir
(
"dd/ff"
)
==
0
){
puts
(
"chdir dd/ff succeeded!
\n
"
);
exit
();
}
if
(
chdir
(
"dd/xx"
)
==
0
){
puts
(
"chdir dd/xx succeeded!
\n
"
);
exit
();
}
if
(
unlink
(
"dd/dd/ffff"
)
!=
0
){
puts
(
"unlink dd/dd/ff failed
\n
"
);
...
...
@@ -522,11 +543,66 @@ subdir()
puts
(
"subdir ok
\n
"
);
}
void
bigfile
()
{
int
fd
,
i
,
total
,
cc
;
unlink
(
"bigfile"
);
fd
=
open
(
"bigfile"
,
O_CREATE
|
O_RDWR
);
if
(
fd
<
0
){
puts
(
"cannot create bigfile"
);
exit
();
}
for
(
i
=
0
;
i
<
20
;
i
++
){
memset
(
buf
,
i
,
600
);
if
(
write
(
fd
,
buf
,
600
)
!=
600
){
puts
(
"write bigfile failed
\n
"
);
exit
();
}
}
close
(
fd
);
fd
=
open
(
"bigfile"
,
0
);
if
(
fd
<
0
){
puts
(
"cannot open bigfile
\n
"
);
exit
();
}
total
=
0
;
for
(
i
=
0
;
;
i
++
){
cc
=
read
(
fd
,
buf
,
300
);
if
(
cc
<
0
){
puts
(
"read bigfile failed
\n
"
);
exit
();
}
if
(
cc
==
0
)
break
;
if
(
cc
!=
300
){
puts
(
"short read bigfile
\n
"
);
exit
();
}
if
(
buf
[
0
]
!=
i
/
2
||
buf
[
299
]
!=
i
/
2
){
puts
(
"read bigfile wrong data
\n
"
);
exit
();
}
total
+=
cc
;
}
close
(
fd
);
if
(
total
!=
20
*
600
){
puts
(
"read bigfile wrong total
\n
"
);
exit
();
}
unlink
(
"bigfile"
);
puts
(
"bigfile ok
\n
"
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
puts
(
"fstests starting
\n
"
);
bigfile
();
subdir
();
// bigdir(); // slow
concreate
();
...
...
syscall.c
浏览文件 @
a6c28c97
...
...
@@ -320,6 +320,8 @@ sys_mkdir(void)
return
-
1
;
nip
=
mknod
(
cp
->
mem
+
arg0
,
T_DIR
,
0
,
0
);
if
(
nip
==
0
)
return
-
1
;
memset
(
de
.
name
,
'\0'
,
DIRSIZ
);
de
.
name
[
0
]
=
'.'
;
...
...
@@ -364,7 +366,7 @@ sys_chdir(void)
if
(
ip
->
type
!=
T_DIR
)
{
iput
(
ip
);
return
0
;
return
-
1
;
}
idecref
(
cp
->
cwd
);
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论