What is POSIX?
posted on Sep 18th, 2013
The Portable Operating System Interface (POSIX) is a collection of standards, maintained by IEEE to facilitate application portability between operating systems. This article only considers the POSIX.1-2008 standard.
Portability Does Means
- With minimal effort most executables can be used on other POSIX-OSes.
- With minimal effort most script files can be used on other POSIX-OSes.
- With minimal effort most C projects can compile on other POSIX-OSes.
Portability Doesn’t Mean
- An executable will “just work” when copied to another POSIX-OS.
- A data file will open correctly when copied to another POSIX-OS.
How Portability Works
POSIX promotes portability by defining three separate programming interfaces:
- Kernel C Headers
- Shell Languages
- Shell Utilities
The steps required to port will depend on which POSIX interfaces an application is using. A C program will likely just need to be recompiled, a script file may need its interpreter path updated, and shell utilities likely won’t require any changes since these will be executable applications already in the POSIX environment.
In many cases porting may require more than recompiling or updating an interpreter path. It isn’t uncommon for applications to have dependencies beyond POSIX. In such cases POSIX still helps by reducing the missing dependencies to one or two projects rather than fifteen.
One final note on the brief reference above to data file portability. The POSIX standard says nothing about the endianness of a computer’s processor. Therefore, it is entirely possible to have two POSIX compliant machines that can’t port anything without first performing a byte order conversion.