
Theoretical physicists: Actually... - sh.itjust.works
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:
unix.stackexchange.com/…/how-is-dev-null-implemen…
The implementation is:
static ssize_t write_null(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
return count;
}

How is /dev/null implemented?
I don't understand what happens when a process writes to this special file. What happens to all the bytes? And why is writing to /dev/null not cpu-intensive? If you can answer in terms of reference...
Unix & Linux Stack ExchangeSo 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”.
Could’ve at least say thank you…
It’s open source. If manners are an important feature to you perhaps look into contributing… :)
Yeah, that could actually be fun to be honest, lol 😂. But I just know the PR would be rejected, lol 😂.