You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement open(), which opens a file with given name, returning file descriptor.
File descriptor value is unique, i.e, two distinct file must not have same file descriptor value. So, there should be some kind of FD-dispatcher which assign integer to each files. Unopened files should have no influence over current execution, so FD-dispatching sequence should be placed inside open(). Also, if a thread has file descriptors of whole files it is accessing, it could track files with that values.
Implementation should consider the following:
New member in struct thread to contain every file descriptors of files that thread is accessing.
New member in struct thread, to make current thread what number next opening file would have as its file descriptor.
New struct that saves fd and corresponding file in linked list, to find a file with a given file descriptor. In this step, file structure defined in file.c should be moved to file.h, to be used in this declaration of new structure complex.
A function in file.c named file_open() should be used..
The text was updated successfully, but these errors were encountered:
Implement
open()
, which opens a file with given name, returning file descriptor.File descriptor value is unique, i.e, two distinct file must not have same file descriptor value. So, there should be some kind of FD-dispatcher which assign integer to each files. Unopened files should have no influence over current execution, so FD-dispatching sequence should be placed inside
open()
. Also, if a thread has file descriptors of whole files it is accessing, it could track files with that values.Implementation should consider the following:
file_open()
should be used..The text was updated successfully, but these errors were encountered: