Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pintos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Project Purple Stallion
Pintos
Commits
cbc9aef2
Commit
cbc9aef2
authored
5 years ago
by
a2-stratford
Browse files
Options
Downloads
Patches
Plain Diff
Added guard condition to seek
Fixed guard condition in filesize to exit properly
parent
b7e2b522
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
userprog/syscall_filesize.c
+1
-0
1 addition, 0 deletions
userprog/syscall_filesize.c
userprog/syscall_seek.c
+3
-0
3 additions, 0 deletions
userprog/syscall_seek.c
with
4 additions
and
0 deletions
userprog/syscall_filesize.c
+
1
−
0
View file @
cbc9aef2
...
...
@@ -13,6 +13,7 @@ void syscall_filesize(struct intr_frame *f) {
struct
file
*
file
=
get_associated_file_pointer
(
file_descriptor
);
if
(
file
==
NULL
)
{
// Checking if file is empty or non-existent
f
->
eax
-
1
;
// Returning failure state
return
;
}
// Using the file_length function in file.h to get the length and store it
int
size
=
file_length
(
file
);
...
...
This diff is collapsed.
Click to expand it.
userprog/syscall_seek.c
+
3
−
0
View file @
cbc9aef2
...
...
@@ -17,6 +17,9 @@ void syscall_seek(struct intr_frame *f) {
// pop off second int argument from interrupt frame
unsigned
file_pos
=
*
((
unsigned
*
)((
int
*
)
f
->
esp
+
2
));
struct
file
*
file
=
get_associated_file_pointer
(
file_descriptor
);
if
(
file
==
NULL
)
{
// Checking if file is empty or non-existent
return
;
}
// Seek through the file
file_seek
(
file
,
file_pos
);
}
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