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
d49a2d53
Commit
d49a2d53
authored
18 years ago
by
kaashoek
Browse files
Options
Downloads
Patches
Plain Diff
nits
parent
56ac0d72
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
Makefile
+2
-2
2 additions, 2 deletions
Makefile
sh.c
+4
-17
4 additions, 17 deletions
sh.c
user.h
+2
-3
2 additions, 3 deletions
user.h
with
8 additions
and
22 deletions
Makefile
+
2
−
2
View file @
d49a2d53
...
...
@@ -128,8 +128,8 @@ rm : rm.o $(ULIB)
mkfs
:
mkfs.c fs.h
cc
-o
mkfs mkfs.c
fs.img
:
mkfs userfs usertests echo cat
readme
init sh ls mkdir rm fstests
./mkfs fs.img userfs usertests
echo cat
readme
init sh
ls mkdir rm
fstests
fs.img
:
mkfs userfs usertests echo cat
README
init sh ls mkdir rm fstests
./mkfs fs.img userfs usertests
echo cat
README
init sh
ls mkdir rm
fstests
-include
*.d
...
...
This diff is collapsed.
Click to expand it.
sh.c
+
4
−
17
View file @
d49a2d53
...
...
@@ -162,37 +162,24 @@ ioredirection(void)
for
(
i
=
0
;
i
<
nextnode
;
i
++
)
{
switch
(
list
[
i
].
token
)
{
case
'<'
:
if
(
close
(
0
)
<
0
)
printf
(
2
,
"close 0 failed
\n
"
);
if
((
fd
=
open
(
list
[
i
].
s
,
O_RDONLY
))
<
0
)
{
printf
(
2
,
"failed to open %s for read: %d"
,
list
[
i
].
s
,
fd
);
return
-
1
;
}
if
(
debug
)
printf
(
2
,
"redirect 0 from %s
\n
"
,
list
[
i
].
s
);
close
(
0
);
if
((
dfd
=
dup
(
fd
))
<
0
)
printf
(
2
,
"dup failed
\n
"
);
if
(
debug
)
printf
(
2
,
"dup returns %d
\n
"
,
dfd
);
close
(
fd
);
break
;
case
'>'
:
if
(
close
(
1
)
<
0
)
printf
(
2
,
"close 1 failed
\n
"
);
if
((
fd
=
open
(
list
[
i
].
s
,
O_WRONLY
|
O_CREATE
))
<
0
)
{
printf
(
2
,
"failed to open %s for write: %d"
,
list
[
i
].
s
,
fd
);
exit
();
}
if
(
debug
)
printf
(
2
,
"redirect 1 to %s
\n
"
,
list
[
i
].
s
);
if
(
close
(
1
)
<
0
)
printf
(
2
,
"close 1 failed
\n
"
);
if
((
dfd
=
dup
(
fd
))
<
0
)
printf
(
2
,
"dup failed
\n
"
);
if
(
debug
)
printf
(
2
,
"dup returns %d
\n
"
,
dfd
);
close
(
fd
);
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
user.h
+
2
−
3
View file @
d49a2d53
// system calls
int
fork
(
void
);
int
exit
(
void
)
__attribute__
((
noreturn
));
int
wait
(
void
);
int
cons_putc
(
int
);
int
pipe
(
int
*
);
int
write
(
int
,
void
*
,
int
);
int
read
(
int
,
void
*
,
int
);
int
close
(
int
);
int
kill
(
int
);
int
panic
(
char
*
);
int
cons_puts
(
char
*
);
int
exec
(
char
*
,
char
**
);
int
open
(
char
*
,
int
);
int
mknod
(
char
*
,
short
,
short
,
short
);
...
...
@@ -21,6 +19,7 @@ int dup(int);
int
getpid
();
char
*
sbrk
(
int
);
// ulib.c
int
stat
(
char
*
,
struct
stat
*
stat
);
int
puts
(
char
*
);
char
*
strcpy
(
char
*
,
char
*
);
...
...
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