Science and technology

What is POSIX? Richard Stallman explains

What is POSIX, and why does it matter? It’s a time period you have seemingly seen in technical writing, nevertheless it typically will get misplaced in a sea of techno-initialisms and jargon-that-ends-in-X. I emailed Dr. Richard Stallman (higher recognized in hacker circles as RMS) to seek out out extra in regards to the time period’s origin and the idea behind it.

Richard Stallman says “open” and “closed” are the incorrect technique to classify software program. Stallman classifies packages as freedom-respecting (“free” or “libre”) and freedom-trampling (“non-free” or “proprietary”). Open supply discourse sometimes encourages sure practices for the sake of sensible benefits, not as an ethical crucial.

The free software program motion, which Stallman launched in 1984, says greater than benefits are at stake. Users of computer systems deserve management of their computing, so packages denying customers management are an injustice to be rejected and eradicated. For customers to have management, this system should give them the four essential freedoms:

  • The freedom to run this system as you would like, for any objective (freedom zero).
  • The freedom to review how this system works and alter it so it does your computing as you would like (freedom 1). Access to the supply code is a precondition for this.
  • The freedom to redistribute copies so you possibly can assist others (freedom 2).
  • The freedom to distribute copies of your modified variations to others (freedom three). By doing this you can provide the entire neighborhood an opportunity to learn out of your adjustments. Access to the supply code is a precondition for this.

About POSIX

Seth: The POSIX normal is a doc launched by the IEEE that describes a “portable operating system.” As lengthy as builders write packages to match this description, they’ve produced a POSIX-compliant program. In the tech trade, we name this a “specification” or “spec” for brief. That’s principally comprehensible, so far as tech jargon goes, however what makes an working system “portable”?

RMS: I feel it was the interface that was imagined to be transportable (amongst methods), slightly than anybody system. Indeed, varied methods which might be completely different inside do assist elements of the POSIX interface spec.

Seth: So if two methods function POSIX-compliant packages, then they’ll make assumptions about each other, enabling them to know the best way to “talk” to at least one one other. I learn that it was you who got here up with the identify “POSIX.” How did you give you the time period, and the way was it adopted by the IEEE?

RMS: The IEEE had completed growing the spec however had no concise identify for it. The title mentioned one thing like “portable operating system interface,” although I do not bear in mind the precise phrases. The committee placed on “IEEEIX” because the concise identify. I didn’t suppose that was a good selection. It is ugly to pronounce—it will sound like a scream of terror, “Ayeee!”—so I anticipated individuals would as a substitute name the spec “Unix.”

Since GNU’s Not Unix, and it was supposed to exchange Unix, I didn’t need individuals to name GNU a “Unix system.” I, subsequently, proposed a concise identify that folks would possibly really use. Having no specific inspiration, I generated a reputation the unclever method: I took the initials of “portable operating system” and added “ix.” The IEEE adopted this eagerly.

Seth: Does “operating system” within the POSIX acronym refer solely to Unix and Unix-like methods equivalent to GNU, or is the intent to embody all working methods?

RMS: The time period “operating system,” within the summary, covers methods that aren’t in any respect like Unix, by no means near the POSIX spec. However, the spec is supposed for methods which might be lots like Unix; solely such methods will match the POSIX spec.

Seth: Are you concerned in reviewing or updating the present POSIX requirements?

RMS: Not now.

Seth: The GNU Autotools toolchain does lots to make purposes simpler to port, not less than when it comes to when it comes time to construct and set up. Is Autotools an vital a part of constructing a transportable infrastructure?

RMS: Yes, as a result of even amongst methods that observe POSIX, there are many little variations. The Autotools make it simpler for a program to adapt to these variations. By the way in which, if anybody desires to assist in the event of the Autotools, please electronic mail me.

Seth: I think about, method again when GNU was simply beginning to make individuals notice (not)Unix liberated from proprietary know-how was attainable, there should have been a void of readability about how free software program might probably work collectively.

RMS: I do not suppose there was any void or any uncertainty. I used to be merely going to observe the interfaces of BSD.

Seth: Some GNU purposes are POSIX-compliant, whereas others have GNU-specific options both not within the POSIX spec or lack options required by the spec. How vital is POSIX compliance to GNU purposes?

RMS: Following an ordinary is vital to the extent it serves customers. We don’t deal with an ordinary as an authority, however slightly as a information which may be helpful to observe. Thus, we speak about following requirements slightly than “complying” with them. See the part Non-GNU Standards within the GNU Coding Standards.

We attempt to be appropriate with requirements on most points as a result of, on most points, that serves customers greatest. But there are occasional exceptions.

For occasion, POSIX specifies that some utilities measure disk house in items of 512 bytes. I requested the committee to vary this to 1K, nevertheless it refused, saying bureaucratic rule compelled the selection of 512. I do not recall a lot try and argue that customers could be happy with that call.

Since GNU’s second precedence, after customers’ freedom, is customers’ comfort, we made GNU packages measure disk house in blocks of 1K by default.

However, to defend in opposition to potential assaults by opponents who would possibly declare that this deviation made GNU “noncompliant,” we carried out optionally available modes that observe POSIX and ISO C to ridiculous extremes. For POSIX, setting the setting variable POSIXLY_CORRECT makes packages specified by POSIX checklist disk house when it comes to 512 bytes. If anybody is aware of of a case of an precise use of POSIXLY_CORRECT or its GCC counterpart –pedantic that gives an precise profit to some consumer, please inform me about it.

Seth: Are POSIX-compliant free software program tasks simpler to port to different Unix-like methods?

RMS: I suppose so, however I made a decision within the 1980s to not spend my time on porting software program to methods apart from GNU. I centered on advancing the GNU system in the direction of making it pointless to make use of any non-free software program and left the porting of GNU packages to non-GNU-like methods to whoever wished to run them on these methods.

