News for hackers. Stuff that matters.
Re:OS X BSD System Calls Reference by AdieuToLogic on Wednesday July 08, 2015 @02:18AM (#9850083)
> I heard from somewhere that technically, OS X does not preserve backward compatibility for system calls, so you should use libc function's instead, otherwise it is an undefined behavior.

I believe this article[1] definitively answers this as being the case.

> Whereas Linux keeps a hard compatibility guarantee.

Not being a troll here... Why would anyone care unless they are writing a libc replacement? Before anyone objects regarding compatibility with programs written for older versions of OS-X, there have been compatibility libraries distributed for every version I can recall. To wit, I run the Pages app from iWork '09 regularly.

1 - https://developer.apple.com/library/mac/qa/qa1118/_index.htm...

Re:OS X BSD System Calls Reference by kentonv on Wednesday July 08, 2015 @04:39AM (#9850481)
> Why would anyone care unless they are writing a libc replacement?

- So that you can feel safe upgrading your kernel without upgrading your whole userspace. (Linus harps on this one a lot.)

- So that there can be multiple competing libc's. Linux is used in a lot of diverse environments, and the tradeoffs made by glibc (in terms of bloat, license, etc.) are not necessarily the best for everyone. Android does not use glibc, for example.

- So that you can isolate apps from each other using containers (hermetic chroot environments), where different containers may have entirely different libc. Docker (and my own Sandstorm.io) relies very heavily on Linux's syscall ABI compatibility promises.

- Because the syscall ABI is frankly a much clearer boundary than the libc ABI, and arguably easier to keep backwards-compatible. An app literally _can't_ break this boundary and access the private interfaces beneath (assuming a secure implementation, lol).

Re:OS X BSD System Calls Reference by creshal on Wednesday July 08, 2015 @02:41AM (#9850140)
> Not being a troll here... Why would anyone care unless they are writing a libc replacement?

Statically compiling the libc is common with proprietary Linux software, if I remember correctly.

Re:OS X BSD System Calls Reference by AdieuToLogic on Wednesday July 08, 2015 @03:14AM (#9850238)
Gotcha. I guess it's an OS expectation thing then. In OS-X, it's pretty much an assumption that dynamic linking is what's going to happen (good or bad).

Thanks for clarifying this point for me.

Re:OS X BSD System Calls Reference by creshal on Wednesday July 08, 2015 @04:05AM (#9850376)
Linux userland has various libcs available (klibc, glibc, eglibc, uclibc, dietlibc, musl, …), with distributions occasionally switching between them, and ABI-incompatible changes happen every once in a while. Source-distributed software does not have to care usually, but for binary-only distribution, statically compiling the libc is the easiest bet. Thus, the kernel has to maintain compatibility.
Re:OS X BSD System Calls Reference by justincormack on Wednesday July 08, 2015 @03:46AM (#9850320)
More than that, static linking is very difficult indeed as there is not even a crt for static linking let alone libc.a, you would have to write your own.
Re:OS X BSD System Calls Reference by zurn on Wednesday July 08, 2015 @08:38AM (#9851125)
> Not being a troll here... Why would anyone care unless they are writing a libc replacement?

Linux doesn't have any single fixed libc, the system call interface is the public API. Indeed there are many different libc's used in different linux applications - glibc on many desktop distros, bionic libc on android, uclibc, musl and others on various embedded/specialized setups.