15.2.2 Cross-Unix System Interfaces
There are several Unix system interfaces which have associated
portability issues. We do not have the space here to discuss all of
these in detail across all Unix systems. However, we mention them here
to indicate issues where you may need to consider portability.
- Many Unix systems provide the `curses' interface for simple
graphical terminal access, but the name of the library varies. Typical
names are `-lcurses' or `-lncurses'. Some Unix systems do not
provide `curses', but do provide the `-ltermcap' or
`-lterminfo' library. The latter libraries only provide an
interface to the `termcap' file or `terminfo' files. These
files contain information about specific terminals, the difference being
mainly the manner in which they are stored.
- `proc file system'
- The `/proc' file system is not available on all Unix systems, and
when it is available the actual set of files and their format varies.
- `pseudo terminals'
- All Unix systems provide pseudo terminals, but the interface to obtain
them varies widely. We recommend examining the configuration of an
existing program which uses them, such as GNU emacs or Expect.
- `shared libraries'
- Shared libraries differ across Unix systems. The GNU libtool
program was written to provide an interface to hide the differences.
See section 10. Introducing GNU Libtool.
- The `termios' interface to terminals is standard on modern Unix
systems. Avoid the older, non-portable, `termio' and `tty'
interfaces (these interfaces are defined in `termio.h' and
- Many, but not all, Unix systems support multiple threads in a single
process, but the interfaces differ. One thread interface, pthreads, was
standardized in the 1996 edition of POSIX.1, so Unix systems are likely
to converge on that interface over time.
- Most Unix systems maintain the `utmp' and `wtmp' files to
record information about which users are logged onto the system.
However, the format of the information in the files varies across Unix
systems, as does the exact location of the files and the functions which
some systems provide to access the information. Programs which merely
need to obtain login information will be more portable if they invoke a
program such as
w. Programs which need to update the login
information must be prepared to handle a range of portability issues.
- `X Window System'
- Version 11 of the X Window System is widely available across Unix
systems. The actual release number varies somewhat, as does the set of
available programs and window managers. Extensions such as OpenGL are
not available on all systems.