What exactly is POSIX?












129















I see POSIX mentioned often and everywhere, and I had assumed it to be the baseline UNIX standard.. until I noticed the following excerpt on a Wikipedia page: The Open Group




The Open Group is most famous as the
certifying body for the UNIX
trademark, and its publication of
the Single UNIX Specification
technical standard
, which extends
the POSIX standards and is the
official definition of a UNIX system
.




If the official definition of a UNIX system is an extension of POSIX, then what exactly is POSIX? ,,, It surely seems to be a touchstone of the UNIX world, but I don't know how it fits into the overall picture.










share|improve this question


















  • 2





    SUS is the official definition of UNIX since The Open Group, not the IEEE, owns the UNIX trademark. Se my answer below.

    – penguin359
    Apr 25 '11 at 21:32











  • unix.stackexchange.com/tags/posix/info

    – Premraj
    May 27 '15 at 4:22











  • stackoverflow.com/questions/1780599/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Aug 7 '15 at 22:19
















129















I see POSIX mentioned often and everywhere, and I had assumed it to be the baseline UNIX standard.. until I noticed the following excerpt on a Wikipedia page: The Open Group




The Open Group is most famous as the
certifying body for the UNIX
trademark, and its publication of
the Single UNIX Specification
technical standard
, which extends
the POSIX standards and is the
official definition of a UNIX system
.




If the official definition of a UNIX system is an extension of POSIX, then what exactly is POSIX? ,,, It surely seems to be a touchstone of the UNIX world, but I don't know how it fits into the overall picture.










share|improve this question


















  • 2





    SUS is the official definition of UNIX since The Open Group, not the IEEE, owns the UNIX trademark. Se my answer below.

    – penguin359
    Apr 25 '11 at 21:32











  • unix.stackexchange.com/tags/posix/info

    – Premraj
    May 27 '15 at 4:22











  • stackoverflow.com/questions/1780599/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Aug 7 '15 at 22:19














129












129








129


70






I see POSIX mentioned often and everywhere, and I had assumed it to be the baseline UNIX standard.. until I noticed the following excerpt on a Wikipedia page: The Open Group




The Open Group is most famous as the
certifying body for the UNIX
trademark, and its publication of
the Single UNIX Specification
technical standard
, which extends
the POSIX standards and is the
official definition of a UNIX system
.




If the official definition of a UNIX system is an extension of POSIX, then what exactly is POSIX? ,,, It surely seems to be a touchstone of the UNIX world, but I don't know how it fits into the overall picture.










share|improve this question














I see POSIX mentioned often and everywhere, and I had assumed it to be the baseline UNIX standard.. until I noticed the following excerpt on a Wikipedia page: The Open Group




The Open Group is most famous as the
certifying body for the UNIX
trademark, and its publication of
the Single UNIX Specification
technical standard
, which extends
the POSIX standards and is the
official definition of a UNIX system
.




If the official definition of a UNIX system is an extension of POSIX, then what exactly is POSIX? ,,, It surely seems to be a touchstone of the UNIX world, but I don't know how it fits into the overall picture.







posix standard






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 25 '11 at 17:41









Peter.OPeter.O

19k1791144




19k1791144








  • 2





    SUS is the official definition of UNIX since The Open Group, not the IEEE, owns the UNIX trademark. Se my answer below.

    – penguin359
    Apr 25 '11 at 21:32











  • unix.stackexchange.com/tags/posix/info

    – Premraj
    May 27 '15 at 4:22











  • stackoverflow.com/questions/1780599/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Aug 7 '15 at 22:19














  • 2





    SUS is the official definition of UNIX since The Open Group, not the IEEE, owns the UNIX trademark. Se my answer below.

    – penguin359
    Apr 25 '11 at 21:32











  • unix.stackexchange.com/tags/posix/info

    – Premraj
    May 27 '15 at 4:22











  • stackoverflow.com/questions/1780599/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Aug 7 '15 at 22:19








2




2





SUS is the official definition of UNIX since The Open Group, not the IEEE, owns the UNIX trademark. Se my answer below.

– penguin359
Apr 25 '11 at 21:32





SUS is the official definition of UNIX since The Open Group, not the IEEE, owns the UNIX trademark. Se my answer below.

– penguin359
Apr 25 '11 at 21:32













unix.stackexchange.com/tags/posix/info

– Premraj
May 27 '15 at 4:22





unix.stackexchange.com/tags/posix/info

– Premraj
May 27 '15 at 4:22













stackoverflow.com/questions/1780599/…

– Ciro Santilli 新疆改造中心 六四事件 法轮功
Aug 7 '15 at 22:19





stackoverflow.com/questions/1780599/…

– Ciro Santilli 新疆改造中心 六四事件 法轮功
Aug 7 '15 at 22:19










4 Answers
4






active

oldest

votes


















116














POSIX first was a standard in 1988 long before the Single UNIX Specification. It was one of the attempts at unifying all the various UNIX forks and UNIX-like systems. POSIX is an IEEE Standard, but as the IEEE does not own the UNIX® trademark, the standard is not UNIX® though it is based on the existing UNIX API at that time. The first standard POSIX.1 is formally known as IEEE std 1003.1-1988.[1] IEEE charged a substantial fee to obtain a copy of the standard.



The Open Group released the Single UNIX Specification (SUSv2) in 1997 based on IEEE's work of the POSIX standard. SUSv3 was released in 2001 from a joint working group between IEEE and The Open Group known as the Austin Group. SUSv3 is also known as POSIX:2001[2]. There is now also POSIX:2004 and POSIX:2008 which is the core of SUSv4. As for what UNIX® is, UNIX® is whatever the current registered trademark holder says it is. Since 1994, that is The Open Group.



Novell acquired the UNIX® systems business from AT&T/USL which is where UNIX® was born. In 1994, they sold the right to the UNIX® trademark to X/Open[3] now know as The Open Group. They then sold the UNIX® source code to SCO as UNIXWARE®.[3] UNIX® itself has forked many times[4][5] partly due to AT&T's licensing model. Purchasing UNIX® gave you the complete source of the operating system and the full tool-chain to build it. Modifications to the source can be distributed and used by anyone who owned a license to UNIX® from AT&T. The license fee was in the thousands.



BSD was a project at Berkeley which added a number of enhancements to the UNIX® operating system. BSD code was released under a much more liberal license than AT&T's source and did not require a license fee or even a requirement to be distributed with source, unlike the GPL that the GNU Project and Linux use. This has caused a good part of the BSD code to be included with various commercial UNIX forks. By around 4.3BSD, they had nearly replaced any need for the original AT&T UNIX® source code. FreeBSD/NetBSD/OpenBSD are all forks of 4.3BSD that are a complete operating system and have none of the original AT&T source code. Nor do they have right to the UNIX® trademark, but much of their code is used by commercial UNIX operating systems. The Socket API used on UNIX was developed on BSD and the Unix Fast Filesystem code was borrowed and used on various UNIX Operating Systems like Solaris with their own enhancements.



Linux was developed in 1991, but was developed from scratch unlike BSD and uses the existing GNU Project which is a clean-room implementation of much of the UNIX user-space. It implements much of POSIX for compatibility and is UNIX-like in design, but it does not have the close connection to AT&T or UNIX® that the BSDs have.






