Blew My Mind Into Orbit

a month ago by alectronic to c/linuxmemes

BartyDeCanter 126 points a month ago

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.

path: 0 25816097, hotness: undefined, score: 126, children: 35
Sinthesis 56 points a month ago

/dev/null sez nothing is also a file

path: 0 25816097 25816152, hotness: undefined, score: 56, children: 8
Bluewing 9 points a month ago

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?

path: 0 25816097 25816152 25820452, hotness: undefined, score: 9, children: 6
HeHoXa 12 points a month ago

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

path: 0 25816097 25816152 25820452 25821111, hotness: undefined, score: 12, children: 5
Bluewing 11 points a month ago

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.

path: 0 25816097 25816152 25820452 25821111 25821289, hotness: undefined, score: 11, children: 3
gandalf_der_13te 5 points a month ago

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 ...

path: 0 25816097 25816152 25820452 25821111 25822906, hotness: undefined, score: 5, children: 0
sik0fewl 2 points a month ago

A file would be something. No, it was nothing.

path: 0 25816097 25816152 25821185, hotness: undefined, score: 2, children: 0
SpaceCowboy 26 points a month ago

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.

path: 0 25816097 25816190, hotness: undefined, score: 26, children: 3
NeatNit 34 points a month ago path: 0 25816097 25816190 25816714, hotness: undefined, score: 34, children: 1
UnderpantsWeevil 3 points a month ago

I feel like it's more of a "If I tried to tell you what this was, you wouldn't believe me" than a "I am physically incapable of explaining the idea that you're plugged into a computer".

path: 0 25816097 25816190 25816714 25838451, hotness: undefined, score: 3, children: 0
Bluewing 2 points a month ago

That way lies madness!

path: 0 25816097 25816190 25820476, hotness: undefined, score: 2, children: 0
swab148 15 points a month ago

You'll know you've reached stage 6 when you seriously start considering running Plan 9 as a daily driver

path: 0 25816097 25816635, hotness: undefined, score: 15, children: 0
chrash0 12 points a month ago

true enlightenment: everything is a string over an IO socket

path: 0 25816097 25821630, hotness: undefined, score: 12, children: 2
mkwt 3 points a month ago

But are sockets not files?

path: 0 25816097 25821630 25828736, hotness: undefined, score: 3, children: 1
chrash0 3 points a month ago

files are named sockets 🕉️

path: 0 25816097 25821630 25828736 25829994, hotness: undefined, score: 3, children: 0
rtxn 10 points a month ago

"How can files be real if the filesystem isn't real?" - Jaden Smith (probably)

path: 0 25816097 25818300, hotness: undefined, score: 10, children: 0
Agent641 10 points a month ago

Am I a file?

path: 0 25816097 25818656, hotness: undefined, score: 10, children: 3
Ensign_Crab 8 points a month ago

Can you read me?

path: 0 25816097 25818656 25819002, hotness: undefined, score: 8, children: 0
thorcik 7 points a month ago

Hope your name isn't Peter

path: 0 25816097 25818656 25823212, hotness: undefined, score: 7, children: 0
BartyDeCanter 2 points a month ago

In the end, we are all files. We have our read()s and write()s, in in our time we play many offsets.

path: 0 25816097 25818656 25838222, hotness: undefined, score: 2, children: 0
Equinox1289 6 points a month ago

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.

path: 0 25816097 25816441, hotness: undefined, score: 6, children: 2
BartyDeCanter 4 points a month ago

You are almost ready to take the next step. But to do so, you must unlearn what you think you know. Write a filesystem that does not have blocks for a media without pages, and you will find the footprints of your next teacher.

path: 0 25816097 25816441 25817941, hotness: undefined, score: 4, children: 0
jj4211 1 point a month 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

path: 0 25816097 25816441 25820781, hotness: undefined, score: 1, children: 0
socsa 5 points a month ago
  1. Everything is a FIFO
path: 0 25816097 25826313, hotness: undefined, score: 5, children: 0
Zozano 5 points a month ago path: 0 25816097 25819325, hotness: undefined, score: 5, children: 0
Bo7a 4 points a month ago

And the hidden 0th level that you only get after being nearly killed by a falling server rack:

"Files Aren't Things"

Which looks great on a tshirt, btw :p

path: 0 25816097 25820229, hotness: undefined, score: 4, children: 0
jj4211 4 points a month ago

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..

path: 0 25816097 25820752, hotness: undefined, score: 4, children: 2
call_me_xale 3 points a month ago

That's where plan9 comes in!

path: 0 25816097 25820752 25826254, hotness: undefined, score: 3, children: 1
jj4211 4 points a month ago

Yes, the "did I stutter?" If everything is a file philosophy.

path: 0 25816097 25820752 25826254 25828338, hotness: undefined, score: 4, children: 0
Redjard 0 points a month ago

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.

path: 0 25816097 25825170, hotness: undefined, score: 0, children: 3
BartyDeCanter 1 point a month ago

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.

