0% found this document useful (0 votes)
31 views2 pages

Test

The document discusses the design of a module for system calls. It outlines initial functionality including a file system and process execution. It describes data structures like a file descriptor table to maintain open files. The functions to be implemented are create, open, read, and seek to interface with the file system and manage file I/O and positioning. Each function's purpose is described at a high level.

Uploaded by

Alexe Mihai
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views2 pages

Test

The document discusses the design of a module for system calls. It outlines initial functionality including a file system and process execution. It describes data structures like a file descriptor table to maintain open files. The functions to be implemented are create, open, read, and seek to interface with the file system and manage file I/O and positioning. Each function's purpose is described at a high level.

Uploaded by

Alexe Mihai
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Chapter 3

Design of Module UserProg


3.1 Initial Functionality

We already have a file system, which is able to load files and to read/write
data in them. This file system covers most of the system calls requirements,
doing those operations effectively.
I also have the implementation of the argument passing functionality and
of running several processes from the team mates.

3.2 Data Structures and Functions

The implementation of system calls needs a structure for maintaining a


file descriptor table. The table can be implemented as an array containing the
file structure type defined in the file system. This array will have a fixed
maximum size and the index of this array will be the file descriptor.

The functions I will implement are the following system calls:

bool create (const char *file, unsigned initial_size);


int open (const char *file);
int read (int fd, void *buffer, unsigned size);
void seek (int fd, unsigned position);

3.3 Functionality

The create function has the purpose of creating a file and also open it.
This means it will be allocated in the file descriptor table and will have a fixed
size. It is the user’s responsability to check this size and to make sure they don’t
write after the end of file.
The open file function will retrieve the file descriptor in the table for the
user.
The read function will read from the file the specified number of positions
in a buffer. This function will use the read function of the file system, which
reads bytes from the current position. The FD0 special case should be treated,
as it needs reading from the console.
The seek function will only use the seek capability of the file system.

You might also like