4 ms·
> You know what is well designed? A stable facade that provides minimal overhead between two components, which prevents tight coupling. Like libc Actually, opp
by aforwardslash 3y ago
> You know what is well designed? A stable facade that provides minimal overhead between two components, which prevents tight coupling. Like libc
Actually, opposed to libc. Minimal overhead means either pass by register values or using call gates to copy stack frames. Libc just adds a new layer of cruft.
>Having a single path into and out of the system call interface provides a way in which userland protections -- such as syscall pinning, immutable pages, etc., can be added.
None of those are libc-specific, and can also be implemented using privileged kernel implementations. So, nothing new.
>How does language runtime library linkage matter? What is the real difference to a language whether it calls read() or the read syscall? Either way, it has to marshal arguments through a FFI.
The level of indirection. If there is no real difference, why not use the syscall directly? Why use yet another layer of crap to - in the end - perform a call by register?
> Languages must be ported to each operating system they run on.
One thing us the language,another is the runtime. The runtime should be as agnostic as possible, and that actually means using syscalls, not a given libc version.
> There is really no point to directly using syscalls. In nearly every case for unistd, socket, and fcntl, the libc wrapper is negligible. You can do all of the same thing.
You are right, they are almost the same thing. Thats one more motive to skip libc completely, because adds little to nothing no non-c languages.
> There are few, if any, enforced C-isms.
Such as struct (lack of) alignment, string formats and call conventions. Few, but relevant.
- nanolith 3y agoSo, your argument essentially boils down to "call it something other than libc". Because, most of the syscall integration in libc has little if anything to do with C. Eh. Whatever. Call it libunix if you prefer. If you want, you can literally strip libc of anything you don't like, call it libunix, and OpenBSD's ld.so mechanics will gladly pin syscalls to that.
- aforwardslash 3y agoMy argument boils down to "there are other views onto implementing userspace runtimes other than the libc view", and "general purpose operating systems should not demand everyone use their own language-specific userland runtime implementation just because its what their favourite language uses". You were the one trying to justify that layer as a de-facto ABI interface. For some things, it is not actually necessary and - in my opinion - should not be the target as a system ABI compatibility. Its a bit like saying "MSVC++ Runtime should be the de-facto runtime for every Windows application". There is a clear distinction between having a posix-compatible POSIX system (which targets source-code portability, focused mainly on C as the lowest common denominator) or a System V compatible system that provides POSIX compatibility. > Eh. Whatever. Call it libunix if you prefer. It is not not "whatever". A language-specific library should not - in principle - be a core dependency of every userland application on a general purpose UNIX system; A given language may implement its own runtime, as well as provide pure statically linked binaries. You may have a different opinion, but it seems a bit childish to discard the fact that not only there are use cases, but this has been somewhat of a problem in the past just because you don't agree with it. No one is stopping you from using libc.
- nanolith 3y agoYou want to impose your Linux-centric view of ossified syscall ABIs on the world. That's just not reality on any other operating system other than Linux, nor should it be. libc is the standard, but there is nothing that prevents you from hacking up libc to make some Frankenstein library that makes you feel better about "avoiding C" for whatever that's worth. Somehow, you think that libc is making your language runtime worse because it's written in C. Somehow, you think that writing an FFI -- as most high level languages do -- into libc is an inconvenience. It will probably blow your mind to realize that most operating systems, and thus most syscall interfaces, are also written in C. :-) Then you compare libc to the MSVC++ runtime for some odd reason. And yet, if you do write applications that target Windows, you use their system libraries, which are predominantly written in C and provide C functions, regardless of the high level language you choose. These libraries implement the interface to the kernel, much like most operating systems other than Linux.
- aforwardslash 3y ago> You want to impose your Linux-centric view of ossified syscall ABIs on the world. That's just not reality on any other operating system other than Linux, nor should it be. Actually, its not linux-centric, its System V-centric. And there is no ossification - at least not more than you have on what you're defending - a standard userland ABI runtime. I'm assuming you actually never used older systems - syscall/interrupt-based/call gate based is actually the "the facto standard", not whatever libc-based system you're running. I also find it amusing you keep talking about linux. Did Linus eat your homework or something? For me it is quite odd, specially considering I've been using OpenBSD since 2.9, FreeBSD since 4.3 and only somewhat recently use linux as a main unix-compatible environment. > libc is the standard Says you and nobody else. Case in point, the problem is with a runtime that IS NOT libc-based, and should be supported, because it is targeting a SPECIFIC OS VERSION and not a libc version. Btw, that's why OpenBSD has its support cycles measured in releases, and not libc versions, but I'm assuming you are completely aware of this. > Somehow, you think that writing an FFI -- as most high level languages do -- into libc is an inconvenience. It will probably blow your mind to realize that most operating systems, and thus most syscall interfaces, are also written in C. :-) Yes, we - the rational people that think a general-purpose operating system should not be dictating runtimes onto users - we are all stupid, and we never did any OS-related development. We also fail to realize that C is basically the lowest common denominator, that's why its used as a semi-stub language for machine-level stuff. We are very very stupid here in the land "we are not you". Is that it? > And yet, if you do write applications that target Windows, you use their system libraries, which are predominantly written in C and provide C functions, regardless of the high level language you choose Well, yes and no. Last time I checked, any 32 bit assembly application using int 21h is honored (haven't tested it on 64 bit), ~40 YEARS ON. Same goes for DPMI calls. That's the "syscall layer" for you. You may also be surprised to find out that Windows is actually a sort of hybrid microkernel (such as macos X family, btw), so you can actually provide a lot more "core functionality" as part of the base OS, such as audio mixing or graphics primitives. and you can use the "fancy approach" and use an available runtime (MSVC++ IS an example of a runtime similar to libc), or use your own. The last semi-monolithic version of it was Windows ME, and the lowest common denominator for operation is - you guessed it - system interrupts. Your console app developed in 1999 in Windows ME should run fine on a modern Windows version, as it will your OpenBSD console app, as long as you don't depend on libc. In fact, your 1983 MSDOS app should have no problem running in a fairly recent version of Windows without any kind of emulation whatsoever, except for the v86 wrapping mode. Oh and no, I'd say most windows core libraries are C++, not C. And even there, they're trying to get rid of it for - AT LEAST - 20 years - many internal services in Longhorn were C#. Things evolve, and the sooner we get rid of the C heritage, the better. > These libraries implement the interface to the kernel, much like most operating systems other than Linux. Your simplistic view of operating systems based on what OpenBSD is amuses me. As an example, feel free to ping me back when your userland kernel ABI actually implements useful stuff like a unified audio interface (or linux, since you mention it so much). Or volume management. Or actually unified printing experience. You know, all the stuff you actually get from microkernel or hybrid-based kernels that you DON'T have in monolithic kernel design. Have libc doing something that isn't either a runtime library for your specific language or a syscall and you may have a point. Until then, its actually quite more restrictive than using int-based syscalls. Note: edited for formatting