zlacker

[return to "OpenBSD: Removing syscall(2) from libc and kernel"]
1. kstrau+ks[view] [source] 2023-10-27 17:34:50
>>eclipt+(OP)
I don't know a lot about this corner of the OS. Why are syscalls in libc, instead of something like a libsyscall? I could see why a language might want not to depend on what's at least notionally the C runtime. Is the fact that the kernel interface is in libc an accident of Unix being written in C, or is there something more fundamental there?
◧◩
2. monoca+Gs[view] [source] 2023-10-27 17:36:35
>>kstrau+ks
It's that libc is considered the stable interface for userland in general on openbsd.
◧◩◪
3. maskli+kt[view] [source] 2023-10-27 17:39:20
>>monoca+Gs
In pretty much every OS of the unix tradition. libc is the API, with a stable ABI. Although Windows has a something pretty much identical in — I believe — ntdll. The name and API differ, but the intent is the same.
◧◩◪◨
4. MarekK+Oy[view] [source] 2023-10-27 18:05:54
>>maskli+kt
No, Windows has stable API and ABI named Win32 API. This comes from times of 16bit Windows and works also in x64 / ARM / ARM64, previously it worked in Alpha / MIPS / IA64. This API is implemented in kernel.dll user.dll gdi.dll advapi.dll and similar, it does some stuff, but mostly forwards to the NT API. Beware, kernel.dll is user space component despite its name (historical reasons). NT API is undocumented and not meant to be used by user programs, it is not stable, it lives in ntdll.dll, it does syscalls to the kernel: ntoskrnl.exe. Windows doesn't have a libc (for user programs, it has private one for its own programs), Visual Studio has a libc. Each version of Visual Studio (roughly) has its own libc named msvcrt.dll msvrt100.dll msvcrt140.dll and similar, it hosts the C and C++ libc, it could be linked statically for various benefits and drawbacks.
◧◩◪◨⬒
5. monoca+rB[view] [source] 2023-10-27 18:20:26
>>MarekK+Oy
FWIW, large swaths of ntdll are documented and supported these days, for performing work that can't be expressed via the win32 API like raw disk manipulation.
[go to top]