share|improve this answer





















  • 1





    A great answer.. all (3) answers have been good, but this one was hugely informative (especially after having been prepped by the other 2); just what I needed... and thanks for the comment (below the question body) about SUS, I understand it well enough now, thanks... (and I didn't notice it was only one paragraph...It was too interesting :)

    – Peter.O
    Apr 26 '11 at 1:26






  • 2





    @Mikel hopefully my edit helps a little

    – penguin359
    Apr 26 '11 at 4:36






  • 1





    That's a fantastic answer there @penguin359!

    – boehj
    Apr 28 '11 at 4:02











  • Does anyone have a good idea of what the X stands for? If it's just a suffix to indicate a relation to Unix, shouldn't it be lower case?

    – Alex W
    Aug 24 '15 at 18:07











  • Excellent. Thank you. I've been in computing for much of that history, but the "gossipy" details of how things happened were not something on which I focused. Good to see the trail.

    – Ken Ingram
    Nov 19 '18 at 22:30





















49














Most important things POSIX 7 defines





  1. C API



    Greatly extends ANSI C with things like:




    • more file operations: mkdir, dirname, symlink, readlink, link (hardlinks), poll(), stat, sync, nftw()

    • process and threads: fork, execl, pipe, semaphors sem_*, shared memory (shm_*), kill, scheduling parameters (nice, sched_*), sleep, mkfifo, setpgid()

    • networking: socket()

    • memory management: mmap, mlock, mprotect, madvise, brk()

    • utilities: regular expressions (reg*)


    Those APIs also determine underlying system concepts on which they depend, e.g. fork requires a concept of a process.



    Many Linux system calls exist to implement a specific POSIX C API function and make Linux compliant, e.g. sys_write, sys_read, ... Many of those syscalls also have Linux-specific extensions however.



    Major Linux desktop implementation: glibc, which in many cases just provides a shallow wrapper to system calls.




  2. CLI utilities



    E.g.: cd, ls, echo, ...



    Many utilities are direct shell front ends for a corresponding C API function, e.g. mkdir.



    Major Linux desktop implementation: GNU Coreutils for the small ones, separate GNU projects for the big ones: sed, grep, awk, ... Some CLI utilities are implemented by Bash as built-ins.




  3. Shell language



    E.g., a=b; echo "$a"



    Major Linux desktop implementation: GNU Bash.




  4. Environment variables



    E.g.: HOME, PATH.




  5. Program exit status



    ANSI C says 0 or EXIT_SUCCESS for success, EXIT_FAILURE for failure, and leaves the rest implementation defined.



    POSIX adds:




    • 126: command found but not executable.


    • 127: command not found.



    • > 128: terminated by a signal.



      But POSIX does not seem to specify the 128 + SIGNAL_ID rule used by Bash: Default exit code when process is terminated?






  6. Regular expression



    There are two types: BRE (Basic) and ERE (Extended). Basic is deprecated and only kept to not break APIs.



    Those are implemented by C API functions, and used throughout CLI utilities, e.g. grep accepts BREs by default, and EREs with -E.



    E.g.: echo 'a.1' | grep -E 'a.[[:digit:]]'



    Major Linux implementation: glibc implements the functions under regex.h which programs like grep can use as backend.




  7. Directory struture



    E.g.: /dev/null, /tmp



    The Linux FHS greatly extends POSIX.




  8. Filenames





    • / is the path separator


    • NUL cannot be used


    • . is cwd, .. parent

    • portable filenames


      • use at most max 14 chars and 256 for the full path

      • can only contain: a-zA-Z0-9._-




    See also: https://stackoverflow.com/questions/18550253/what-is-posix-compliance-for-filesystem




  9. Command line utility API conventions



    Not mandatory, used by POSIX, but almost nowhere else, notably not in GNU. But true, it is too restrictive, e.g. single letter flags only (e.g. -a), no double hyphen long versions (e.g. --all).



    A few widely used conventions:





    • - means stdin where a file is expected


    • -- terminates flags, e.g. ls -- -l to list a directory named -l


    See also: https://stackoverflow.com/questions/8957222/are-there-standards-for-linux-command-line-switches-and-arguments




Who conforms to POSIX?



Many systems follow POSIX closely, but few are actually certified by the Open Group which maintains the standard. Notable certified ones include:




  • OS X (Apple) X stands for both 10 and UNIX. Was the first Apple POSIX system, released circa 2001. See also: https://stackoverflow.com/questions/5785516/is-osx-a-posix-os

  • AIX (IBM)

  • HP-UX (HP)

  • Solaris (Oracle)


Most Linux distros are very compliant, but not certified because they don't want to pay the compliance check. Inspur's K-UX and Huawei's EulerOS are two certified examples.



The official list of certified systems be found at: https://www.opengroup.org/openbrand/register/ and also at the wiki page.



Windows



Windows implemented POSIX on some of its professional distributions.



Since it was an optional feature, programmers could not rely on it for most end user applications.



Support was deprecated in Windows 8:




  • https://stackoverflow.com/questions/4746043/where-does-microsoft-windows-7-posix-implementation-currently-stand

  • https://superuser.com/questions/495360/does-windows-8-still-implement-posix

  • Feature request: https://windows.uservoice.com/forums/265757-windows-feature-suggestions/suggestions/6573649-full-posix-support


In 2016 a new official Linux-like API called "Windows Subsystem for Linux" was announced. It includes Linux system calls, ELF running, parts of the /proc filesystem, Bash, GCC, (TODO likely glibc?), apt-get and more: https://channel9.msdn.com/Events/Build/2016/P488 so I believe that it will allow Windows to run much, if not all, of POSIX. However, it is focused on developers / deployment instead of end users. In particular, there were no plans to allow access to the Windows GUI.



Historical overview of the official Microsoft POSIX compatibility: http://brianreiter.org/2010/08/24/the-sad-history-of-the-microsoft-posix-subsystem/



Cygwin is a well known GPL third-party project for that "provides substantial POSIX API functionality" for Windows, but requires that you "rebuild your application from source if you want it to run on Windows". MSYS2 is a related project that seems to add more functionality on top of Cygwin.



Android



Android has its own C library (Bionic) which does not fully support POSIX as of Android O: https://stackoverflow.com/questions/27604455/is-android-posix-compatible



Bonus level



The Linux Standard Base further extends POSIX.



Use the non-frames indexes, they are much more readable and searchable: http://pubs.opengroup.org/onlinepubs/9699919799/nfindex.html



Get a full zipped version of the HTML pages for grepping: https://stackoverflow.com/questions/453993/is-there-a-listing-of-the-posix-api-functions/45832939#45832939






share|improve this answer


























  • The question was about POSIX and SUS, but this answer doesn't mention SUS at all...

    – Kidburla
    Oct 6 '17 at 12:16






  • 1





    @Kidburla a great opportunity to add your own answer and get some rep :-) (or edit it into mine and give me rep hehe)

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Oct 6 '17 at 12:27






  • 1





    There are actually Linux distros that are Unix-certified like K-UX and Huawei EulerOS. They appear in the POSIX certified list and also on Opengroup's website

    – phuclv
    Oct 21 '18 at 3:31











  • @phuclv thanks, I've added that to the answer.

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Oct 21 '18 at 6:30



















15














POSIX is the Portable Operating System standard. It describes certain utilities, APIs, and services a compliant operating system must provide to software (for example sockets, file I/O and threading) along with conventions on how these should be called from a program.



The idea is that a program written for one POSIX-Compliant OS would be easier to port to another POSIX-compliant OS than porting between non-POSIX-compliant OSes. This is why it is much easier to port an application from, say, FreeBSD to Linux than it is to port it from FreeBSD to Windows (though Windows ostensibly supports a subset of POSIX.)






