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
d32895b7
Verified
Commit
d32895b7
authored
5 years ago
by
ja3-saxby
Browse files
Options
Downloads
Patches
Plain Diff
Implement tell()
parent
271ab108
No related branches found
No related tags found
2 merge requests
!22
Merge Feature/system calls
,
!20
Implement tell() system call
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile.build
+1
-0
1 addition, 0 deletions
Makefile.build
userprog/syscall_tell.c
+19
-0
19 additions, 0 deletions
userprog/syscall_tell.c
userprog/system_calls.h
+6
-0
6 additions, 0 deletions
userprog/system_calls.h
with
26 additions
and
0 deletions
Makefile.build
+
1
−
0
View file @
d32895b7
...
@@ -73,6 +73,7 @@ userprog_SRC += userprog/syscall_write.c
...
@@ -73,6 +73,7 @@ userprog_SRC += userprog/syscall_write.c
userprog_SRC
+=
userprog/file_descriptors_map.c
userprog_SRC
+=
userprog/file_descriptors_map.c
userprog_SRC
+=
userprog/syscall_read.c
userprog_SRC
+=
userprog/syscall_read.c
userprog_SRC
+=
userprog/syscall_filesize.c
userprog_SRC
+=
userprog/syscall_filesize.c
userprog_SRC
+=
userprog/syscall_tell.c
# No virtual memory code yet.
# No virtual memory code yet.
#vm_SRC = vm/file.c # Some file.
#vm_SRC = vm/file.c # Some file.
...
...
This diff is collapsed.
Click to expand it.
userprog/syscall_tell.c
0 → 100644
+
19
−
0
View file @
d32895b7
/*
* Returns the current offset into the file that the given file descriptor is at
*
* Authored by Joshua Saxby
*/
#include
<stddef.h>
#include
"system_calls.h"
#include
"filesys/file.h"
void
syscall_tell
(
struct
intr_frame
*
f
)
{
// pop off first int argument from interrupt frame
int
file_descriptor
=
*
((
int
*
)
f
->
esp
+
1
);
struct
file
*
file
=
get_associated_file_pointer
(
file_descriptor
);
/*
* tell() return type is unsigned so we can't return a special error code if
* file descriptor passed is invalid. Instead, we return 0 silently.
*/
f
->
eax
=
(
file
!=
NULL
)
?
file_tell
(
file
)
:
0
;
}
This diff is collapsed.
Click to expand it.
userprog/system_calls.h
+
6
−
0
View file @
d32895b7
...
@@ -69,6 +69,12 @@ void syscall_filesize(struct intr_frame *f);
...
@@ -69,6 +69,12 @@ void syscall_filesize(struct intr_frame *f);
*/
*/
void
syscall_remove
(
struct
intr_frame
*
f
);
void
syscall_remove
(
struct
intr_frame
*
f
);
/*
* Returns the position of the next byte to be read or written in open file fd,
* expressed in bytes from the beginning of the file.
*/
void
syscall_tell
(
struct
intr_frame
*
f
);
/*
/*
* special additional stuff for handling file descriptors because they're annoying
* special additional stuff for handling file descriptors because they're annoying
*/
*/
...
...
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