Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSEP551
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Krishna Vinnakota
CSEP551
Commits
a6c28c97
Commit
a6c28c97
authored
18 years ago
by
rtm
Browse files
Options
Downloads
Patches
Plain Diff
mkdir check error from mknod
chdir return -1 if target not a dir
parent
a84585de
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Notes
+1
-8
1 addition, 8 deletions
Notes
fstests.c
+76
-0
76 additions, 0 deletions
fstests.c
syscall.c
+4
-2
4 additions, 2 deletions
syscall.c
with
81 additions
and
10 deletions
Notes
+
1
−
8
View file @
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
...
...
This diff is collapsed.
Click to expand it.
fstests.c
+
76
−
0
View file @
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
();
...
...
This diff is collapsed.
Click to expand it.
syscall.c
+
4
−
2
View file @
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
]
=
'.'
;
...
...
@@ -356,7 +358,7 @@ sys_chdir(void)
if
((
ip
=
namei
(
cp
->
mem
+
arg0
,
NAMEI_LOOKUP
,
0
,
0
,
0
))
==
0
)
return
-
1
;
if
(
ip
==
cp
->
cwd
)
{
iput
(
ip
);
return
0
;
...
...
@@ -364,7 +366,7 @@ sys_chdir(void)
if
(
ip
->
type
!=
T_DIR
)
{
iput
(
ip
);
return
0
;
return
-
1
;
}
idecref
(
cp
->
cwd
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment