[TUHS] the true reason why c++ always wins

Alan Coopersmith via TUHS tuhs at tuhs.org
Fri May 29 09:01:01 AEST 2026


On 5/27/26 21:01, G. Branden Robinson via TUHS wrote:
> Better libraries.  Period.  Userspace programs generally shouldn't be
> making system calls directly.  Instead you should have a library that
> handles interfacing with the system for you.  A library API has more
> flexibility than the OS kernel, and (paradoxically) can _permit_ more
> flexibility in the system call interface by advertising "legacy" entry
> points for system calls that change their signatures or disappear.  (I
> propose that Unix's historical failure to provide any such thing is what
> prompted Linux Torvalds to proclaim his Iron Rule about not ever
> breaking userspace.[1]  With a library layer and a bit more type
> discipline than early C had, lseek(2) could have remained simply
> seek(2).  I think I've heard someone on this list observe that this is
> how Microsoft Windows (NT and its successors?) works.

This is also the Solaris model - both at Sun & Oracle, the binary compatibility
guarantee only applied at the library level.  Actual system calls are a private
implementation detail between libc & the kernel, and sometimes changed
between releases.  For instance, system calls like open, stat, chown, chmod,
etc. were removed by Roger Faulkner in Solaris 11, and the functions for them
in libc modified to call the openat, statat, etc. system calls instead:
https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/dtrace-guide/deleted-system-calls.html

Programs linked against a static copy of libc were expected to break
when moved to a different release, up until the static libc was removed
completely in Solaris 10 to end that problem.

This of course means that libc is the Solaris ABI and libraries for all
other languages have to go through libc instead of making system calls
directly from their implementations, and sometimes causes added work when
porting those languages to Solaris.

-- 
         -Alan Coopersmith-                 alan.coopersmith at oracle.com
          Oracle Solaris Engineering - https://blogs.oracle.com/solaris


More information about the TUHS mailing list