path: 0 25816097 25825170 25825171, hotness: undefined, score: 1, children: 2
Redjard 2 points a month ago

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?

path: 0 25816097 25825170 25825171 25825448, hotness: undefined, score: 2, children: 1
BartyDeCanter 1 point a month ago

The old masters did not have fuse and there are more devices than your SSD. Write a log formatted filesystem for an SPI flash chip, and move your fuse-based system onto a HDD. Then the next path will be revealed.

path: 0 25816097 25825170 25825171 25825448 25838848, hotness: undefined, score: 1, children: 0
JackbyDev 54 points a month ago

It makes more sense when you realize that it's not that everything is files it's that everything can be treated as a file. There are other APIs to interact with things, but everything can be interacted with as if it was a file. It doesn't seem as bonkers like this.

path: 0 25818416, hotness: undefined, score: 54, children: 9
absentbird 18 points a month ago

Exactly. A file is really just a way to understand a collection of bits. So saying everything is files is like saying everything in computers can be described as sets of bits, which is not a terrible heuristic.

path: 0 25818416 25821163, hotness: undefined, score: 18, children: 2
BobWehadababyitsaboy 15 points a month ago

It's like saying everything is a wave IRL.

path: 0 25818416 25821163 25821544, hotness: undefined, score: 15, children: 1
InternetCitizen2 8 points a month ago

Especially the particles

path: 0 25818416 25821163 25821544 25823343, hotness: undefined, score: 8, children: 0
possiblylinux127 8 points a month ago

Files don't actually exist once you dig down

path: 0 25818416 25823036, hotness: undefined, score: 8, children: 4
socsa 15 points a month ago

Bro stop digging I need those files to keep existing

path: 0 25818416 25823036 25826346, hotness: undefined, score: 15, children: 0
JackbyDev 9 points a month ago

Yeah, it sort of depends on the definition of the word file. "File" in the sense that it can be interacted with like a file versus "file" in the sense that it's data on a disk. But then, if you're really thinking about it, data on a disk isn't a file, it's data, and we can just interact with it like a file.

path: 0 25818416 25823036 25825652, hotness: undefined, score: 9, children: 2
ivanafterall 5 points a month ago

🤯

path: 0 25818416 25823036 25825652 25826910, hotness: undefined, score: 5, children: 0
BartyDeCanter 2 points a month ago

Welcome, brother. But remember that they must walk the path themselves or they will never reach true understanding.

path: 0 25818416 25823036 25825652 25838879, hotness: undefined, score: 2, children: 0
anarchy79 4 points a month ago

Everything is computer.

path: 0 25818416 25828737, hotness: undefined, score: 4, children: 0
Truscape 47 points a month ago

Yep, takes a moment to wrap your head around but the longer you read linux/unix documentation, the more it makes sense why it is the case.

path: 0 25815356, hotness: undefined, score: 47, children: 1
gandalf_der_13te 7 points a month ago

tldr: it's to have nicer, less complicated I/O operations

it enables just having two API calls: read() and write() to do everything

path: 0 25815356 25822962, hotness: undefined, score: 7, children: 0
AnimalsDream 21 points a month ago

path: 0 25825498, hotness: undefined, score: 21, children: 2
bhamlin 14 points a month ago

Can confirm; user is file too

path: 0 25825498 25826577, hotness: undefined, score: 14, children: 1
anarchy79 9 points a month ago

Source: user

path: 0 25825498 25826577 25828690, hotness: undefined, score: 9, children: 0
notptr 12 points a month ago

Want take it to 11 plan 9 did it.

path: 0 25816048, hotness: undefined, score: 12, children: 0
heartSagan5 6 points a month ago

In Windows land, it's HANDLEs...which is typedef void* HANDLE IIRC

path: 0 25826360, hotness: undefined, score: 6, children: 1
h4x0r 2 points a month ago

Generally speaking, a handle is an opaque reference to an os object; the typedef here makes that clear. Linux uses the same general concept as well, though file objects are typically referenced through file descriptors rather than windows style handles.

path: 0 25826360 25838564, hotness: undefined, score: 2, children: 0
BlueKey 6 points a month ago

But some things are directories (like cgroups). And Networknamespaces were also controled in a weird way.
And then there are kernel features which are not exposed through a file or syscall but through a special type of socket.

path: 0 25816771, hotness: undefined, score: 6, children: 2
Axolotl_cpp 9 points a month ago

Aren't directories just files that say "hey i am directory ABCD and file X, Y and Z are my childs"?

path: 0 25816771 25818909, hotness: undefined, score: 9, children: 1
notabot 5 points a month ago

Directories are just files if you squint at then right, and sockets are basically files too. As another commenter said, it's not that everything is literally a file, but that it presents as a file, and can be interacted with as one.

path: 0 25816771 25818909 25819556, hotness: undefined, score: 5, children: 0
Flower 6 points a month ago

