Programmatically, what does the kernel actually do with data sent to /dev/null? Put it in a temp buffer and just delete it?
I was also curious, here’s a good answer:
https://unix.stackexchange.com/questions/670199/how-is-dev-null-implemented
The implementation is:
static ssize_t write_null(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { return count; }
So it’s basically doing nothing and lying about it. 😆
“I accepted all of the bytes you gave me. I didn’t do anything with them, but I accept you gave them to me”.
The query actually shows a lack of confidence. He should have googled “How to recover a file from /dev/null?” instead.
That hack Torvalds keeps denying my pull request to implement /dev/aether which would immediately begin overwriting the entire disk and all other mounted storage with the repeating content of whatever is moved there.
That is… brilliant! I love it!