[Previous]
[Contents]
[Next]

About This Reference

The C Library Reference describes the functions and macros in the Watcom 10.6 C Library. Use the following links to find a function quickly:

A B C D E F G H I J K L
M N O P Q R S T U V W Y

Note: For an overview of the changes to this reference, see What's new online (as of August 06, 1999).

This reference includes the following:


Note:
  • This reference doesn't describe the Watcom C graphics routines. You should use the Photon graphics routines instead.
  • The ncurses package is a freeware subroutine library used for managing input from and output to the screen, independent of the terminal used. It's described in the online Miscellaneous Utilities reference.

The C library provides much of the power usually associated with the C language. Library functions are called as if they had been defined within the program. When the program is linked, the code for these routines is incorporated into the program by the linker.

Strictly speaking, it isn't necessary to declare the library functions that return int. However, it's best to declare all functions by including the header files found in the Synopsis section with each function. Not only does this declare the return value, but also the type expected for each of the arguments as well as the number of arguments. This enables the Watcom C and C++ compilers to check the arguments coded with each function call.

What's new online (as of August 06, 1999)

New content


Note: The functions designated as threadsafe are safe only if you create threads with _beginthread(), not tfork().

Corrections

_beginthread()
The example has been corrected.
_bgetcmd()
This function returns the number of bytes required to store the command line, excluding the terminating null character.
_CA_PCI_BIOS_Present()
This function returns PCI_SUCCESS if PCI BIOS is present, and -1 if it isn't.

Programs calling the _CA_PCI_... functions must be linked with privity level 1 (cc option -T1) and must be run as root. The stack size must be less than 64K.

_CA_PCI_Find_Device()
The example has been corrected.
clock()
This function simply returns the difference between the current time and the time the program started, so it gives incorrect results if the system time changes somewhere between. The times() function provides more useful information.
dev_read()
The example has been corrected - there shouldn't be ampersands (&) in front of buf in the calls to dev_read() and Receive().
exec()
The flags field of the qnx_spawn_options are effectively ignored when using the exec... functions because you're not creating a new process.
fcntl()
Locks aren't propagated on calls to fork() or the spawn... functions.

A clearer example has been added.

fdopen()
The example has been replaced.
fnmatch()
The FNM_NOESCAPE flag has been added and the description of the FNM_QUOTE flag (a QNX extension) has been corrected.
getcmd()
The cmdname() function has been added to the See Also list.
getopt()
This function refers to the POSIX Utility Syntax Guidelines 1003.2 section 2.10.2, not 2.11.2.
gets()
It's better to use fgets() than gets(). With gets(), data beyond the array buf is destroyed if a newline character isn't read from the input stream stdin before the end of the array buf is reached.
int386(), int386x(), int86(), and int86x()
These functions aren't useful in QNX and have been removed from this reference.
ioctl()
Moved from the TCP/IP Programmer's Guide.
__iscsym(), __iscsymf()
These are macros, not functions.
lseek()
The Returns section has been corrected.
lstat()
The description of the S_ISLNK() macro has been moved here from stat() because stat() doesn't return information about symbolic links.
mq_notify()
This function sets errno to ESRCH if the notification argument is NULL, but the current process isn't registered for notification.
mq_send()
This function returns 0 on success, and -1 if an error occurs.
popen()
This function calls spawnlp(), not spawnl().
print_usage()
This function doesn't return if successful.
qnx_hint_attach()
The synopsis has been corrected.

The example has been modified so that it doesn't use the check_stack pragma, which doesn't do anything under QNX.

qnx_ioctl()
An example has been added.
qnx_name_locate()
The description has been corrected.
qnx_pflags()
If a process sets the _PPF_PRIORITY_FLOAT flag, the messages sent to it are ordered as if _PPF_PRIORITY_REC were set as well.
Caution: Don't spawn processes while the _PPF_INFORM flag is set - your process and Proc will become Send-blocked.

It's best not to use this flag at all; use a I/O manager (or resource manager) and watch for _IO_CLOSE messages from the processes you're interested in.


qnx_proxy_detach()
This function can detach only proxies attached to your process, and not proxies created by your process.
qnx_psinfo()
Now includes a description of the _psinfo data structure.

The example in the discussion of the _seginfo structure has been corrected.

If you ask for information about a process that doesn't exist, qnx_psinfo() might return information about another process, but not necessarily the one with the next montonically greater process ID.

qnx_scheduler()
The example has been replaced. The description of adaptive scheduling (see SCHED_OTHER) has been corrected.
qnx_segment_alloc()
Programs that call this function must run as root.
qnx_spawn()
The synopsis includes <sys/sched.h>, not <sched.h>.

If you specify _SPAWN_NOZOMBIE and start a child on a remote node, qnx_spawn() returns 0, not the child's process ID.

The value of envp cannot be NULL, but envp[0] can be a NULL pointer, if no environment strings are passed.

qnx_spawn_options
The ctfd (controlling terminal file descriptor) field was missing from the data structure and initial values.
qnx_ticksize
_TICKSIZE_EXTERNAL has been removed from the possible flags.
qnx_vc_poll_parm
If you wish to change the poll parameters, your program must run as root.
raise()
The synopsis has been corrected.
scanf()
The meaning of a dash in a format string (for example, [0-9]) has been clarified.
sem_init()
This function returns 0 if successful.

This function sets errno to EAGAIN, not ENOSPC, if the limit on semaphores has been reached or a resource required to initialize the semaphore has been exhausted.

sem_init(), sem_post(), sem_trywait(), sem_wait()
The example can be found in the /usr/demo/src/semaphores directory.
shm_unlink()
This function sets errno to EINVAL if you try to unlink physical memory.
sigaction()
This function fails and sets errno to EINVAL if you try to change the action for SIGKILL or SIGSTOP.
signal()
(QNX extension) If a process sets the action for the SIGCHLD signal to SIG_IGN:
stat()
The _stat() function has been removed because it isn't implemented for QNX-use stat() instead.

This function can't be used to get information about a symbolic link; use lstat() instead. The S_ISLNK() macro isn't useful with stat() because stat() follows the link and gives information about the resulting file or directory.

The stat() function returns -1 if the information couldn't be obtained.

_strdate()
Since the year is expressed as two digits, beware of problems with the year 2000.
strtoul()
This function accepts a sign as part of the input string, but always returns an unsigned long.
Trace functions
You must compile with privity level 1 to use these functions, except under Neutrino.
ttyname()
The example has been corrected.
uname()
The list of errors has been corrected.
waitpid()
The Returns section has been corrected.

[Previous]
[Contents]
[Next]