3

Similar in spirit to this question about the etymology of linux commands, I'm curious about the origin of the name of unistd.h.

Does anyone know for certain what unistd.h stands for? If unistd.h was meant to be read as "Unix standard header", why wasn't it named unixstd.h?

From the Open Group's description of unistd.h (emphasis mine):

unistd.h - standard symbolic constants and types

From Wikipedia (emphasis mine):

In the C and C++ programming languages, unistd.h is the name of the header file that provides access to the POSIX operating system API. It is defined by the POSIX.1 standard, the base of the Single Unix Specification, and should therefore be available in any POSIX-compliant operating system and compiler.

Putting two and two together, it looks like unistd.h is likely a combination of Unix (uni) and standard (std), resulting in a "Unix standard header". Barath Ravikumar and Vicky Chijwani posit this in an answer to another, unrelated Stack Overflow question:

<unistd.h> , stands for unix standard header ,the name says it all.

unistd could just as well stand for "universal standard header" (I realize that sounds a bit ridiculous). The point is, they should've named it unixstd.h -- instant clarity by adding just one character.

If this is true, then it's possible that the omission of a single x character has helped spawn more than a few questions about the C standard library and why unistd.h isn't part of it (example 1, example 2, example 3).

  • 4
    The file is much older than the standards that define it today; [here’s the 2.11BSD version](https://minnie.tuhs.org/cgi-bin/utree.pl?file=2.11BSD/include/unistd.h). The six-character name *might* be related to various DEC file system limitations (6.3 in DECtape etc.) but 2.11BSD had other headers with longer names. – Stephen Kitt Mar 15 '22 at 22:43
  • See https://unix.stackexchange.com/questions/6938/what-does-uni-mean-in-unistd-h – fpmurphy Mar 16 '22 at 11:30
  • 2
    At the time unistd.h was created, UNIX was a registered trademark of AT&T and could only legally be used to describe their systems, not things like BSD - it wasn't until the mid-90's that Novell transferred the UNIX trademark to The Open Group to describe the standard. – alanc Apr 24 '22 at 19:26
  • 1
    @StephenKitt But the 2.11BSD stuff is dated 1992. Moreover, the file itself carries a 1999 stamp, and a copyright header refers to 1994. When we look at BSD4, is not yet found in 4.3 Reno. It starts appearing in BSD 4.4. This is all well into the POSIX timeline. – Kaz May 23 '23 at 07:37
  • 1
    @StephenKitt On the other hand, it seems, according to Google Books, that "unistd.h" occurs in the X/Open Portability Guide in from 1987. It may have been an X/Open invention? – Kaz May 23 '23 at 07:56
  • 1
    @Kaz ah, yes, 2.11BSD kept on being modified with changes from other branches for a long time... The X/Open reference is interesting, that may well be a more likely origin. – Stephen Kitt May 23 '23 at 08:00
  • 1
    @Kaz it shows up in the 1985 edition too. – Stephen Kitt May 23 '23 at 08:05

0 Answers0