Well, if you go back far enough you might encounter punch cards or even switches, but then again you're not taking about modern computers anymore.

path: 0 25818460, hotness: undefined, score: 6, children: 8
Bluewing 9 points a month ago

What's this "back far enough" shit, I've used punch cards and punch tape.

Fuck me I'm old.

path: 0 25818460 25820330, hotness: undefined, score: 9, children: 5
anarchy79 2 points a month ago

I run linux off an 80s cassette. The flip side is Fleetwood Mac and Deep Purple.

(arch btw)

path: 0 25818460 25820330 25828726, hotness: undefined, score: 2, children: 1
Bluewing 1 point a month ago

(arch btw)

Well there's your problem. Can I interest you in TempleOS?

path: 0 25818460 25820330 25828726 25836206, hotness: undefined, score: 1, children: 0
Flower 2 points a month ago path: 0 25818460 25820330 25820550, hotness: undefined, score: 2, children: 2
Bluewing 2 points a month ago

That's funny. I have a pair of Converse tennis shoes that are 27 years older than that list......

path: 0 25818460 25820330 25820550 25821196, hotness: undefined, score: 2, children: 0
palordrolap 2 points a month ago

Class of '99 here.

There's at least a decade between the beginning of that list and people regularly using punch cards and tape. Maybe two.

Magnetic tapes and actually floppy floppy disks were the medium of choice in the interim.

path: 0 25818460 25820330 25820550 25826725, hotness: undefined, score: 2, children: 0
Axolotl_cpp 5 points a month ago

You could argue that a collection of punch cards is a file

path: 0 25818460 25819037, hotness: undefined, score: 5, children: 1
Flower 3 points a month ago

If you put them in a physical file and it gets jostled they go out of order and you have a problem. You want them in stacks.

I think technically it's only a file when it's managed by the system itself (reading, writing, modifying, storing) so punch cards are not files.

path: 0 25818460 25819037 25819038, hotness: undefined, score: 3, children: 0
vivalapivo 5 points a month ago

Epstein's?

path: 0 25815280, hotness: undefined, score: 5, children: 1
InternetCitizen2 2 points a month ago

Yeah, but in the BSD land as their licensing is more Libertarian esqu.

path: 0 25815280 25815504, hotness: undefined, score: 2, children: 0
anarchy79 5 points a month ago

Ok you got me with this one.

Btw the mitochondria are the powerhouse of the cell.

path: 0 25828681, hotness: undefined, score: 5, children: 0
zitrone 1 point a month ago

ok then how do i access [2b00:13c0:47:1422::5]:7236 through a file?

i don't think that's possible

only on plan9

path: 0 25839340, hotness: undefined, score: 1, children: 1
purplemonkeymad 5 points a month ago
echo hello >  /dev/tcp/2b00:13c0:47:1422::5/7236
path: 0 25839340 25840433, hotness: undefined, score: 5, children: 0
beejboytyson 1 point a month ago

But what about the fotoes?

path: 0 25823608, hotness: undefined, score: 1, children: 3
alectronic 2 points a month ago

I suspect sarcasm but in case it is not, photos are just binary files, just like videos and many other file formats.

path: 0 25823608 25823756, hotness: undefined, score: 2, children: 2
beejboytyson 2 points a month ago

Haha no my friend uses Linux and I haven't made the switch because I was under the impression that you have to be a command line wiz. Then he went on a rant about graphical interface.

path: 0 25823608 25823756 25826963, hotness: undefined, score: 2, children: 1
BartyDeCanter 1 point a month ago

Eh, there are distros where you will never need to touch a command line if you don't want to. In fact, most modern mainstream ones are that way: Mint, Fedora, Ubuntu, etc.

Though I don't understand the fear of the command line. My grandmother owned two computers in her life and both of them were command line only. She was not a researcher at a university, a professional programmer or anything like that, just a normal person with a high school education.

She just wasn't afraid to read the manual and try things. I still remember the spiral-bound manual with post-its covered in her nurses shorthand.

She used them to run the books for the family business, first an Apple ][, then a PC running DOS. She also used them to write letters and the church newsletter, practice Bridge, organize her family genealogy work, and things like that.

path: 0 25823608 25823756 25826963 25839233, hotness: undefined, score: 1, children: 0
linuxmemes
linuxmemes

@lemmy.world

login for more options
33062
2389
6292

Hint: :q!


Sister communities:

Community rules (click to expand)

1. Follow the site-wide rules
2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry of any kind will not be tolerated. This is an LGBTQ+-friendly community -- if that is a problem for you, you should leave.
3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • Don't come looking for advice, this is not the right community.
4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves / tolerates / hates> systemd, and wants to interject for a moment. You can stop now.
5. 🇬🇧 Language/язык/Sprache
  • This is primarily an English-speaking community. 🇬🇧🇦🇺🇺🇸
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
6. (NEW!) Regarding public figures

We all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.

  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.

 

Please report posts and comments that break these rules!


Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

go to feed...