logoalt Hacker News

sph11/07/20244 repliesview on HN

Yes. Go for example doesn't use glibc and instead interfaces with syscalls directly.

https://pkg.go.dev/syscall


Replies

asveikau11/07/2024

Except there are some platforms where you need to go through libc and the direct syscall interface is considered private, or subject to change. OpenBSD is like this, and I believe Mac is too.

show 1 reply
boomskats11/07/2024

Worth mentioning that the golang.org/x/sys/unix package has better support for syscalls than the og syscall package nowadays, especially for some of the newer ones like cachestat[0] which was added to the kernel in 6.5. AFAIK the original syscall package was 'frozen' a while back to preserve backward compatibility, and at one point there was even a bit of drama[1] around it being marked as deprecated instead of frozen.

[0]: https://github.com/golang/go/issues/61917 [1]: https://github.com/golang/go/issues/60797

show 1 reply
josefx11/07/2024

Didn't they go back to Glibc in 2017 after a syscall silently corrupted several of their tightly packed tiny Go stacks? The page you link to seems to refer to a proposal from 2014 as "new".

show 3 replies
cyberpunk11/07/2024

I’m aware of this but I really don’t the benefits of this approach; It causes issues in eg openbsd where you can only call syscalls from libc, and it seems like they’re trying to outsmart the os developers and I just don’t see an advantage.

Is it faster? More stable?

show 4 replies