you are viewing a single comment's thread
view the rest of the comments
[–] 126 points 1 day ago* (last edited 1 day ago) (35 children)

Stages of POSIX enlightenment:

  1. It couldn't possibly all be files
  2. It's all files
  3. What is a file, anyway?
  4. There's no such thing as a file
  5. It couldn't possibly all be files
  6. Everything is a file

Most people stop at stage 2, stage 3 hits when you decide to write a filesystem, stage 4 when you've finished your first filesystem. Stage 5 is when you start working on kernel internals. No one can tell you how to reach stage 6, you must discover it for yourself.

  • source
  • hideshow 35 child comments
  • [–] 55 points 1 day ago* (8 children)

    /dev/null sez nothing is also a file

  • source
  • parent
  • hideshow 8 child comments
  • [–] 9 points 1 day ago (6 children)

    Asking for a friend.

    If you can recognize "nothing" then "nothing" must be something right? So if nothing is a file, because /dev/null says so, then nothing MUST be something to be a file. And therefore /dev/null can't be nothing.

    Or do I just need more tea? Or maybe whisk(e)y?

  • source
  • parent
  • hideshow 6 child comments
  • [–] 11 points 1 day ago (5 children)

    The word "nothing" isn't itself nothing. It is something used to describe nothing.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 10 points 1 day ago (3 children)

    The word "nothing" is the English word describing the concept of nothing. And I have to use the word to describe the concept. So yes, you are correct the word is itself "something". So that is probably one point for "nothing" to not exist.

    I have now consumed 3 cups of tea. And my head now hurts from thinking about nothing. I should never have stepped into this post.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 1 day ago (2 children)

    it's just a sentinel value. You ve reached the end. gimme back the length

  • source
  • parent
  • hideshow 2 child comments
  • in fact that gets used in abstract mathematics to first introduce the natural numbers. the empty set (nothing) (which you define as 0) is not itself nothing, so you can define the set that contains just the empty set, which now is not empty itself, but contains one element, so you define that as 1 ...

  • source
  • parent
  • [–] 26 points 1 day ago (3 children)

    Unfortunately, no one can be told what a file is. You have to see it for yourself.

    This is your last chance. After this, there is no turning back. You take the blue pill - the story ends, you wake up in your bed and believe whatever you want to believe. You take the red pill - you stay in Wonderland and I show you how deep the file system goes.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 10 points 1 day ago (3 children)
  • [–] 4 points 1 day ago (2 children)

    Missing stage 7: Not everything is a file.

    Linux is closer than other *nixes (sysctl equivalents in some platforms are not files, but they are files in Linux).

    However get very far into network and the file-like behaviors become more limited. From an application, at least you have a decent chance of having unseekable, but otherwise 'file-like' interaction with stream protocols. Then you need recvmsg/sendmsg. Then you want to deal with low level interaction with the network stack and dealing with NETLINK and such..

  • source
  • parent
  • hideshow 2 child comments
  • [–] 6 points 1 day ago (2 children)

    Okay, but what are blocks then? A file is really just a bunch of blocked stacked together with the inode metadata also sitting on another block, so is everything just blocks or because you can emulate a block device on a filesystem, are blocks themselves files? If that last part is true then files are infinitely recursive and my head is starting to spin.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 1 day ago

    The devnode that is used to reference the block is a file, so you come back to blocks just 'being offsets into some file'.

    Though system calls, ioctls and networking credibly get away from file semantics

  • source
  • parent
  • [–] 0 points 1 day ago (3 children)

    The troubles between stage 2 and 6 are probably realizing dirs are not files, and seeing that device and driver files are different things from data files. Then stage 6 would be realizing that filesystems themselves just sit on device files. The directories and data files are in the device files. In truth, everything is a device file.

    But then, I propose a stage 7. Because when you trace it all back, with mounts pointing to device files sitting in mounted file systems, you see that /dev is a tempfs, mounted in a tempfs, in which device files are "mounted". The fondamental root, /, is underneath the root filesystem a tempfs too. At boot, the kernel makes a tempfs, and later overlays the rootfs mounted from the /dev mounted in the root tempfs.
    Everything is a filesystem, ever,thing is mounted. The true files, device files, are mounted too. They are the mounting of a kernel module in the same way a directory - a filesystem - is a mounted kernel module.
    The Linux world is a ying and yang between dir structures and mounted kernel modules. In all of this, data files, the "true files", don't even show up. At the end, it's just the kernel talking to itself.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 1 point 1 day ago (2 children)

    Don’t leap ahead, or you will come to a false conclusion. Write a filesystem, then write another using a completely different approach for a system without a kernel. Then run them on each others targets. Only then will your mind be clear enough to see.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 1 day ago (1 child)

    Hm, I wrote a btrfs tool once that operates on an unmounted btrfs partition (so I can introduce forbidden states).
    And I wrote a normal fuse-based emulated fs to fool a game into loading my custom infinite world as a save.

    What more do I need to reach dao?

  • source
  • parent
  • hideshow 1 child comment