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;
}
You’re in good company. Steam even managed to do it for a whole bunch of people:
https://github.com/ValveSoftware/steam-for-linux/issues/3671