Hacker News new | past | comments | ask | show | jobs | submit login

The internal details of libc are not leaking in the case under discussion.

libc wraps system calls. If you use libc and try to make your own system calls, you're going to collide with internal details of libc.

Not using libc is fine. Not making your own system calls via asm is fine. Pick one.




If the policy of the OS is to for programmers to only use libc for syscalls, perhaps that's a valid caveat to asm syscalls, but I don't think Linux is such an OS.


> I don't think Linux is such an OS.

It's not! I wrote somewhat at length about that very question in this article:

https://www.matheusmoreira.com/articles/linux-system-calls


It's not the policy of the OS.

It's the policy of (some/most/all) libc implementations. Don't like it? Find a different libc or do without libc.


It absolutely is a policy of the OS and whoever is in charge of it. Nearly all of them provide their own libraries and decree that the only supported way to interface with the system is via those libraries. So you cannot "find a different libc or do without libc" on the vast majority of operating systems out there. You literally cannot get away from the OS libraries. If you try, your software inevitably breaks when they change system call numbers and semantics. Golang found out the hard way. Here's an awesome quotation from a BSD guy:

> I have altered the ABI. Pray I do not alter it any further.

Linux is actually the odd one. It's the only one with a stable language-agnostic system call ABI. It's stable because breaking the ABI makes Linus Torvalds send out extremely angry emails to the people involved until they fix it. Because of this stability, you actually can have alternative libc implementations like musl and you can also rewrite literally everything in Rust or Lisp if you want. Only on Linux can you do this.

For some reason people try extra hard to make it look like glibc is some integral part of the kernel. Diagrams on Wikipedia showing glibc enveloping the kernel like it's some outer component. Look up Linux manuals and you somehow get glibc manuals instead. The truth is they're completely independent projects. The GNU developers have zero power to force anyone to use glibc on Linux. You can make a freestanding application using system calls directly and literally boot Linux into it. I have made it my goal to create an entire programming language and ecosystem centered around that exact concept.


You are using the term "OS" to mean something other than "kernel", which is the meaning required by this thread (and arguably entire topic) thus far.

This is demonstrated by the rest of your comment, in which you note that linux has a stable, language agnostic system call ABI, and that other libc implementations exist.

TFA was ONLY about Linux syscalls, so what other platforms do or do not is irrelevant in context.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: