346
you are viewing a single comment's thread
view the rest of the comments
[-] TimeSquirrel@kbin.melroy.org 15 points 1 month ago

Programmatically, what does the kernel actually do with data sent to /dev/null? Put it in a temp buffer and just delete it?

[-] m_f@midwest.social 20 points 1 month ago

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;
}
[-] TimeSquirrel@kbin.melroy.org 16 points 1 month ago

So it's basically doing nothing and lying about it. ๐Ÿ˜†

[-] taldennz@lemmy.nz 17 points 1 month ago

"I accepted all of the bytes you gave me. I didn't do anything with them, but I accept you gave them to me".

[-] 0x4E4F@sh.itjust.works 4 points 1 month ago

Could've at least say thank you...

[-] taldennz@lemmy.nz 2 points 1 month ago

It's open source. If manners are an important feature to you perhaps look into contributing... :)

[-] 0x4E4F@sh.itjust.works 2 points 1 month ago

Yeah, that could actually be fun to be honest, lol ๐Ÿ˜‚. But I just know the PR would be rejected, lol ๐Ÿ˜‚.

[-] Flipper@feddit.org 17 points 1 month ago

The syscall to write passes a buffer and length. If it is Dev null the call just returns without doing anything more.

[-] Boxscape@lemmy.sdf.org 6 points 1 month ago* (last edited 1 month ago)

Programmatically, what does the kernel actually do with data sent to /dev/null?

I imagine it's like getting nullified in that olde show ReBoot.

this post was submitted on 21 Oct 2024
346 points (99.4% liked)

linuxmemes

21281 readers
190 users here now

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 members of the community for any reason.
  • 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 will not be tolerated.
  • These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
  • 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. Even if you watch it on a Linux machine.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.
  • ย 

    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 fork-bomb your computer.

    founded 1 year ago
    MODERATORS