Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSEP551
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
16083d44
Commit
16083d44
authored
18 years ago
by
kaashoek
Browse files
Options
Downloads
Patches
Plain Diff
removed block system call
renumber system calls (run gmake clean!) skeleton for dup system call
parent
8787cd01
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
defs.h
+1
-0
1 addition, 0 deletions
defs.h
fd.c
+6
-0
6 additions, 0 deletions
fd.c
syscall.c
+20
-41
20 additions, 41 deletions
syscall.c
syscall.h
+14
-14
14 additions, 14 deletions
syscall.h
user.h
+1
-1
1 addition, 1 deletion
user.h
userfs.c
+0
-2
0 additions, 2 deletions
userfs.c
usys.S
+1
-1
1 addition, 1 deletion
usys.S
with
43 additions
and
59 deletions
defs.h
+
1
−
0
View file @
16083d44
...
...
@@ -94,6 +94,7 @@ int fd_read(struct fd *fd, char *addr, int n);
int
fd_write
(
struct
fd
*
fd
,
char
*
addr
,
int
n
);
int
fd_stat
(
struct
fd
*
fd
,
struct
stat
*
);
void
fd_incref
(
struct
fd
*
fd
);
int
fd_dup
(
struct
fd
*
fd
);
// ide.c
void
ide_init
(
void
);
...
...
This diff is collapsed.
Click to expand it.
fd.c
+
6
−
0
View file @
16083d44
...
...
@@ -149,3 +149,9 @@ fd_incref(struct fd *fd)
fd
->
ref
++
;
release
(
&
fd_table_lock
);
}
int
fd_dup
(
struct
fd
*
fd
)
{
return
-
1
;
}
This diff is collapsed.
Click to expand it.
syscall.c
+
20
−
41
View file @
16083d44
...
...
@@ -398,6 +398,23 @@ sys_fstat(void)
return
r
;
}
int
sys_dup
(
void
)
{
struct
proc
*
cp
=
curproc
[
cpu
()];
uint
fd
;
int
r
;
if
(
fetcharg
(
0
,
&
fd
)
<
0
)
return
-
1
;
if
(
fd
<
0
||
fd
>=
NOFILE
)
return
-
1
;
if
(
cp
->
fds
[
fd
]
==
0
)
return
-
1
;
r
=
fd_dup
(
cp
->
fds
[
fd
]);
return
r
;
}
int
sys_link
(
void
)
{
...
...
@@ -543,44 +560,6 @@ sys_exec(void)
return
0
;
}
int
sys_block
(
void
)
{
int
i
,
j
;
struct
buf
*
b
;
struct
inode
*
ip
;
for
(
i
=
0
;
i
<
2
;
i
++
)
{
cprintf
(
"issue read
\n
"
);
b
=
bread
(
1
,
i
);
cprintf
(
"disk 1 sector %d: "
,
i
);
for
(
j
=
0
;
j
<
4
;
j
++
)
cprintf
(
"%x "
,
b
->
data
[
j
]
&
0xff
);
cprintf
(
"
\n
"
);
brelse
(
b
);
}
ip
=
iget
(
1
,
1
);
cprintf
(
"iget 1: %d %d %d %d %d %d %d %d
\n
"
,
ip
->
dev
,
ip
->
inum
,
ip
->
count
,
ip
->
busy
,
ip
->
type
,
ip
->
nlink
,
ip
->
size
,
ip
->
addrs
[
0
]);
iput
(
ip
);
ip
=
namei
(
".././//./../usertests"
,
NAMEI_LOOKUP
,
0
);
if
(
ip
){
cprintf
(
"namei(usertests): %d %d %d %d %d %d %d %d
\n
"
,
ip
->
dev
,
ip
->
inum
,
ip
->
count
,
ip
->
busy
,
ip
->
type
,
ip
->
nlink
,
ip
->
size
,
ip
->
addrs
[
0
]);
iput
(
ip
);
}
else
{
cprintf
(
"namei(usertests) failed
\n
"
);
}
return
0
;
}
void
syscall
(
void
)
{
...
...
@@ -610,9 +589,6 @@ syscall(void)
case
SYS_close
:
ret
=
sys_close
();
break
;
case
SYS_block
:
ret
=
sys_block
();
break
;
case
SYS_kill
:
ret
=
sys_kill
();
break
;
...
...
@@ -640,6 +616,9 @@ syscall(void)
case
SYS_chdir
:
ret
=
sys_chdir
();
break
;
case
SYS_dup
:
ret
=
sys_dup
();
break
;
default:
cprintf
(
"unknown sys call %d
\n
"
,
num
);
// XXX fault
...
...
This diff is collapsed.
Click to expand it.
syscall.h
+
14
−
14
View file @
16083d44
#define SYS_fork 1
#define SYS_exit 2
#define SYS_wait 3
#define SYS_pipe
5
#define SYS_write
6
#define SYS_read
7
#define SYS_close
8
#define SYS_
block
9
#define SYS_
kill
10
#define SYS_
exec
1
3
#define SYS_
open
1
4
#define SYS_
mknod
1
5
#define SYS_
unlink
1
6
#define SYS_
fstat
1
7
#define SYS_
link
1
8
#define SYS_
mk
dir 1
9
#define SYS_
chdir 20
#define SYS_pipe
4
#define SYS_write
5
#define SYS_read
6
#define SYS_close
7
#define SYS_
kill
9
#define SYS_
exec
10
#define SYS_
open
1
1
#define SYS_
mknod
1
2
#define SYS_
unlink
1
3
#define SYS_
fstat
1
4
#define SYS_
link
1
5
#define SYS_
mkdir
1
6
#define SYS_
ch
dir 1
7
#define SYS_
dup 18
This diff is collapsed.
Click to expand it.
user.h
+
1
−
1
View file @
16083d44
...
...
@@ -6,7 +6,6 @@ int pipe(int*);
int
write
(
int
,
void
*
,
int
);
int
read
(
int
,
void
*
,
int
);
int
close
(
int
);
int
block
(
void
);
int
kill
(
int
);
int
panic
(
char
*
);
int
cons_puts
(
char
*
);
...
...
@@ -18,6 +17,7 @@ int fstat (int fd, struct stat *stat);
int
link
(
char
*
,
char
*
);
int
mkdir
(
char
*
);
int
chdir
(
char
*
);
int
dup
(
int
);
int
stat
(
char
*
,
struct
stat
*
stat
);
int
puts
(
char
*
);
...
...
This diff is collapsed.
Click to expand it.
userfs.c
+
0
−
2
View file @
16083d44
...
...
@@ -20,8 +20,6 @@ main(void)
printf
(
stdout
,
"userfs is running
\n
"
);
block
();
fd
=
open
(
"echo"
,
0
);
if
(
fd
>=
0
){
printf
(
stdout
,
"open echo ok
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
usys.S
+
1
−
1
View file @
16083d44
...
...
@@ -15,7 +15,6 @@ STUB(pipe)
STUB
(
read
)
STUB
(
write
)
STUB
(
close
)
STUB
(
block
)
STUB
(
kill
)
STUB
(
exec
)
STUB
(
open
)
...
...
@@ -25,3 +24,4 @@ STUB(fstat)
STUB
(
link
)
STUB
(
mkdir
)
STUB
(
chdir
)
STUB
(
dup
)
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