share|improve this answer































    14














    POSIX is a subset of UNIX which is intended to cover various Unix-like environments for other operating systems; this originally included environments such as Eunice for VMS, Windows NT's POSIX personality, and Apollo Domain/OS. You can think of it as a standard portability API for the subset of operating system services whose behavior is in common between Unix and non-Unix. See http://standards.ieee.org/develop/wg/POSIX.html for more information.






    share|improve this answer
























    • I've read more about it now, and it certainly seems that Uinx was the chicken and POSIX was the egg.. but I do wonder if UNIX still rules the roost.. ie..Does POSIX have a life of its own now, and UNIX must comply to POSIX? ... btw. it seems the name POSIX was coinded by Richard Stallman ....

      – Peter.O
      Apr 25 '11 at 19:11













    • @fred.bear: Short answer: UNIX (the trade mark) must conform to POSIX; Unix (the product) was the main basis for POSIX; unices (the family of OSes) mostly conform but have more in common. See Is Linux a Unix? and Is Mac OS X, UNIX? for related discussions.

      – Gilles
      Apr 25 '11 at 20:34











    • @fred-bear Many people argue that the POSIX standard is nowadays guided by the Linux kernel development community, which (if true) IMHO is not a good thing...

      – sakisk
      Apr 26 '11 at 14:05






    • 1





      @faif I've never heard this and find it unlikely, can you post a reference?

      – penguin359
      Apr 28 '11 at 4:06






    • 2





      @Gilles The Open Group, owner of the UNIX® trademark is also in charge of the UNIX® certification and specification which they call Single UNIX Specification or SUS. POSIX is developed by the IEEE who are not in charge of UNIX®. Since 2001, they have been developed largely in sync, but it technically SUS which is now at version 4 that defined UNIX®.

      – penguin359
      Apr 28 '11 at 4:11











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f11983%2fwhat-exactly-is-posix%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    116














    POSIX first was a standard in 1988 long before the Single UNIX Specification. It was one of the attempts at unifying all the various UNIX forks and UNIX-like systems. POSIX is an IEEE Standard, but as the IEEE does not own the UNIX® trademark, the standard is not UNIX® though it is based on the existing UNIX API at that time. The first standard POSIX.1 is formally known as IEEE std 1003.1-1988.[1] IEEE charged a substantial fee to obtain a copy of the standard.



    The Open Group released the Single UNIX Specification (SUSv2) in 1997 based on IEEE's work of the POSIX standard. SUSv3 was released in 2001 from a joint working group between IEEE and The Open Group known as the Austin Group. SUSv3 is also known as POSIX:2001[2]. There is now also POSIX:2004 and POSIX:2008 which is the core of SUSv4. As for what UNIX® is, UNIX® is whatever the current registered trademark holder says it is. Since 1994, that is The Open Group.



    Novell acquired the UNIX® systems business from AT&T/USL which is where UNIX® was born. In 1994, they sold the right to the UNIX® trademark to X/Open[3] now know as The Open Group. They then sold the UNIX® source code to SCO as UNIXWARE®.[3] UNIX® itself has forked many times[4][5] partly due to AT&T's licensing model. Purchasing UNIX® gave you the complete source of the operating system and the full tool-chain to build it. Modifications to the source can be distributed and used by anyone who owned a license to UNIX® from AT&T. The license fee was in the thousands.



    BSD was a project at Berkeley which added a number of enhancements to the UNIX® operating system. BSD code was released under a much more liberal license than AT&T's source and did not require a license fee or even a requirement to be distributed with source, unlike the GPL that the GNU Project and Linux use. This has caused a good part of the BSD code to be included with various commercial UNIX forks. By around 4.3BSD, they had nearly replaced any need for the original AT&T UNIX® source code. FreeBSD/NetBSD/OpenBSD are all forks of 4.3BSD that are a complete operating system and have none of the original AT&T source code. Nor do they have right to the UNIX® trademark, but much of their code is used by commercial UNIX operating systems. The Socket API used on UNIX was developed on BSD and the Unix Fast Filesystem code was borrowed and used on various UNIX Operating Systems like Solaris with their own enhancements.



    Linux was developed in 1991, but was developed from scratch unlike BSD and uses the existing GNU Project which is a clean-room implementation of much of the UNIX user-space. It implements much of POSIX for compatibility and is UNIX-like in design, but it does not have the close connection to AT&T or UNIX® that the BSDs have.






    share|improve this answer





















    • 1





      A great answer.. all (3) answers have been good, but this one was hugely informative (especially after having been prepped by the other 2); just what I needed... and thanks for the comment (below the question body) about SUS, I understand it well enough now, thanks... (and I didn't notice it was only one paragraph...It was too interesting :)

      – Peter.O
      Apr 26 '11 at 1:26






    • 2





      @Mikel hopefully my edit helps a little

      – penguin359
      Apr 26 '11 at 4:36






    • 1





      That's a fantastic answer there @penguin359!

      – boehj
      Apr 28 '11 at 4:02











    • Does anyone have a good idea of what the X stands for? If it's just a suffix to indicate a relation to Unix, shouldn't it be lower case?

      – Alex W
      Aug 24 '15 at 18:07











    • Excellent. Thank you. I've been in computing for much of that history, but the "gossipy" details of how things happened were not something on which I focused. Good to see the trail.

      – Ken Ingram
      Nov 19 '18 at 22:30


















    116














    POSIX first was a standard in 1988 long before the Single UNIX Specification. It was one of the attempts at unifying all the various UNIX forks and UNIX-like systems. POSIX is an IEEE Standard, but as the IEEE does not own the UNIX® trademark, the standard is not UNIX® though it is based on the existing UNIX API at that time. The first standard POSIX.1 is formally known as IEEE std 1003.1-1988.[1] IEEE charged a substantial fee to obtain a copy of the standard.



    The Open Group released the Single UNIX Specification (SUSv2) in 1997 based on IEEE's work of the POSIX standard. SUSv3 was released in 2001 from a joint working group between IEEE and The Open Group known as the Austin Group. SUSv3 is also known as POSIX:2001[2]. There is now also POSIX:2004 and POSIX:2008 which is the core of SUSv4. As for what UNIX® is, UNIX® is whatever the current registered trademark holder says it is. Since 1994, that is The Open Group.



    Novell acquired the UNIX® systems business from AT&T/USL which is where UNIX® was born. In 1994, they sold the right to the UNIX® trademark to X/Open[3] now know as The Open Group. They then sold the UNIX® source code to SCO as UNIXWARE®.[3] UNIX® itself has forked many times[4][5] partly due to AT&T's licensing model. Purchasing UNIX® gave you the complete source of the operating system and the full tool-chain to build it. Modifications to the source can be distributed and used by anyone who owned a license to UNIX® from AT&T. The license fee was in the thousands.



    BSD was a project at Berkeley which added a number of enhancements to the UNIX® operating system. BSD code was released under a much more liberal license than AT&T's source and did not require a license fee or even a requirement to be distributed with source, unlike the GPL that the GNU Project and Linux use. This has caused a good part of the BSD code to be included with various commercial UNIX forks. By around 4.3BSD, they had nearly replaced any need for the original AT&T UNIX® source code. FreeBSD/NetBSD/OpenBSD are all forks of 4.3BSD that are a complete operating system and have none of the original AT&T source code. Nor do they have right to the UNIX® trademark, but much of their code is used by commercial UNIX operating systems. The Socket API used on UNIX was developed on BSD and the Unix Fast Filesystem code was borrowed and used on various UNIX Operating Systems like Solaris with their own enhancements.



    Linux was developed in 1991, but was developed from scratch unlike BSD and uses the existing GNU Project which is a clean-room implementation of much of the UNIX user-space. It implements much of POSIX for compatibility and is UNIX-like in design, but it does not have the close connection to AT&T or UNIX® that the BSDs have.






    share|improve this answer





















    • 1





      A great answer.. all (3) answers have been good, but this one was hugely informative (especially after having been prepped by the other 2); just what I needed... and thanks for the comment (below the question body) about SUS, I understand it well enough now, thanks... (and I didn't notice it was only one paragraph...It was too interesting :)

      – Peter.O
      Apr 26 '11 at 1:26






    • 2





      @Mikel hopefully my edit helps a little

      – penguin359
      Apr 26 '11 at 4:36






    • 1





      That's a fantastic answer there @penguin359!

      – boehj
      Apr 28 '11 at 4:02











    • Does anyone have a good idea of what the X stands for? If it's just a suffix to indicate a relation to Unix, shouldn't it be lower case?

      – Alex W
      Aug 24 '15 at 18:07











    • Excellent. Thank you. I've been in computing for much of that history, but the "gossipy" details of how things happened were not something on which I focused. Good to see the trail.

      – Ken Ingram
      Nov 19 '18 at 22:30
















    116












    116








    116







    POSIX first was a standard in 1988 long before the Single UNIX Specification. It was one of the attempts at unifying all the various UNIX forks and UNIX-like systems. POSIX is an IEEE Standard, but as the IEEE does not own the UNIX® trademark, the standard is not UNIX® though it is based on the existing UNIX API at that time. The first standard POSIX.1 is formally known as IEEE std 1003.1-1988.[1] IEEE charged a substantial fee to obtain a copy of the standard.



    The Open Group released the Single UNIX Specification (SUSv2) in 1997 based on IEEE's work of the POSIX standard. SUSv3 was released in 2001 from a joint working group between IEEE and The Open Group known as the Austin Group. SUSv3 is also known as POSIX:2001[2]. There is now also POSIX:2004 and POSIX:2008 which is the core of SUSv4. As for what UNIX® is, UNIX® is whatever the current registered trademark holder says it is. Since 1994, that is The Open Group.



    Novell acquired the UNIX® systems business from AT&T/USL which is where UNIX® was born. In 1994, they sold the right to the UNIX® trademark to X/Open[3] now know as The Open Group. They then sold the UNIX® source code to SCO as UNIXWARE®.[3] UNIX® itself has forked many times[4][5] partly due to AT&T's licensing model. Purchasing UNIX® gave you the complete source of the operating system and the full tool-chain to build it. Modifications to the source can be distributed and used by anyone who owned a license to UNIX® from AT&T. The license fee was in the thousands.



    BSD was a project at Berkeley which added a number of enhancements to the UNIX® operating system. BSD code was released under a much more liberal license than AT&T's source and did not require a license fee or even a requirement to be distributed with source, unlike the GPL that the GNU Project and Linux use. This has caused a good part of the BSD code to be included with various commercial UNIX forks. By around 4.3BSD, they had nearly replaced any need for the original AT&T UNIX® source code. FreeBSD/NetBSD/OpenBSD are all forks of 4.3BSD that are a complete operating system and have none of the original AT&T source code. Nor do they have right to the UNIX® trademark, but much of their code is used by commercial UNIX operating systems. The Socket API used on UNIX was developed on BSD and the Unix Fast Filesystem code was borrowed and used on various UNIX Operating Systems like Solaris with their own enhancements.



    Linux was developed in 1991, but was developed from scratch unlike BSD and uses the existing GNU Project which is a clean-room implementation of much of the UNIX user-space. It implements much of POSIX for compatibility and is UNIX-like in design, but it does not have the close connection to AT&T or UNIX® that the BSDs have.






    share|improve this answer















    POSIX first was a standard in 1988 long before the Single UNIX Specification. It was one of the attempts at unifying all the various UNIX forks and UNIX-like systems. POSIX is an IEEE Standard, but as the IEEE does not own the UNIX® trademark, the standard is not UNIX® though it is based on the existing UNIX API at that time. The first standard POSIX.1 is formally known as IEEE std 1003.1-1988.[1] IEEE charged a substantial fee to obtain a copy of the standard.



    The Open Group released the Single UNIX Specification (SUSv2) in 1997 based on IEEE's work of the POSIX standard. SUSv3 was released in 2001 from a joint working group between IEEE and The Open Group known as the Austin Group. SUSv3 is also known as POSIX:2001[2]. There is now also POSIX:2004 and POSIX:2008 which is the core of SUSv4. As for what UNIX® is, UNIX® is whatever the current registered trademark holder says it is. Since 1994, that is The Open Group.



    Novell acquired the UNIX® systems business from AT&T/USL which is where UNIX® was born. In 1994, they sold the right to the UNIX® trademark to X/Open[3] now know as The Open Group. They then sold the UNIX® source code to SCO as UNIXWARE®.[3] UNIX® itself has forked many times[4][5] partly due to AT&T's licensing model. Purchasing UNIX® gave you the complete source of the operating system and the full tool-chain to build it. Modifications to the source can be distributed and used by anyone who owned a license to UNIX® from AT&T. The license fee was in the thousands.



    BSD was a project at Berkeley which added a number of enhancements to the UNIX® operating system. BSD code was released under a much more liberal license than AT&T's source and did not require a license fee or even a requirement to be distributed with source, unlike the GPL that the GNU Project and Linux use. This has caused a good part of the BSD code to be included with various commercial UNIX forks. By around 4.3BSD, they had nearly replaced any need for the original AT&T UNIX® source code. FreeBSD/NetBSD/OpenBSD are all forks of 4.3BSD that are a complete operating system and have none of the original AT&T source code. Nor do they have right to the UNIX® trademark, but much of their code is used by commercial UNIX operating systems. The Socket API used on UNIX was developed on BSD and the Unix Fast Filesystem code was borrowed and used on various UNIX Operating Systems like Solaris with their own enhancements.



    Linux was developed in 1991, but was developed from scratch unlike BSD and uses the existing GNU Project which is a clean-room implementation of much of the UNIX user-space. It implements much of POSIX for compatibility and is UNIX-like in design, but it does not have the close connection to AT&T or UNIX® that the BSDs have.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 20 '15 at 21:08









    Faheem Mitha

    23k1881136




    23k1881136










    answered Apr 25 '11 at 21:27









    penguin359penguin359

    8,76423040




    8,76423040








    • 1





      A great answer.. all (3) answers have been good, but this one was hugely informative (especially after having been prepped by the other 2); just what I needed... and thanks for the comment (below the question body) about SUS, I understand it well enough now, thanks... (and I didn't notice it was only one paragraph...It was too interesting :)

      – Peter.O
      Apr 26 '11 at 1:26






    • 2





      @Mikel hopefully my edit helps a little

      – penguin359
      Apr 26 '11 at 4:36






    • 1





      That's a fantastic answer there @penguin359!

      – boehj
      Apr 28 '11 at 4:02











    • Does anyone have a good idea of what the X stands for? If it's just a suffix to indicate a relation to Unix, shouldn't it be lower case?

      – Alex W
      Aug 24 '15 at 18:07











    • Excellent. Thank you. I've been in computing for much of that history, but the "gossipy" details of how things happened were not something on which I focused. Good to see the trail.

      – Ken Ingram
      Nov 19 '18 at 22:30
















    • 1





      A great answer.. all (3) answers have been good, but this one was hugely informative (especially after having been prepped by the other 2); just what I needed... and thanks for the comment (below the question body) about SUS, I understand it well enough now, thanks... (and I didn't notice it was only one paragraph...It was too interesting :)

      – Peter.O
      Apr 26 '11 at 1:26






    • 2





      @Mikel hopefully my edit helps a little

      – penguin359
      Apr 26 '11 at 4:36






    • 1





      That's a fantastic answer there @penguin359!

      – boehj
      Apr 28 '11 at 4:02











    • Does anyone have a good idea of what the X stands for? If it's just a suffix to indicate a relation to Unix, shouldn't it be lower case?

      – Alex W
      Aug 24 '15 at 18:07











    • Excellent. Thank you. I've been in computing for much of that history, but the "gossipy" details of how things happened were not something on which I focused. Good to see the trail.

      – Ken Ingram
      Nov 19 '18 at 22:30










    1




    1





    A great answer.. all (3) answers have been good, but this one was hugely informative (especially after having been prepped by the other 2); just what I needed... and thanks for the comment (below the question body) about SUS, I understand it well enough now, thanks... (and I didn't notice it was only one paragraph...It was too interesting :)

    – Peter.O
    Apr 26 '11 at 1:26





    A great answer.. all (3) answers have been good, but this one was hugely informative (especially after having been prepped by the other 2); just what I needed... and thanks for the comment (below the question body) about SUS, I understand it well enough now, thanks... (and I didn't notice it was only one paragraph...It was too interesting :)

    – Peter.O
    Apr 26 '11 at 1:26




    2




    2





    @Mikel hopefully my edit helps a little

    – penguin359
    Apr 26 '11 at 4:36





    @Mikel hopefully my edit helps a little

    – penguin359
    Apr 26 '11 at 4:36




    1




    1





    That's a fantastic answer there @penguin359!

    – boehj
    Apr 28 '11 at 4:02





    That's a fantastic answer there @penguin359!

    – boehj
    Apr 28 '11 at 4:02













    Does anyone have a good idea of what the X stands for? If it's just a suffix to indicate a relation to Unix, shouldn't it be lower case?

    – Alex W
    Aug 24 '15 at 18:07





    Does anyone have a good idea of what the X stands for? If it's just a suffix to indicate a relation to Unix, shouldn't it be lower case?

    – Alex W
    Aug 24 '15 at 18:07













    Excellent. Thank you. I've been in computing for much of that history, but the "gossipy" details of how things happened were not something on which I focused. Good to see the trail.

    – Ken Ingram
    Nov 19 '18 at 22:30







    Excellent. Thank you. I've been in computing for much of that history, but the "gossipy" details of how things happened were not something on which I focused. Good to see the trail.

    – Ken Ingram
    Nov 19 '18 at 22:30















    49














    Most important things POSIX 7 defines





    1. C API



      Greatly extends ANSI C with things like:




      • more file operations: mkdir, dirname, symlink, readlink, link (hardlinks), poll(), stat, sync, nftw()

      • process and threads: fork, execl, pipe, semaphors sem_*, shared memory (shm_*), kill, scheduling parameters (nice, sched_*), sleep, mkfifo, setpgid()

      • networking: socket()

      • memory management: mmap, mlock, mprotect, madvise, brk()

      • utilities: regular expressions (reg*)


      Those APIs also determine underlying system concepts on which they depend, e.g. fork requires a concept of a process.



      Many Linux system calls exist to implement a specific POSIX C API function and make Linux compliant, e.g. sys_write, sys_read, ... Many of those syscalls also have Linux-specific extensions however.



      Major Linux desktop implementation: glibc, which in many cases just provides a shallow wrapper to system calls.




    2. CLI utilities



      E.g.: cd, ls, echo, ...



      Many utilities are direct shell front ends for a corresponding C API function, e.g. mkdir.



      Major Linux desktop implementation: GNU Coreutils for the small ones, separate GNU projects for the big ones: sed, grep, awk, ... Some CLI utilities are implemented by Bash as built-ins.




    3. Shell language



      E.g., a=b; echo "$a"



      Major Linux desktop implementation: GNU Bash.




    4. Environment variables



      E.g.: HOME, PATH.




    5. Program exit status



      ANSI C says 0 or EXIT_SUCCESS for success, EXIT_FAILURE for failure, and leaves the rest implementation defined.



      POSIX adds:




      • 126: command found but not executable.


      • 127: command not found.



      • > 128: terminated by a signal.



        But POSIX does not seem to specify the 128 + SIGNAL_ID rule used by Bash: Default exit code when process is terminated?






    6. Regular expression



      There are two types: BRE (Basic) and ERE (Extended). Basic is deprecated and only kept to not break APIs.



      Those are implemented by C API functions, and used throughout CLI utilities, e.g. grep accepts BREs by default, and EREs with -E.



      E.g.: echo 'a.1' | grep -E 'a.[[:digit:]]'



      Major Linux implementation: glibc implements the functions under regex.h which programs like grep can use as backend.




    7. Directory struture



      E.g.: /dev/null, /tmp



      The Linux FHS greatly extends POSIX.




    8. Filenames





      • / is the path separator


      • NUL cannot be used


      • . is cwd, .. parent

      • portable filenames


        • use at most max 14 chars and 256 for the full path

        • can only contain: a-zA-Z0-9._-




      See also: https://stackoverflow.com/questions/18550253/what-is-posix-compliance-for-filesystem




    9. Command line utility API conventions



      Not mandatory, used by POSIX, but almost nowhere else, notably not in GNU. But true, it is too restrictive, e.g. single letter flags only (e.g. -a), no double hyphen long versions (e.g. --all).



      A few widely used conventions:





      • - means stdin where a file is expected


      • -- terminates flags, e.g. ls -- -l to list a directory named -l


      See also: https://stackoverflow.com/questions/8957222/are-there-standards-for-linux-command-line-switches-and-arguments




    Who conforms to POSIX?



    Many systems follow POSIX closely, but few are actually certified by the Open Group which maintains the standard. Notable certified ones include:




    • OS X (Apple) X stands for both 10 and UNIX. Was the first Apple POSIX system, released circa 2001. See also: https://stackoverflow.com/questions/5785516/is-osx-a-posix-os

    • AIX (IBM)

    • HP-UX (HP)

    • Solaris (Oracle)


    Most Linux distros are very compliant, but not certified because they don't want to pay the compliance check. Inspur's K-UX and Huawei's EulerOS are two certified examples.



    The official list of certified systems be found at: https://www.opengroup.org/openbrand/register/ and also at the wiki page.



    Windows



    Windows implemented POSIX on some of its professional distributions.



    Since it was an optional feature, programmers could not rely on it for most end user applications.



    Support was deprecated in Windows 8:




    • https://stackoverflow.com/questions/4746043/where-does-microsoft-windows-7-posix-implementation-currently-stand

    • https://superuser.com/questions/495360/does-windows-8-still-implement-posix

    • Feature request: https://windows.uservoice.com/forums/265757-windows-feature-suggestions/suggestions/6573649-full-posix-support


    In 2016 a new official Linux-like API called "Windows Subsystem for Linux" was announced. It includes Linux system calls, ELF running, parts of the /proc filesystem, Bash, GCC, (TODO likely glibc?), apt-get and more: https://channel9.msdn.com/Events/Build/2016/P488 so I believe that it will allow Windows to run much, if not all, of POSIX. However, it is focused on developers / deployment instead of end users. In particular, there were no plans to allow access to the Windows GUI.



    Historical overview of the official Microsoft POSIX compatibility: http://brianreiter.org/2010/08/24/the-sad-history-of-the-microsoft-posix-subsystem/



    Cygwin is a well known GPL third-party project for that "provides substantial POSIX API functionality" for Windows, but requires that you "rebuild your application from source if you want it to run on Windows". MSYS2 is a related project that seems to add more functionality on top of Cygwin.



    Android



    Android has its own C library (Bionic) which does not fully support POSIX as of Android O: https://stackoverflow.com/questions/27604455/is-android-posix-compatible



    Bonus level



    The Linux Standard Base further extends POSIX.



    Use the non-frames indexes, they are much more readable and searchable: http://pubs.opengroup.org/onlinepubs/9699919799/nfindex.html



    Get a full zipped version of the HTML pages for grepping: https://stackoverflow.com/questions/453993/is-there-a-listing-of-the-posix-api-functions/45832939#45832939






    share|improve this answer


























    • The question was about POSIX and SUS, but this answer doesn't mention SUS at all...

      – Kidburla
      Oct 6 '17 at 12:16






    • 1





      @Kidburla a great opportunity to add your own answer and get some rep :-) (or edit it into mine and give me rep hehe)

      – Ciro Santilli 新疆改造中心 六四事件 法轮功
      Oct 6 '17 at 12:27






    • 1





      There are actually Linux distros that are Unix-certified like K-UX and Huawei EulerOS. They appear in the POSIX certified list and also on Opengroup's website

      – phuclv
      Oct 21 '18 at 3:31











    • @phuclv thanks, I've added that to the answer.

      – Ciro Santilli 新疆改造中心 六四事件 法轮功
      Oct 21 '18 at 6:30
















    49














    Most important things POSIX 7 defines





    1. C API



      Greatly extends ANSI C with things like:




      • more file operations: mkdir, dirname, symlink, readlink, link (hardlinks), poll(), stat, sync, nftw()

      • process and threads: fork, execl, pipe, semaphors sem_*, shared memory (shm_*), kill, scheduling parameters (nice, sched_*), sleep, mkfifo, setpgid()

      • networking: socket()

      • memory management: mmap, mlock, mprotect, madvise, brk()

      • utilities: regular expressions (reg*)


      Those APIs also determine underlying system concepts on which they depend, e.g. fork requires a concept of a process.



      Many Linux system calls exist to implement a specific POSIX C API function and make Linux compliant, e.g. sys_write, sys_read, ... Many of those syscalls also have Linux-specific extensions however.



      Major Linux desktop implementation: glibc, which in many cases just provides a shallow wrapper to system calls.




    2. CLI utilities



      E.g.: cd, ls, echo, ...



      Many utilities are direct shell front ends for a corresponding C API function, e.g. mkdir.



      Major Linux desktop implementation: GNU Coreutils for the small ones, separate GNU projects for the big ones: sed, grep, awk, ... Some CLI utilities are implemented by Bash as built-ins.




    3. Shell language



      E.g., a=b; echo "$a"



      Major Linux desktop implementation: GNU Bash.




    4. Environment variables



      E.g.: HOME, PATH.




    5. Program exit status



      ANSI C says 0 or EXIT_SUCCESS for success, EXIT_FAILURE for failure, and leaves the rest implementation defined.



      POSIX adds:




      • 126: command found but not executable.


      • 127: command not found.



      • > 128: terminated by a signal.



        But POSIX does not seem to specify the 128 + SIGNAL_ID rule used by Bash: Default exit code when process is terminated?






    6. Regular expression



      There are two types: BRE (Basic) and ERE (Extended). Basic is deprecated and only kept to not break APIs.



      Those are implemented by C API functions, and used throughout CLI utilities, e.g. grep accepts BREs by default, and EREs with -E.



      E.g.: echo 'a.1' | grep -E 'a.[[:digit:]]'



      Major Linux implementation: glibc implements the functions under regex.h which programs like grep can use as backend.




    7. Directory struture



      E.g.: /dev/null, /tmp



      The Linux FHS greatly extends POSIX.




    8. Filenames





      • / is the path separator


      • NUL cannot be used


      • . is cwd, .. parent

      • portable filenames


        • use at most max 14 chars and 256 for the full path

        • can only contain: a-zA-Z0-9._-




      See also: https://stackoverflow.com/questions/18550253/what-is-posix-compliance-for-filesystem




    9. Command line utility API conventions



      Not mandatory, used by POSIX, but almost nowhere else, notably not in GNU. But true, it is too restrictive, e.g. single letter flags only (e.g. -a), no double hyphen long versions (e.g. --all).



      A few widely used conventions:





      • - means stdin where a file is expected


      • -- terminates flags, e.g. ls -- -l to list a directory named -l


      See also: https://stackoverflow.com/questions/8957222/are-there-standards-for-linux-command-line-switches-and-arguments




    Who conforms to POSIX?



    Many systems follow POSIX closely, but few are actually certified by the Open Group which maintains the standard. Notable certified ones include:




    • OS X (Apple) X stands for both 10 and UNIX. Was the first Apple POSIX system, released circa 2001. See also: https://stackoverflow.com/questions/5785516/is-osx-a-posix-os

    • AIX (IBM)

    • HP-UX (HP)

    • Solaris (Oracle)


    Most Linux distros are very compliant, but not certified because they don't want to pay the compliance check. Inspur's K-UX and Huawei's EulerOS are two certified examples.



    The official list of certified systems be found at: https://www.opengroup.org/openbrand/register/ and also at the wiki page.



    Windows



    Windows implemented POSIX on some of its professional distributions.



    Since it was an optional feature, programmers could not rely on it for most end user applications.



    Support was deprecated in Windows 8:




    • https://stackoverflow.com/questions/4746043/where-does-microsoft-windows-7-posix-implementation-currently-stand

    • https://superuser.com/questions/495360/does-windows-8-still-implement-posix

    • Feature request: https://windows.uservoice.com/forums/265757-windows-feature-suggestions/suggestions/6573649-full-posix-support


    In 2016 a new official Linux-like API called "Windows Subsystem for Linux" was announced. It includes Linux system calls, ELF running, parts of the /proc filesystem, Bash, GCC, (TODO likely glibc?), apt-get and more: https://channel9.msdn.com/Events/Build/2016/P488 so I believe that it will allow Windows to run much, if not all, of POSIX. However, it is focused on developers / deployment instead of end users. In particular, there were no plans to allow access to the Windows GUI.



    Historical overview of the official Microsoft POSIX compatibility: http://brianreiter.org/2010/08/24/the-sad-history-of-the-microsoft-posix-subsystem/



    Cygwin is a well known GPL third-party project for that "provides substantial POSIX API functionality" for Windows, but requires that you "rebuild your application from source if you want it to run on Windows". MSYS2 is a related project that seems to add more functionality on top of Cygwin.



    Android



    Android has its own C library (Bionic) which does not fully support POSIX as of Android O: https://stackoverflow.com/questions/27604455/is-android-posix-compatible



    Bonus level



    The Linux Standard Base further extends POSIX.



    Use the non-frames indexes, they are much more readable and searchable: http://pubs.opengroup.org/onlinepubs/9699919799/nfindex.html



    Get a full zipped version of the HTML pages for grepping: https://stackoverflow.com/questions/453993/is-there-a-listing-of-the-posix-api-functions/45832939#45832939






    share|improve this answer


























    • The question was about POSIX and SUS, but this answer doesn't mention SUS at all...

      – Kidburla
      Oct 6 '17 at 12:16






    • 1





      @Kidburla a great opportunity to add your own answer and get some rep :-) (or edit it into mine and give me rep hehe)

      – Ciro Santilli 新疆改造中心 六四事件 法轮功
      Oct 6 '17 at 12:27






    • 1





      There are actually Linux distros that are Unix-certified like K-UX and Huawei EulerOS. They appear in the POSIX certified list and also on Opengroup's website

      – phuclv
      Oct 21 '18 at 3:31











    • @phuclv thanks, I've added that to the answer.

      – Ciro Santilli 新疆改造中心 六四事件 法轮功
      Oct 21 '18 at 6:30














    49












    49








    49







    Most important things POSIX 7 defines





    1. C API



      Greatly extends ANSI C with things like:




      • more file operations: mkdir, dirname, symlink, readlink, link (hardlinks), poll(), stat, sync, nftw()

      • process and threads: fork, execl, pipe, semaphors sem_*, shared memory (shm_*), kill, scheduling parameters (nice, sched_*), sleep, mkfifo, setpgid()

      • networking: socket()

      • memory management: mmap, mlock, mprotect, madvise, brk()

      • utilities: regular expressions (reg*)


      Those APIs also determine underlying system concepts on which they depend, e.g. fork requires a concept of a process.



      Many Linux system calls exist to implement a specific POSIX C API function and make Linux compliant, e.g. sys_write, sys_read, ... Many of those syscalls also have Linux-specific extensions however.



      Major Linux desktop implementation: glibc, which in many cases just provides a shallow wrapper to system calls.




    2. CLI utilities



      E.g.: cd, ls, echo, ...



      Many utilities are direct shell front ends for a corresponding C API function, e.g. mkdir.



      Major Linux desktop implementation: GNU Coreutils for the small ones, separate GNU projects for the big ones: sed, grep, awk, ... Some CLI utilities are implemented by Bash as built-ins.




    3. Shell language



      E.g., a=b; echo "$a"



      Major Linux desktop implementation: GNU Bash.




    4. Environment variables



      E.g.: HOME, PATH.




    5. Program exit status



      ANSI C says 0 or EXIT_SUCCESS for success, EXIT_FAILURE for failure, and leaves the rest implementation defined.



      POSIX adds:




      • 126: command found but not executable.


      • 127: command not found.



      • > 128: terminated by a signal.



        But POSIX does not seem to specify the 128 + SIGNAL_ID rule used by Bash: Default exit code when process is terminated?






    6. Regular expression



      There are two types: BRE (Basic) and ERE (Extended). Basic is deprecated and only kept to not break APIs.



      Those are implemented by C API functions, and used throughout CLI utilities, e.g. grep accepts BREs by default, and EREs with -E.



      E.g.: echo 'a.1' | grep -E 'a.[[:digit:]]'



      Major Linux implementation: glibc implements the functions under regex.h which programs like grep can use as backend.




    7. Directory struture



      E.g.: /dev/null, /tmp



      The Linux FHS greatly extends POSIX.




    8. Filenames





      • / is the path separator


      • NUL cannot be used


      • . is cwd, .. parent

      • portable filenames


        • use at most max 14 chars and 256 for the full path

        • can only contain: a-zA-Z0-9._-




      See also: https://stackoverflow.com/questions/18550253/what-is-posix-compliance-for-filesystem




    9. Command line utility API conventions



      Not mandatory, used by POSIX, but almost nowhere else, notably not in GNU. But true, it is too restrictive, e.g. single letter flags only (e.g. -a), no double hyphen long versions (e.g. --all).



      A few widely used conventions:





      • - means stdin where a file is expected


      • -- terminates flags, e.g. ls -- -l to list a directory named -l


      See also: https://stackoverflow.com/questions/8957222/are-there-standards-for-linux-command-line-switches-and-arguments




    Who conforms to POSIX?



    Many systems follow POSIX closely, but few are actually certified by the Open Group which maintains the standard. Notable certified ones include:




    • OS X (Apple) X stands for both 10 and UNIX. Was the first Apple POSIX system, released circa 2001. See also: https://stackoverflow.com/questions/5785516/is-osx-a-posix-os

    • AIX (IBM)

    • HP-UX (HP)

    • Solaris (Oracle)


    Most Linux distros are very compliant, but not certified because they don't want to pay the compliance check. Inspur's K-UX and Huawei's EulerOS are two certified examples.



    The official list of certified systems be found at: https://www.opengroup.org/openbrand/register/ and also at the wiki page.



    Windows



    Windows implemented POSIX on some of its professional distributions.



    Since it was an optional feature, programmers could not rely on it for most end user applications.



    Support was deprecated in Windows 8:




    • https://stackoverflow.com/questions/4746043/where-does-microsoft-windows-7-posix-implementation-currently-stand

    • https://superuser.com/questions/495360/does-windows-8-still-implement-posix

    • Feature request: https://windows.uservoice.com/forums/265757-windows-feature-suggestions/suggestions/6573649-full-posix-support


    In 2016 a new official Linux-like API called "Windows Subsystem for Linux" was announced. It includes Linux system calls, ELF running, parts of the /proc filesystem, Bash, GCC, (TODO likely glibc?), apt-get and more: https://channel9.msdn.com/Events/Build/2016/P488 so I believe that it will allow Windows to run much, if not all, of POSIX. However, it is focused on developers / deployment instead of end users. In particular, there were no plans to allow access to the Windows GUI.



    Historical overview of the official Microsoft POSIX compatibility: http://brianreiter.org/2010/08/24/the-sad-history-of-the-microsoft-posix-subsystem/



    Cygwin is a well known GPL third-party project for that "provides substantial POSIX API functionality" for Windows, but requires that you "rebuild your application from source if you want it to run on Windows". MSYS2 is a related project that seems to add more functionality on top of Cygwin.



    Android



    Android has its own C library (Bionic) which does not fully support POSIX as of Android O: https://stackoverflow.com/questions/27604455/is-android-posix-compatible



    Bonus level



    The Linux Standard Base further extends POSIX.



    Use the non-frames indexes, they are much more readable and searchable: http://pubs.opengroup.org/onlinepubs/9699919799/nfindex.html



    Get a full zipped version of the HTML pages for grepping: https://stackoverflow.com/questions/453993/is-there-a-listing-of-the-posix-api-functions/45832939#45832939






    share|improve this answer















    Most important things POSIX 7 defines





    1. C API



      Greatly extends ANSI C with things like:




      • more file operations: mkdir, dirname, symlink, readlink, link (hardlinks), poll(), stat, sync, nftw()

      • process and threads: fork, execl, pipe, semaphors sem_*, shared memory (shm_*), kill, scheduling parameters (nice, sched_*), sleep, mkfifo, setpgid()

      • networking: socket()

      • memory management: mmap, mlock, mprotect, madvise, brk()

      • utilities: regular expressions (reg*)


      Those APIs also determine underlying system concepts on which they depend, e.g. fork requires a concept of a process.



      Many Linux system calls exist to implement a specific POSIX C API function and make Linux compliant, e.g. sys_write, sys_read, ... Many of those syscalls also have Linux-specific extensions however.



      Major Linux desktop implementation: glibc, which in many cases just provides a shallow wrapper to system calls.




    2. CLI utilities



      E.g.: cd, ls, echo, ...



      Many utilities are direct shell front ends for a corresponding C API function, e.g. mkdir.



      Major Linux desktop implementation: GNU Coreutils for the small ones, separate GNU projects for the big ones: sed, grep, awk, ... Some CLI utilities are implemented by Bash as built-ins.




    3. Shell language



      E.g., a=b; echo "$a"



      Major Linux desktop implementation: GNU Bash.




    4. Environment variables



      E.g.: HOME, PATH.




    5. Program exit status



      ANSI C says 0 or EXIT_SUCCESS for success, EXIT_FAILURE for failure, and leaves the rest implementation defined.



      POSIX adds:




      • 126: command found but not executable.


      • 127: command not found.



      • > 128: terminated by a signal.



        But POSIX does not seem to specify the 128 + SIGNAL_ID rule used by Bash: Default exit code when process is terminated?






    6. Regular expression



      There are two types: BRE (Basic) and ERE (Extended). Basic is deprecated and only kept to not break APIs.



      Those are implemented by C API functions, and used throughout CLI utilities, e.g. grep accepts BREs by default, and EREs with -E.



      E.g.: echo 'a.1' | grep -E 'a.[[:digit:]]'



      Major Linux implementation: glibc implements the functions under regex.h which programs like grep can use as backend.




    7. Directory struture



      E.g.: /dev/null, /tmp



      The Linux FHS greatly extends POSIX.




    8. Filenames





      • / is the path separator


      • NUL cannot be used


      • . is cwd, .. parent

      • portable filenames


        • use at most max 14 chars and 256 for the full path

        • can only contain: a-zA-Z0-9._-




      See also: https://stackoverflow.com/questions/18550253/what-is-posix-compliance-for-filesystem




    9. Command line utility API conventions



      Not mandatory, used by POSIX, but almost nowhere else, notably not in GNU. But true, it is too restrictive, e.g. single letter flags only (e.g. -a), no double hyphen long versions (e.g. --all).



      A few widely used conventions:





      • - means stdin where a file is expected


      • -- terminates flags, e.g. ls -- -l to list a directory named -l


      See also: https://stackoverflow.com/questions/8957222/are-there-standards-for-linux-command-line-switches-and-arguments




    Who conforms to POSIX?



    Many systems follow POSIX closely, but few are actually certified by the Open Group which maintains the standard. Notable certified ones include:




    • OS X (Apple) X stands for both 10 and UNIX. Was the first Apple POSIX system, released circa 2001. See also: https://stackoverflow.com/questions/5785516/is-osx-a-posix-os

    • AIX (IBM)

    • HP-UX (HP)

    • Solaris (Oracle)


    Most Linux distros are very compliant, but not certified because they don't want to pay the compliance check. Inspur's K-UX and Huawei's EulerOS are two certified examples.



    The official list of certified systems be found at: https://www.opengroup.org/openbrand/register/ and also at the wiki page.



    Windows



    Windows implemented POSIX on some of its professional distributions.



    Since it was an optional feature, programmers could not rely on it for most end user applications.



    Support was deprecated in Windows 8:




    • https://stackoverflow.com/questions/4746043/where-does-microsoft-windows-7-posix-implementation-currently-stand

    • https://superuser.com/questions/495360/does-windows-8-still-implement-posix

    • Feature request: https://windows.uservoice.com/forums/265757-windows-feature-suggestions/suggestions/6573649-full-posix-support


    In 2016 a new official Linux-like API called "Windows Subsystem for Linux" was announced. It includes Linux system calls, ELF running, parts of the /proc filesystem, Bash, GCC, (TODO likely glibc?), apt-get and more: https://channel9.msdn.com/Events/Build/2016/P488 so I believe that it will allow Windows to run much, if not all, of POSIX. However, it is focused on developers / deployment instead of end users. In particular, there were no plans to allow access to the Windows GUI.



    Historical overview of the official Microsoft POSIX compatibility: http://brianreiter.org/2010/08/24/the-sad-history-of-the-microsoft-posix-subsystem/



    Cygwin is a well known GPL third-party project for that "provides substantial POSIX API functionality" for Windows, but requires that you "rebuild your application from source if you want it to run on Windows". MSYS2 is a related project that seems to add more functionality on top of Cygwin.



    Android



    Android has its own C library (Bionic) which does not fully support POSIX as of Android O: https://stackoverflow.com/questions/27604455/is-android-posix-compatible



    Bonus level



    The Linux Standard Base further extends POSIX.



    Use the non-frames indexes, they are much more readable and searchable: http://pubs.opengroup.org/onlinepubs/9699919799/nfindex.html



    Get a full zipped version of the HTML pages for grepping: https://stackoverflow.com/questions/453993/is-there-a-listing-of-the-posix-api-functions/45832939#45832939







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Feb 6 at 11:00

























    answered Aug 7 '15 at 22:12









    Ciro Santilli 新疆改造中心 六四事件 法轮功Ciro Santilli 新疆改造中心 六四事件 法轮功

    5,18024243




    5,18024243













    • The question was about POSIX and SUS, but this answer doesn't mention SUS at all...

      – Kidburla
      Oct 6 '17 at 12:16






    • 1





      @Kidburla a great opportunity to add your own answer and get some rep :-) (or edit it into mine and give me rep hehe)

      – Ciro Santilli 新疆改造中心 六四事件 法轮功
      Oct 6 '17 at 12:27






    • 1





      There are actually Linux distros that are Unix-certified like K-UX and Huawei EulerOS. They appear in the POSIX certified list and also on Opengroup's website

      – phuclv
      Oct 21 '18 at 3:31











    • @phuclv thanks, I've added that to the answer.

      – Ciro Santilli 新疆改造中心 六四事件 法轮功
      Oct 21 '18 at 6:30



















    • The question was about POSIX and SUS, but this answer doesn't mention SUS at all...

      – Kidburla
      Oct 6 '17 at 12:16






    • 1





      @Kidburla a great opportunity to add your own answer and get some rep :-) (or edit it into mine and give me rep hehe)

      – Ciro Santilli 新疆改造中心 六四事件 法轮功
      Oct 6 '17 at 12:27






    • 1





      There are actually Linux distros that are Unix-certified like K-UX and Huawei EulerOS. They appear in the POSIX certified list and also on Opengroup's website

      – phuclv
      Oct 21 '18 at 3:31











    • @phuclv thanks, I've added that to the answer.

      – Ciro Santilli 新疆改造中心 六四事件 法轮功
      Oct 21 '18 at 6:30

















    The question was about POSIX and SUS, but this answer doesn't mention SUS at all...

    – Kidburla
    Oct 6 '17 at 12:16





    The question was about POSIX and SUS, but this answer doesn't mention SUS at all...

    – Kidburla
    Oct 6 '17 at 12:16




    1




    1





    @Kidburla a great opportunity to add your own answer and get some rep :-) (or edit it into mine and give me rep hehe)

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Oct 6 '17 at 12:27





    @Kidburla a great opportunity to add your own answer and get some rep :-) (or edit it into mine and give me rep hehe)

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Oct 6 '17 at 12:27




    1




    1





    There are actually Linux distros that are Unix-certified like K-UX and Huawei EulerOS. They appear in the POSIX certified list and also on Opengroup's website

    – phuclv
    Oct 21 '18 at 3:31





    There are actually Linux distros that are Unix-certified like K-UX and Huawei EulerOS. They appear in the POSIX certified list and also on Opengroup's website

    – phuclv
    Oct 21 '18 at 3:31













    @phuclv thanks, I've added that to the answer.

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Oct 21 '18 at 6:30





    @phuclv thanks, I've added that to the answer.

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Oct 21 '18 at 6:30











    15














    POSIX is the Portable Operating System standard. It describes certain utilities, APIs, and services a compliant operating system must provide to software (for example sockets, file I/O and threading) along with conventions on how these should be called from a program.



    The idea is that a program written for one POSIX-Compliant OS would be easier to port to another POSIX-compliant OS than porting between non-POSIX-compliant OSes. This is why it is much easier to port an application from, say, FreeBSD to Linux than it is to port it from FreeBSD to Windows (though Windows ostensibly supports a subset of POSIX.)






    share|improve this answer




























      15














      POSIX is the Portable Operating System standard. It describes certain utilities, APIs, and services a compliant operating system must provide to software (for example sockets, file I/O and threading) along with conventions on how these should be called from a program.



      The idea is that a program written for one POSIX-Compliant OS would be easier to port to another POSIX-compliant OS than porting between non-POSIX-compliant OSes. This is why it is much easier to port an application from, say, FreeBSD to Linux than it is to port it from FreeBSD to Windows (though Windows ostensibly supports a subset of POSIX.)






      share|improve this answer


























        15












        15








        15







        POSIX is the Portable Operating System standard. It describes certain utilities, APIs, and services a compliant operating system must provide to software (for example sockets, file I/O and threading) along with conventions on how these should be called from a program.



        The idea is that a program written for one POSIX-Compliant OS would be easier to port to another POSIX-compliant OS than porting between non-POSIX-compliant OSes. This is why it is much easier to port an application from, say, FreeBSD to Linux than it is to port it from FreeBSD to Windows (though Windows ostensibly supports a subset of POSIX.)






        share|improve this answer













        POSIX is the Portable Operating System standard. It describes certain utilities, APIs, and services a compliant operating system must provide to software (for example sockets, file I/O and threading) along with conventions on how these should be called from a program.



        The idea is that a program written for one POSIX-Compliant OS would be easier to port to another POSIX-compliant OS than porting between non-POSIX-compliant OSes. This is why it is much easier to port an application from, say, FreeBSD to Linux than it is to port it from FreeBSD to Windows (though Windows ostensibly supports a subset of POSIX.)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 25 '11 at 18:03









        Andrew LambertAndrew Lambert

        1,82511116




        1,82511116























            14














            POSIX is a subset of UNIX which is intended to cover various Unix-like environments for other operating systems; this originally included environments such as Eunice for VMS, Windows NT's POSIX personality, and Apollo Domain/OS. You can think of it as a standard portability API for the subset of operating system services whose behavior is in common between Unix and non-Unix. See http://standards.ieee.org/develop/wg/POSIX.html for more information.






            share|improve this answer
























            • I've read more about it now, and it certainly seems that Uinx was the chicken and POSIX was the egg.. but I do wonder if UNIX still rules the roost.. ie..Does POSIX have a life of its own now, and UNIX must comply to POSIX? ... btw. it seems the name POSIX was coinded by Richard Stallman ....

              – Peter.O
              Apr 25 '11 at 19:11













            • @fred.bear: Short answer: UNIX (the trade mark) must conform to POSIX; Unix (the product) was the main basis for POSIX; unices (the family of OSes) mostly conform but have more in common. See Is Linux a Unix? and Is Mac OS X, UNIX? for related discussions.

              – Gilles
              Apr 25 '11 at 20:34











            • @fred-bear Many people argue that the POSIX standard is nowadays guided by the Linux kernel development community, which (if true) IMHO is not a good thing...

              – sakisk
              Apr 26 '11 at 14:05






            • 1





              @faif I've never heard this and find it unlikely, can you post a reference?

              – penguin359
              Apr 28 '11 at 4:06






            • 2





              @Gilles The Open Group, owner of the UNIX® trademark is also in charge of the UNIX® certification and specification which they call Single UNIX Specification or SUS. POSIX is developed by the IEEE who are not in charge of UNIX®. Since 2001, they have been developed largely in sync, but it technically SUS which is now at version 4 that defined UNIX®.

              – penguin359
              Apr 28 '11 at 4:11
















            14














            POSIX is a subset of UNIX which is intended to cover various Unix-like environments for other operating systems; this originally included environments such as Eunice for VMS, Windows NT's POSIX personality, and Apollo Domain/OS. You can think of it as a standard portability API for the subset of operating system services whose behavior is in common between Unix and non-Unix. See http://standards.ieee.org/develop/wg/POSIX.html for more information.






            share|improve this answer
























            • I've read more about it now, and it certainly seems that Uinx was the chicken and POSIX was the egg.. but I do wonder if UNIX still rules the roost.. ie..Does POSIX have a life of its own now, and UNIX must comply to POSIX? ... btw. it seems the name POSIX was coinded by Richard Stallman ....

              – Peter.O
              Apr 25 '11 at 19:11













            • @fred.bear: Short answer: UNIX (the trade mark) must conform to POSIX; Unix (the product) was the main basis for POSIX; unices (the family of OSes) mostly conform but have more in common. See Is Linux a Unix? and Is Mac OS X, UNIX? for related discussions.

              – Gilles
              Apr 25 '11 at 20:34











            • @fred-bear Many people argue that the POSIX standard is nowadays guided by the Linux kernel development community, which (if true) IMHO is not a good thing...

              – sakisk
              Apr 26 '11 at 14:05






            • 1





              @faif I've never heard this and find it unlikely, can you post a reference?

              – penguin359
              Apr 28 '11 at 4:06






            • 2





              @Gilles The Open Group, owner of the UNIX® trademark is also in charge of the UNIX® certification and specification which they call Single UNIX Specification or SUS. POSIX is developed by the IEEE who are not in charge of UNIX®. Since 2001, they have been developed largely in sync, but it technically SUS which is now at version 4 that defined UNIX®.

              – penguin359
              Apr 28 '11 at 4:11














            14












            14








            14







            POSIX is a subset of UNIX which is intended to cover various Unix-like environments for other operating systems; this originally included environments such as Eunice for VMS, Windows NT's POSIX personality, and Apollo Domain/OS. You can think of it as a standard portability API for the subset of operating system services whose behavior is in common between Unix and non-Unix. See http://standards.ieee.org/develop/wg/POSIX.html for more information.






            share|improve this answer













            POSIX is a subset of UNIX which is intended to cover various Unix-like environments for other operating systems; this originally included environments such as Eunice for VMS, Windows NT's POSIX personality, and Apollo Domain/OS. You can think of it as a standard portability API for the subset of operating system services whose behavior is in common between Unix and non-Unix. See http://standards.ieee.org/develop/wg/POSIX.html for more information.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Apr 25 '11 at 17:59









            geekosaurgeekosaur

            22.6k25853




            22.6k25853













            • I've read more about it now, and it certainly seems that Uinx was the chicken and POSIX was the egg.. but I do wonder if UNIX still rules the roost.. ie..Does POSIX have a life of its own now, and UNIX must comply to POSIX? ... btw. it seems the name POSIX was coinded by Richard Stallman ....

              – Peter.O
              Apr 25 '11 at 19:11













            • @fred.bear: Short answer: UNIX (the trade mark) must conform to POSIX; Unix (the product) was the main basis for POSIX; unices (the family of OSes) mostly conform but have more in common. See Is Linux a Unix? and Is Mac OS X, UNIX? for related discussions.

              – Gilles
              Apr 25 '11 at 20:34











            • @fred-bear Many people argue that the POSIX standard is nowadays guided by the Linux kernel development community, which (if true) IMHO is not a good thing...

              – sakisk
              Apr 26 '11 at 14:05






            • 1





              @faif I've never heard this and find it unlikely, can you post a reference?

              – penguin359
              Apr 28 '11 at 4:06






            • 2





              @Gilles The Open Group, owner of the UNIX® trademark is also in charge of the UNIX® certification and specification which they call Single UNIX Specification or SUS. POSIX is developed by the IEEE who are not in charge of UNIX®. Since 2001, they have been developed largely in sync, but it technically SUS which is now at version 4 that defined UNIX®.

              – penguin359
              Apr 28 '11 at 4:11



















            • I've read more about it now, and it certainly seems that Uinx was the chicken and POSIX was the egg.. but I do wonder if UNIX still rules the roost.. ie..Does POSIX have a life of its own now, and UNIX must comply to POSIX? ... btw. it seems the name POSIX was coinded by Richard Stallman ....

              – Peter.O
              Apr 25 '11 at 19:11













            • @fred.bear: Short answer: UNIX (the trade mark) must conform to POSIX; Unix (the product) was the main basis for POSIX; unices (the family of OSes) mostly conform but have more in common. See Is Linux a Unix? and Is Mac OS X, UNIX? for related discussions.

              – Gilles
              Apr 25 '11 at 20:34











            • @fred-bear Many people argue that the POSIX standard is nowadays guided by the Linux kernel development community, which (if true) IMHO is not a good thing...

              – sakisk
              Apr 26 '11 at 14:05






            • 1





              @faif I've never heard this and find it unlikely, can you post a reference?

              – penguin359
              Apr 28 '11 at 4:06






            • 2





              @Gilles The Open Group, owner of the UNIX® trademark is also in charge of the UNIX® certification and specification which they call Single UNIX Specification or SUS. POSIX is developed by the IEEE who are not in charge of UNIX®. Since 2001, they have been developed largely in sync, but it technically SUS which is now at version 4 that defined UNIX®.

              – penguin359
              Apr 28 '11 at 4:11

















            I've read more about it now, and it certainly seems that Uinx was the chicken and POSIX was the egg.. but I do wonder if UNIX still rules the roost.. ie..Does POSIX have a life of its own now, and UNIX must comply to POSIX? ... btw. it seems the name POSIX was coinded by Richard Stallman ....

            – Peter.O
            Apr 25 '11 at 19:11







            I've read more about it now, and it certainly seems that Uinx was the chicken and POSIX was the egg.. but I do wonder if UNIX still rules the roost.. ie..Does POSIX have a life of its own now, and UNIX must comply to POSIX? ... btw. it seems the name POSIX was coinded by Richard Stallman ....

            – Peter.O
            Apr 25 '11 at 19:11















            @fred.bear: Short answer: UNIX (the trade mark) must conform to POSIX; Unix (the product) was the main basis for POSIX; unices (the family of OSes) mostly conform but have more in common. See Is Linux a Unix? and Is Mac OS X, UNIX? for related discussions.

            – Gilles
            Apr 25 '11 at 20:34





            @fred.bear: Short answer: UNIX (the trade mark) must conform to POSIX; Unix (the product) was the main basis for POSIX; unices (the family of OSes) mostly conform but have more in common. See Is Linux a Unix? and Is Mac OS X, UNIX? for related discussions.

            – Gilles
            Apr 25 '11 at 20:34













            @fred-bear Many people argue that the POSIX standard is nowadays guided by the Linux kernel development community, which (if true) IMHO is not a good thing...

            – sakisk
            Apr 26 '11 at 14:05





            @fred-bear Many people argue that the POSIX standard is nowadays guided by the Linux kernel development community, which (if true) IMHO is not a good thing...

            – sakisk
            Apr 26 '11 at 14:05




            1




            1





            @faif I've never heard this and find it unlikely, can you post a reference?

            – penguin359
            Apr 28 '11 at 4:06





            @faif I've never heard this and find it unlikely, can you post a reference?

            – penguin359
            Apr 28 '11 at 4:06




            2




            2





            @Gilles The Open Group, owner of the UNIX® trademark is also in charge of the UNIX® certification and specification which they call Single UNIX Specification or SUS. POSIX is developed by the IEEE who are not in charge of UNIX®. Since 2001, they have been developed largely in sync, but it technically SUS which is now at version 4 that defined UNIX®.

            – penguin359
            Apr 28 '11 at 4:11





            @Gilles The Open Group, owner of the UNIX® trademark is also in charge of the UNIX® certification and specification which they call Single UNIX Specification or SUS. POSIX is developed by the IEEE who are not in charge of UNIX®. Since 2001, they have been developed largely in sync, but it technically SUS which is now at version 4 that defined UNIX®.

            – penguin359
            Apr 28 '11 at 4:11


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f11983%2fwhat-exactly-is-posix%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            19世紀