What is it that makes an OS a POSIX system? All versions of Linux are POSIX, right? What about Mac OS X?
5 Answers
Is Mac OS X a POSIX OS?
Yes.
POSIX is a group of standards that determine a portable API for Unix-like operating systems. Mac OS X is Unix-based (and has been certified as such), and in accordance with this is POSIX compliant. POSIX guarantees that certain system calls will be available.
Essentially, Mac satisfies the API required to be POSIX compliant, which makes it a POSIX OS.
All versions of Linux are not POSIX-compliant. Kernel versions prior to 2.6 were not compliant, and today Linux isn't officially POSIX-compliant because they haven't gone out of their way to get certified (which will likely never happen). Regardless, Linux can be treated as a POSIX system for almost all intents and purposes.
-
1@z-buffer you can rely on certain system calls to be available, e.g.
stat()
,read()
, etc. Apr 26, 2011 at 3:18 -
4@z-buffer: "Is it because of Linux that POSIX was created?" No. First POSIX standard 1988. Mr. Torvalds begins developement of Linux, 1991. en.wikipedia.org/wiki/Posix#Name en.wikipedia.org/wiki/Linux#History. As I remember, POSIX grew out of need to write portable Unix apps across AT&T Unix, BSD Unix, etc. Apr 26, 2011 at 22:07
-
14Important related fact: Mac uses the BSD implementation of the POSIX utils, not the GNU one like Linux does. Feb 16, 2014 at 14:33
-
5Please note that OSX POSIX implementation is old, so newer POSIX software might not compile.– LtWorfSep 17, 2014 at 8:58
-
2@CiroSantilli巴拿馬文件六四事件法轮功 What are the differences between GNU and BSD utils? If I'm understanding correctly, POSIX states an OS must have certain utilities, and then the OS implements it. OSX uses BSD implementations and some linux distros use the GNU implementations? Are these utilities system calls, because I thought system calls were part of the kernel May 31, 2016 at 16:52
Yes, OS X is based on Darwin BSD, and since 10.5 (Leopard - 18-May-2007) all Intel/AMD versions have been officially certified as compliant with the Unix 03 / POSIX standard eg.
No, it is not. MacOS is missing a whole bunch of features of POSIX, like clock_nanosleep()
. It might be compliant with a subset of POSIX or with a really really old version of POSIX, but it's definitely not compliant with POSIX.1-2017. See http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_nanosleep.html.
-
I have also found a non-compliance bug in OS/X. Signals are supposed to be delivered to the first thread that either un-masks the signal or calls sigwait on the signal. In OS/X, when a signal is sent to a process and it was masked in all threads, the signal is effectively pre-assigned to one thread -- sigpending() shows it present in only one thread! (sigpending is supposed to show the same result in every thread). If the unassigned thread then un-masks, nothing happens. If sigwait is called by the unassigned thread, it succeeds, so it gets this one thing right. May 2, 2020 at 13:15
OSX POSIX
Single UNIX Specification(SUS)
. It is a set of standards to use UNIX
mark.
Portable Operating System Interface(POSIX)
- it is a subset of SUS
. It defines API between OS and application as long as others tools and utilities. It includes such parts as Process, IO, Threads, security, Shell
UNIX 03
is a Product Standard mark which conforms SUS v3
Latest Apple Inc UNIX products
MAC OS(since 10.5 Leopard) is a UNIX 03
compliant OS which is certified by The Open Group.
Linux
is a general name of a core for others operating system.
Linux is not POSIX-certified(except some of them like Huawei EulerOS - UNIX 03). But Linux is mostly POSIX-compliant because they try to stick to these standards and even more
POSIX is a specification: http://www.unix.org/what_is_unix/single_unix_specification.html AFAIK, Linux adheres to the spec, but hasn't certified yet
-
3There are some funny issues - for instance it is not enough for a program that tries to adhere to POSIX to merely specify
_POSIX_C_SOURCE
with a value of say200809L
to have the environment comply - I for one had trouble with the supposed GCC extension being therealpath
function, which is specified by POSIX - unless I also specified a non-standard_XOPEN_SOURCE
with a value of700
the program had issues compiling. Not a biggie (the presence of the latter flag is no showstop for POSIX, but it is far less portable), but definitely a nag. Seeman 2 realpath
. Nov 16, 2013 at 15:24