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._-

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Heroku

This site is powered by Heroku

Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.

Sign Up

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay