andrew_w wrote:
If you do that, you lose the device-independent I/O that is relatively common in Unix. For instance, it's very common to have programs that can do I/O to either a terminal or a disk file without having to be aware of any differences between the two, and if you make those completely separate, then every program has to be specifically aware of every possible device type, which I would say is a big step backwards. It also makes security a lot more complex if you have separate primitives for each device because each has to have its own separate security layer (which already makes security way more complicated than it needs to be on conventional Unices with their multiple non-file-based primitives), whereas in an OS with a purely file-oriented architecture you basically only have to have one relatively simple security layer for the entire system. In addition, file-oriented architecture with per-process namespaces makes containerization and multiple instances of system services a lot easier.
You get piping (piping one program's stdout to another's stdin or a file, which should be the job of the shell), but I can't really think of a concrete example where two totally different classes of devices would pipe ioctls with the other understanding it?
andrew_w wrote:
then every program has to be specifically aware of every possible device type
Does every program need to touch every device, other than your device manager that can scan and load drivers?
If you use an IDL to define an interface per device class, and you had a legitimate need to pretend your joystick is an Ethernet card, you can create a wrapper program that implements a virtual Ethernet card and transforms the command to joystick commands.
So as a concrete example, let's say you had a program that distorted your voice and you wanted to pipe your microphone to it, then pipe the outputs to your speaker, you could do:
Code:
voice_transformer < /device/microphone > /devices/speaker
Whereas, I'm proposing it's not too much of an ask to build a util file called "print_microphone" and "play_stdin", put it on the package manager/app store, and now you can do:
Code:
print_microphone --depth=24 --rate=96 | voice_transformer | play_stdin --depth=24 --rate=96
I'm not proposing it's better than "everything is a file", but the fun thing about OS Dev is if you're not interested in making a Unix clone you're free to explore whatever system you'd like.