DEV Community

Cover image for What is POSIX?
wassef ben ahmed
wassef ben ahmed

Posted on

5 1

What is POSIX?

It sure sounds like a cool name!
POSIX stands for Portable Operating System Interface and is a family of standards, specified by the IEEE designed to facilitate application portability across UNIX based systems.

If you wrote your programs to rely on POSIX standards, you'll be able to port them easily among a large family of Unix derivatives.

Honorable mentions of UNIX SYSTEMS :
alt text

Some of the standards POSIX defines :


1.C API

Greatly extends STANDARD C with things like:

  • file operations: mkdir, dirname, symlink, readlink, link.
  • networking: socket().
  • memory management: mmap, mlock, mprotect, advise. Those APIs also determine the underlying system concepts on which they depend, forcing you to conform.

2.CLI utilities

E.g: cd, ls, echo ...
Many utilities are direct shell front ends for a corresponding C API functions and some are implemented by Bash as built-ins.

3.Shell language

Support for the shell language.
E.g :

a = 5;
echo "$a"; #to print the variable a.
Enter fullscreen mode Exit fullscreen mode

4.Program exit status

ANSI C says 0 or EXIT_SUCCESS for success, EXIT_FAILURE for failure.
what POSIX adds:

  • 126: command found but not executable.
  • 127: command not found.
  • >128: terminated by a signal.

5.Regular expression

Support for the two types of regex (BRE/ERE).
E.g :

echo 'a.1' | grep -E 'a.[[:digit:]]' 
#search for a regex from the piped input 
Enter fullscreen mode Exit fullscreen mode

6.Filenames

  • / is the path separator.
  • NUL cannot be used.
  • . is cwd, .. is parent.
  • can only contain a-zA-Z0-9._-

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay