17

Does Posix require any devices? For example, /dev/urandom, /dev/zero or /dev/null?

I suspect not because of non-*nix OSes, but wanted to ask for completeness.

1 Answers1

16

POSIX general defines three special files:

  • /dev/tty
  • /dev/console
  • /dev/null

In addition, / and /tmp are also defined by POSIX.

/dev/zero, /dev/urandom or /dev/random are defined in some UNIX-like operating systems. Some operating systems may not define them, or implement with different names.

Note

qqqq
  • 48
cuonglm
  • 153,898
  • I've seen nul and console on Windows, but I don't believe I've ever seen tty. –  Jul 26 '14 at 16:51
  • 2
    @noloader: Windows implement only the first version of POSIX standard. See: http://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem – cuonglm Jul 26 '14 at 16:53
  • 3
    @noloader Windows's nul and console aren't related to Unix's /dev/null and /dev/console except in some indirect historical way. The names nul and console were inherited from CP/M (which didn't have directories); CP/M/DOS/Windows's nul means the same thing as unix's /dev/null but console under DOS and Windows means a serial port, not the console like on unix systems. If you run an application in Windows's POSIX subsystem (or in another POSIX implementation on top of Windows), you will get /dev/null, /dev/tty and /dev/console. – Gilles 'SO- stop being evil' Jul 27 '14 at 21:39
  • 2
    To add to @Gilles explanation, basically Windows/Dos's console is to UNIX's /dev/tty1 or Plan9's /dev/console. But historically meant the keyboard and mouse or stdin. While serial ports was over COM{1..4} or AUX, and parallel ports was over LPT{1-4}. – Dwight Spencer Oct 01 '15 at 17:22