:: Re: [DNG] Food for thought?
Página Principal
Delete this message
Reply to this message
Autor: Didier Kryn
Data:  
Para: dng
Assunto: Re: [DNG] Food for thought?
Le 17/02/2024 à 08:50, Johan Helsingius via Dng a écrit :
> On 16/02/2024 21:43, karl@??? wrote:
>
>> Not everything in Linux/Unix is a file.
>> Examples:
>> . network devices
>> . sysv ipc
>
> The networking stuff came from Berkeley, and was pretty separate from
> the rest of UNIX. The Bell Labs Research UNIX was moving towards having
> the network as files - can't remember if it already was in V9 or V10,
> but definitely in Plan 9.
>
> SysV stuff came from USG/USL, the less said about that the better...


    I think the reason for the absence of network interfaces in /dev is
the by-design limitation of the device special files: they are either
character-device or block-device. Other device classes would help but I
guess nobody wanted to go this step. This is not only for network, but
maybe also for video and intermediate busses.

    Note however that, in Unix/Linux, you can read() and write()
from/to a TCP socket like from/to a file and close() it likewise. The
thing which is not file-like is the openning of a socket. I'm not sure
it is so difficult to implement.

    Multithreading is now often used instead of multiprocessing, but
before y2k there was no choice but sysv IPC shared memory and semaphores.

    "everything is a file" is an ideal and Linux makes progress in this
mater:

    - the eventfd API provides a file-like implementation of IPC
semaphores.

    - the signalfd API provides a safe and serialized method to catch
signals.

    These two kinds of file descriptors can be polled and therefore an
application can poll() them simultaneously with any number of other file
descriptors. This is the main benefit of "everything is a file".

--   Didier