logoalt Hacker News

favorited11/08/20242 repliesview on HN

> Linux could have made their own libc

That's not what Linux is, though. It's a kernel. libc is a userspace library. The Linux developers could also make their own libpng and put their stable interface in there, but that's not in scope for their project.

> As a result of that brilliant design choice, every single language can make Linux system calls natively.

That is like saying it's a brilliant design choice for an artist to paint the sky blue on a sunny day. If Linux is a kernel, and if a kernel's interface with userspace is syscalls, and if Linux wants to avoid breaking userspace with kernel updates, then it needs a stable syscall interface.

> No need to pull in some huge C library just for this.

Again, I'm not sure why the Linux project would invent this "huge C library" to use as their stable kernel interface.


Replies

matheusmoreira11/08/2024

They could but they didn't. At some point, Linux almost got its own klibc. The developers realized such a thing wasn't needed in the kernel. Greg Kroah-Hartman told me about it when I asked on his AMA:

https://old.reddit.com/r/linux/comments/fx5e4v/im_greg_kroah...

The importance of this design should not be understated. It's not really an obvious thing to realize. If it was, every other operating system and kernel out there would be doing it as well. They aren't. They all make people link against some library.

So Linux is actually pretty special. It's the only system where you actually can trash the entire userspace and rewrite the world in Rust. Don't need to link against any "core" system libraries. People usually do but it's not forced upon them.

> if Linux wants to avoid breaking userspace with kernel updates, then it needs a stable syscall interface

Every kernel and operating system wants to maximize backwards compatibility and minimize user space breakage. Most of them simply stabilize the system libraries instead. The core libraries are stable, the kernel interfaces used by those core libraries are not.

So it doesn't follow that it needs a stable syscall interface. They could have solved it via user space impositions. The fact they chose a better solution is one of many things that makes Linux special.

show 1 reply
garaetjjte11/08/2024

I mean they could stuff kernel libc into vDSO.