Seth: Is POSIX vital to software program freedom?

RMS: At the basic stage, it makes no distinction. However, standardization by POSIX and ISO C certainly made the GNU system simpler emigrate to, and that helped us advance extra shortly in the direction of the aim of liberating customers from non-free software program. That was achieved within the early 1990s, when Linux was made free software program after which stuffed the kernel-shaped hole in GNU.

GNU improvements adopted by POSIX

I additionally requested Dr. Stallman whether or not any GNU-specific improvements or conventions had later develop into adopted as a POSIX normal. He could not recall particular examples, however kindly emailed a number of builders on my behalf.

Developers Giacomo Catenazzi, James Youngman, Eric Blake, Arnold Robbins, and Joshua Judson Rosen all responded with reminiscences of earlier POSIX iterations in addition to ones nonetheless in progress. POSIX is a “living” normal, so it is being up to date and reviewed by trade professionals constantly, and lots of builders who work on GNU tasks suggest the inclusion of GNU options.

For the sake of historic curiosity, right here’ are some in style GNU options which have made their method into POSIX.

Make

Some GNU Make options have been adopted into POSIX’s definition of make. The related specification gives detailed attribution for options borrowed from present implementations.

Diff and patch

Both the diff and patch instructions have gotten -u and -U choices added straight from GNU variations of these instruments.

C library

Many options of the GNU C library, glibc, have been adopted in POSIX. Lineage is usually tough to hint, however James Youngman wrote:

“I am fairly certain there are a selection of options of ISO C which had been pioneered by GCC. For instance, _Noreturn is new in C11, however GCC-1.35 had this function (one used the risky modifier on a operate declaration). Also—although I am not sure about this—GCC-1.35 supported Arrays of Variable Length which appear to be similar to trendy C’s conformant arrays.”

Giacomo Catenazzi cites the Open Group’s strftime article, pointing to this attribution: “This is predicated on a function in some variations of GNU libc’s strftime().”

Eric Blake notes that the getline() and varied *_l() locale-based capabilities had been undoubtedly pioneered by GNU.

Joshua Judson Rosen provides to this, saying he clearly remembers being impressed by the adoption of getline capabilities after witnessing unusually acquainted GNU-like habits from code meant for a special OS totally.

“Wait…that’s GNU-specific… isn’t it? Oh—not anymore, apparently.”

Rosen pointed me to the getline man page, which says:

Both getline() and getdelim() had been initially GNU extensions. They had been standardized in POSIX.1-2008.

Eric Blake despatched me a listing of different extensions which may be added within the subsequent POSIX revision (codenamed Issue eight, at present due round 2021):

Userspace extensions

POSIX would not simply outline capabilities and options for builders. It defines normal habits for userspace as properly.

ls

The -A choice is used to exclude the . (representing the present location) and .. (representing the chance to return one listing) notation from the outcomes of an ls command. This was adopted for POSIX 2008.

discover

The discover command is a great tool for advert hoc for loops and as a gateway into parallel processing.

Just a few conveniences made their method from GNU to POSIX, together with the -path and -perm choices.

The -path choice enables you to filter search outcomes matching a filesystem path sample and was out there in GNU’s model of discover since earlier than 1996 (the earliest report in findutil‘s Git repository). James Youngman notes that HP-UX additionally had this feature very early on, so whether or not it is a GNU or an HP-UX innovation (or each) is unsure.

The -perm choice enables you to filter search outcomes by file permission. This was in GNU’s model of discover by 1996 and arrived later within the POSIX normal “IEEE Std 1003.1, 2004 Edition.”

The xargs command, a part of the findutils bundle, had a -p choice to put xargs into an interactive mode (the consumer is prompted whether or not to proceed or not) by 1996, and it arrived in POSIX in “IEEE Std 1003.1, 2004 Edition.”

Awk

Arnold Robbins, the maintainer of GNU awk (the gawk command in your /usr/bin listing, in all probability the vacation spot of the symlink awk), says that gawk and mawk (one other GPL awk implementation) permit RS to be a daily expression, which is the case when RS has a size higher than 1. This is not a function in POSIX but, however there’s an indication that it will be:

The undefined habits ensuing from NULs in prolonged common expressions permits future extensions for the GNU gawk program to course of binary information.

The unspecified habits from utilizing multi-character RS values is to permit attainable future extensions primarily based on prolonged common expressions used for report separators. Historical implementations take the primary character of the string and ignore the others.

This is a big enhancement as a result of the RS notation defines a separator between data. It is perhaps a comma or a semicolon or a splash or any such character, but when it is a sequence of characters, then solely the primary character is used until you are working in gawk or mawk. Imagine parsing a doc of IP addresses with data separated by an ellipsis (three dots in a row), solely to get again outcomes parsed at each dot in each IP handle.

Mawk supported the function first, nevertheless it was with no maintainer for a number of years, leaving gawk to hold the torch. (Mawk has since gained a brand new maintainer, so arguably credit score might be shared for pushing this function into the collective expectation.)

The POSIX spec

In normal, Giacomo Catenzzi factors out, “…because GNU utilities were used so much, a lot of other options and behaviors were aligned. At every change in shell, Bash is used as comparison (as a first-class citizen).” There’s no requirement to quote GNU or some other affect when one thing is rolled into the POSIX spec, and it might probably safely be assumed that influences to POSIX come from many sources, with GNU being solely one in every of many.

The significance of POSIX is consensus. A gaggle of technologists working collectively towards frequent specs to be shared by lots of of unusual builders lends energy to the higher motion towards software program independence and developer and consumer freedom.

Most Popular

To Top