When a library function is referenced in a source file, the related header files (shown in the synopsis for that function) should be included in that source file. The header files provide the proper declarations for the functions and for the number and types of arguments used with them. Constant values used in conjunction with the functions are also declared. The files can be included in any order.
This chapter describes the header files supplied with the C library:
When the Watcom C compiler option za is used ("ANSI conformance"), the macro NO_EXT_KEYS is predefined. Use the za option when you're creating an application that must conform to a certain standard, whether it be ANSI or POSIX. The effect on the inclusion of ANSI- and POSIX-defined header files is that certain portions of the header files are omitted:
Feature test macros may then be defined to select those portions that are omitted. Two feature test macros may be defined:
When _QNX_SOURCE is defined, it encompasses _POSIX_SOURCE, so it isn't necessary to define _POSIX_SOURCE as well. |
Feature test macros may be defined on the command line, or in the source file before any header files are included. The latter is illustrated in the following example, in which an ANSI- and POSIX-conforming application is being developed.
#define _POSIX_SOURCE #include <limits.h> #include <stdio.h> . . . #if defined(_QNX_SOURCE) #include "non_POSIX_header1.h" #include "non_POSIX_header2.h" #include "non_POSIX_header3.h" #endif
The source code is then compiled using the za option.
The following ANSI header files are affected by the _POSIX_SOURCE feature test macro:
The following ANSI and POSIX header files are affected by the _QNX_SOURCE feature test macro:
Header file | Type |
---|---|
<ctype.h> | ANSI |
<env.h> | POSIX |
<fcntl.h> | POSIX |
<float.h> | ANSI |
<limits.h> | ANSI |
<math.h> | ANSI |
<process.h> | extension to POSIX |
<setjmp.h> | ANSI |
<signal.h> | ANSI |
<sys/stat.h> | POSIX |
<stdio.h> | ANSI |
<stdlib.h> | ANSI |
<string.h> | ANSI |
<termios.h> | POSIX |
<time.h> | ANSI |
<sys/types.h> | POSIX |
<unistd.h> | POSIX |
The following header files are provided with the software. The header files that are located in the /usr/include directory are described first.
This ANSI header file is required when an assert() macro is used. These assertions are ignored when the identifier NDEBUG is defined.
This header file contains common macro definitions used in other header files.
This header file provides the declarations for console and Intel 80x86 port input/output functions.
This header file provides runtime debugging support.
This ANSI header file provides the declarations for functions that manipulate characters.
This header file contains definitions for the ncurses package.
The QNX proprietary term_* functions have been deprecated in favor of ncurses. ncurses is a set of terminal-independent routines for painting screens and handling input events. It's a freeware implementation that's based on the System V and X/Open curses API. For more information, see the Miscellaneous Utilities bookset in the online documentation. |
This POSIX header file provides the declarations for functions related to directories, and for the type DIR, which describes an entry in a directory.
This POSIX header file contains prototypes for environment string functions.
This ANSI header file provides the extern declaration for error variable errno, and provides the symbolic names for error codes that can be placed in the error variable.
This header file contains definitions of error codes for the ncurses package.
This POSIX header file provides the flags used by the creat(), fcntl(), open() and sopen() functions.
This ANSI header file contains declarations for constants related to floating-point numbers, declarations for low-level floating-point functions, and the declaration of the floating-point exception codes.
This header file provides the declaration for the fnmatch() pattern-matching function.
This header file contains definitions of forms for the ncurses package.
This header file contains structure definitions and function prototypes for the Watcom C Graphics library functions.
These functions aren't documented; use Photon instead. |
This POSIX header file contains structures and prototypes for group operations.
This header file is used with functions that interact with the Intel architecture. It defines the structs and unions used to handle the input and output registers for the Intel 80x86 and 80386/80486 interrupt interface routines. It includes prototypes for the interrupt functions, definitions for the FP_OFF(), FP_SEG() and MK_FP() macros, and definitions for the following structures and unions:
This ANSI header file contains constant declarations for limits or boundary values for ranges of integers and characters.
This ANSI header file contains declarations for the categories (LC...) of locales that can be selected using the setlocale() function, which is also declared.
This header file provides declarations for the memory allocation and deallocation functions.
This ANSI header file contains declarations for the mathematical functions (which operate with floating-point numbers) and for the structures:
The header file contains definitions and functions for multibyte characters.
The header file defines Multibyte-Character-Set (MBCS) functions.
This header file defines memory-manipulation functions.
This header file defines functions and macros for migrating to QNX.
This header file contains definitions of menus for the ncurses package.
This header file contains declarations that are used by the functions that deal with message queues. For more information, see "Message-queue structures" in the chapter on POSIX.4 message queues.
This header file contains definitions of panels for the ncurses package.
This header file defines Presentation Graphics functions.
These functions aren't documented; use Photon instead. |
This header file contains function declarations for the spawn... functions, the exec... functions, and the system() function. The file also contains declarations for the constants P_WAIT, P_NOWAIT, P_NOWAITO and P_OVERLAY. These constants are discussed in the section on the spawn... functions.
This POSIX header file contains structure definitions and prototypes for password operations.
This header file defines queueing functions.
This header file contains structure definitions and prototypes for regular expression handling.
This header file contains function prototypes for the lfind() and lsearch() functions.
This header file contains declarations used by the semaphore functions.
This ANSI header file provides declarations to be used with the setjmp() and longjmp() functions.
This header file defines constants for shared access to files using the sopen() function.
This ANSI header file contains the declarations related to the signal() and raise() functions.
This ANSI header file contains the declarations for the macros that handle variable argument lists.
This ANSI header file contains declarations for a few popular constants, including NULL (null pointer), size_t (unsigned size of an object), and ptrdiff_t (difference between two pointers). It also contains a declaration for the offsetof() macro.
This ANSI header file relates to "standard" input/output functions. Files, devices and directories are referenced using pointers to objects of the type FILE. The header file contains declarations for these functions and macros, defines the FILE type, and contains various constants related to files.
This ANSI header file contains declarations for many standard functions, excluding those declared in other header files discussed in this section.
This ANSI header file contains declarations for functions that manipulate strings or blocks of memory.
This header file contains definitions for the system message log.
This POSIX header file contains header block information for the tar format.
This header file defines generic international text function macros.
This header file contains terminal information definitions for use with ncurses.
The QNX proprietary term_* functions have been deprecated in favor
of ncurses.
ncurses is a set of terminal-independent routines for painting
screens and handling input events. It's a freeware implementation that's
based on the System V and X/Open curses API. For more
information, see the
Miscellaneous
Utilities bookset in the online documentation.
If you want to continue to use termlib, you'll have to link it into your program explicitly with the option -ltermlib. The file /usr/include/term.h is now an ncurses header file; you'll find the old <term.h> in /usr/include/sys/term.h. An error message is displayed if you combine the old term_* and ncurses header files. |
This POSIX header file contains terminal I/O system types.
This ANSI header file declares the functions related to times and dates, and defines the structured type struct tm, which contains the following fields:
This header file contains definitions for displaying printable versions of control characters in the ncurses package.
This header file defines the Unicode character set.
This POSIX header file contains the declarations for functions that perform input/output operations at the operating system level. These functions use file descriptors to reference files or devices. The function fstat() is declared in the <sys/stat.h> header file.
This header file contains definitions that aid in porting traditional UNIX code.
This POSIX header file contains a declaration for the utime() function, and for the structured type utimbuf used by it. See the utime() function for a description of the utimbuf structure.
This UNIX System V header file provides an alternate way of handling variable argument lists. The equivalent ANSI header file is <stdarg.h>.
The following header files are present in the sys subdirectory. Their presence in this directory indicates that they are system-dependent header files.
This header file defines macros and types for use with audio.
This header file contains definitions for use with CD ROMs.
This header file contains definitions for the console driver.
This header file contains "public" definitions for the console driver.
This header file contains debugger data structures.
This header file contains "public" device administrator definitions.
This header file contains "public" device driver messages.
This header file contains nonportable file system definitions.
This header file contains the dumper file structure.
This header file contains file descriptor data structures.
This header file contains nonportable file system definitions.
This header file contains declarations related to the fsysinfo() function.
This header file contains nonportable file system message definitions.
This header file contains handy pragmas that are often used when doing low-level programming.
This header file contains nonportable low-level I/O definitions.
This header file contains structure definitions and prototypes for interrupt request functions.
This header file contains prototypes and pragmas for kernel function calls.
This header file contains structure definitions for load module format.
This header file contains the manifest constants used by the locking() function.
This header file contains a definition for the _magic structure.
This header file contains declarations related to the memory mapping functions.
At least the following protection bits are defined in <sys/mman.h>:
This header file contains structure definitions and prototypes for mouse operations.
This header file contains "private" definitions for the mouse driver.
This header file contains structure definitions and prototypes for QNX qnx_name... functions.
This header file contains manifests, structure definitions and prototypes for operating system information.
This header file contains manifests, structure definitions and prototypes for operating system status information.
This header file contains declarations for PCI functions.
This header file contains file prefix prototypes.
This header file contains process data structures and definitions.
This header file contains proxy process prototypes.
This header file contains manifests and structure definitions for process information.
This header files contains manifests and structures for common qnx_ioctl() messages.
This header file contains a structure definition for the QNX process-spawning global data area, qnx_spawn_options.
This header file contains terminal capability definitions.
This header file contains manifests and prototypes for process scheduling.
This header file contains segment information data structures.
This header file contains the prototype for the select() function.
This header file contains a definition for _setmx(), and a definition of the _mxfer_entry structure. See _setmx() for a description of the _mxfer_entry structure.
This header file contains "public" serial driver messages.
This header file contains session information data structures.
This POSIX header file contains the declarations pertaining to file status, including definitions for the fstat() and stat() functions and for the structure:
This header file also defines access permission bits for the owner of a file, the owner's group, and other users.
The following bits define permissions for the owner:
Bit | Meaning |
---|---|
S_IRWXU | Read, write, execute/search |
S_IRUSR | Read permission |
S_IWUSR | Write permission |
S_IXUSR | Execute/search permission |
S_IRWXU is the bitwise inclusive OR of S_IRUSR, S_IWUSR, and S_IXUSR.
The following bits define permissions for the group:
Bit | Meaning |
---|---|
S_IRWXG | Read, write, execute/search |
S_IRGRP | Read permission |
S_IWGRP | Write permission |
S_IXGRP | Execute/search permission |
S_IRWXG is the bitwise inclusive OR of S_IRGRP, S_IWGRP and S_IXGRP.
The following bits define permissions for others:
Bit | Meaning |
---|---|
S_IRWXO | Read, write, execute/search |
S_IROTH | Read permission |
S_IWOTH | Write permission |
S_IXOTH | Execute/search permission |
S_IRWXO is the bitwise inclusive OR of S_IROTH, S_IWOTH and S_IXOTH.
The following bits define miscellaneous permissions used by other implementations:
Bit | Meaning |
---|---|
S_IREAD | is equivalent to S_IRUSR (read permission) |
S_IWRITE | is equivalent to S_IWUSR (write permission) |
S_IEXEC | is equivalent to S_IXUSR (execute/search permission) |
This header file contains standard system message definitions.
This header file contains terminal information definitions for use with the QNX proprietary term_* functions.
The QNX proprietary term_* functions have been deprecated in favor
of ncurses.
ncurses is a set of terminal-independent routines for painting
screens and handling input events. It's a freeware implementation that's
based on the System V and X/Open curses API. For more
information, see the
Miscellaneous
Utilities bookset in the online documentation.
If you want to continue to use termlib, you'll have to link it into your program explicitly with the option -ltermlib. The file /usr/include/term.h is now an ncurses header file; you'll find the old <term.h> in /usr/include/sys/term.h. An error message is displayed if you combine the old term_* and ncurses header files. |
This header file describes the timeb structure used in conjunction with the ftime() function. See the description of ftime() for a description of this structure.
This POSIX header file contains interval timer definitions from POSIX 1003.4.
This POSIX header file contains process timing definitions from POSIX 1003.1.
This header file contains trace data structures and definitions. These are described with the Trace... functions.
This header file contains the trace codes used by the Trace() functions. These are described with the Trace... functions.
This POSIX header file contains declarations for the types used by system-level calls to obtain file status or time information.
This file contains definitions for SCSI I/O control.
This header file contains declarations related to the readv() and writev() functions.
This POSIX header file contains a definition of the utsname structure, and a prototype for the uname() function. See the description of uname() for more information on this structure.
This header file contains manifests and prototypes for virtual circuit functions.
This POSIX header file contains manifests and prototypes for the wait() and waitpid() functions.
The following headers are included in order to resolve references to items found on other operating systems. They may be helpful when porting code.