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
1ccff18b
Commit
1ccff18b
authored
17 years ago
by
rsc
Browse files
Options
Downloads
Patches
Plain Diff
fileincref -> filedup (consistent with idup)
parent
7895178d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
defs.h
+1
-1
1 addition, 1 deletion
defs.h
file.c
+4
-3
4 additions, 3 deletions
file.c
proc.c
+3
-4
3 additions, 4 deletions
proc.c
sysfile.c
+1
-1
1 addition, 1 deletion
sysfile.c
with
9 additions
and
9 deletions
defs.h
+
1
−
1
View file @
1ccff18b
...
...
@@ -28,7 +28,7 @@ int exec(char*, char**);
// file.c
struct
file
*
filealloc
(
void
);
void
fileclose
(
struct
file
*
);
void
file
incref
(
struct
file
*
);
struct
file
*
file
dup
(
struct
file
*
);
void
fileinit
(
void
);
int
fileread
(
struct
file
*
,
char
*
,
int
n
);
int
filestat
(
struct
file
*
,
struct
stat
*
);
...
...
This diff is collapsed.
Click to expand it.
file.c
+
4
−
3
View file @
1ccff18b
...
...
@@ -41,14 +41,15 @@ filealloc(void)
}
// Increment ref count for file f.
void
file
incref
(
struct
file
*
f
)
struct
file
*
file
dup
(
struct
file
*
f
)
{
acquire
(
&
file_table_lock
);
if
(
f
->
ref
<
1
||
f
->
type
==
FD_CLOSED
)
panic
(
"file
incref
"
);
panic
(
"file
dup
"
);
f
->
ref
++
;
release
(
&
file_table_lock
);
return
f
;
}
// Read from file f. Addr is kernel address.
...
...
This diff is collapsed.
Click to expand it.
proc.c
+
3
−
4
View file @
1ccff18b
...
...
@@ -129,10 +129,9 @@ copyproc(struct proc *p)
}
memmove
(
np
->
mem
,
p
->
mem
,
np
->
sz
);
for
(
i
=
0
;
i
<
NOFILE
;
i
++
){
if
((
np
->
ofile
[
i
]
=
p
->
ofile
[
i
])
!=
0
)
fileincref
(
np
->
ofile
[
i
]);
}
for
(
i
=
0
;
i
<
NOFILE
;
i
++
)
if
(
p
->
ofile
[
i
])
np
->
ofile
[
i
]
=
filedup
(
p
->
ofile
[
i
]);
np
->
cwd
=
idup
(
p
->
cwd
);
}
...
...
This diff is collapsed.
Click to expand it.
sysfile.c
+
1
−
1
View file @
1ccff18b
...
...
@@ -83,7 +83,7 @@ sys_dup(void)
return
-
1
;
if
((
fd
=
fdalloc
(
f
))
<
0
)
return
-
1
;
file
incref
(
f
);
file
dup
(
f
);
return
fd
;
}
...
...
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