Writing standard POSIX code

The POSIX standard (1990) replaces generic types in the application programming interfaces (APIs), such as int, with more specific types, such as pid_t and mode_t. You can usually fix these problems in your code by checking the prototype in the headers and changing the variable declarations.

The following table summarizes some of the choices made for portable code. Interfaces marked with an asterisk (*) are also supplied in the Interix Software Development Kit (SDK).

Historical Interix SDK (POSIX.1)
MAXPATHLEN PATH_MAX
MAXUPRC CHILD_MAX
NCARGS ARG_MAX
NGROUPS NGROUPS_MAX
NOFILE OPEN_MAX
getwd() getcwd()
index()* strchr()
lockf()* fcntl()
mknod()* mkfifo()
mkstemp()* tmpfile()
mktemp()* tmpnam( ) or tempnam()
rindex()* strrchr()
signal()* sigaction()
utimes() utime()

The APIs mkstemp(), mktemp(), index(), rindex(), and signal() are defined in the Single UNIX Specification, and are supplied in the Interix SDK.

The Interix SDK ships with both the varargs.h and stdarg.h headers. The International Standards Organization/American Standards Institute (ISO/ANSI) C standard defines stdargs.h as the newer mechanism for dealing with variable argument lists. For more information, see stdarg vs. varargs.

This section covers: