nuta / kerla

A new operating system kernel with Linux binary compatibility written in Rust.
Other
3.35k stars 87 forks source link

`OpenedFileTable` needs to be shareable #106

Closed michalfita closed 2 years ago

michalfita commented 2 years ago

At the moment Process::fork() seem to clone the OpenedFileTable while for proper multithreading we have to have shared access to opened files following clone(2) semantics supported by the Linux Kernel.

Found during work on #88 and belongs to Multithreading milestone (I can't add myself).

More details in the flags mask of clone(2), scroll down to CLONE_FILES. I haven't checked yet how it's implemented in Linux Kernel.

nuta commented 2 years ago

I think so too. Similar to #107, let's use Arc<SpinLock<OpenedFileTable>> for opened_files.