|
EOF
#include <stdio.h>
|
stand-alone
|
The value returned from input functions to indicate End Of File.
|
|
errcode_get
#include <errcode.h>
ERRCODE errcode_get (
THREAD_HANDLE T
);
|
stand-alone
|
The function returns a point to the given thread’s errcode_t structure. If the parameter T is zero, the function returns a pointer to the current thread’s structure.
|
|
errcode_see
#include <errcode.h>
ERRCODE errcode_see (
ERRCODE e,
char *buffer
);
|
stand-alone
|
The values in the structure e are converted into a text string in the given buffer. The text fields of the structure is used as a format for the conversion. If e->text is NULL, the string "%08x %08x" is used. The final string is given a prefix of the hexadecimal form of e->code followed by a colon and a space.
For example, assume the following:
char buff[128];
e->code = 0x12345678;
e->text = "failure. line=%d position=%d";
e->v1 = 12;
e->v2 = 99;
The call "errcode_see(e, buff)" would put the following string into buff:
"12345678: failure. line=12 position=99"
|
|
errcode_set
#include <errcode.h>
ERRCODE errcode_set (
unsigned int code,
const char *text,
unsigned int v1,
unsigned int v2
);
|
stand-alone
|
The fields of the current thread’s errcode_t structure are set to the values of the parameters with the same names. Before being set, all the fields have zero values.
|
|
errno
#include <errno.h>
int errno;
|
stand-alone
|
Some run-time library functions return a simple true/false value to indicate success or failure. For example, fopen returns a pointer to a file descriptor, or a null pointer for failure. Many library functions also set the variable errno to indicate the type of error in more detail. Some functions, like sqrt, have only one possible error type. In the case of sqrt, the value assigned to errno when the argument to sqrt is negative is EDOM—domain error. Some other functions, such as strtol, may provoke several different distinguishable errors; strtol may set errno either to EDOM or to ERANGE—range error.
The different values of errno are defined as macros in <errno.h> .
The values of errno that a particular function uses are described along with the function. In this version of Diamond, errno may also be assigned a server status code by any function which requires access to file services. For example, a failed call to fopen might set errno to 99: server operation failed.
At entry to a program's main function, errno is zero. A run-time library function that does not detect an error does not guarantee to return errno to this initial state, although it may do so. Thus, unless errno is zeroed immediately before a call to a run-time library function, you should examine its value only if the call is otherwise known to have failed by examination of the function's return value.
|
|
EVENT
#include <event.h>
|
stand-alone
|
The type of an event object. Threads are waiting on an EVENT if its value is neither EVENT_NO nor EVENT_YES.
|
|
event_init
#include <event.h>
void event_init (
EVENT *event,
EVENT *value
);
|
stand-alone
|
event_init puts the given event into a standard state and discards any list of waiting threads. This function must be called before the event can be used for the first time. The second parameter, value, may be one of:
|
EVENT_YES
|
the event is left set.
|
|
EVENT_NO
|
the event is left reset.
|
|
|
EVENT_NO
#include <event.h>
|
stand-alone
|
The value of an EVENT that has not been set and has no threads waiting on it. Threads are waiting on an EVENT if its value is neither EVENT_NO nor EVENT_YES.
|
|
event_pulse
#include <event.h>
void event_pulse (
EVENT *event
);
|
stand-alone
|
event_pulse sets the given event and immediately clears (reset) it; the setting and clearing are done indivisibly. All threads waiting on the event are restarted and the event is left in the reset state (EVENT_NO) with no waiting threads.
|
|
event_reset
#include <event.h>
void event_reset (
EVENT *event
);
|
stand-alone
|
event_reset changes the state of an event from EVENT_YES to EVENT_NO. The state of the event is not be altered if there are threads waiting on the event. If you are certain that no threads are waiting on the event, you can get a cheaper reset by simply assigning EVENT_NO to the event.
|
|
event_set
#include <event.h>
void event_set (
EVENT *event
);
|
stand-alone
|
event_set sets the given event. All threads waiting on the event are restarted and the event is left in the set state (EVENT_YES) with no waiting threads.
|
|
event_wait
#include <event.h>
void event_wait (
EVENT *event
);
|
stand-alone
|
event_wait tests the current value of the given event. If the event is set, the calling thread continues execution. If the thread is not set, the current thread is suspended and added to the list of threads waiting for the event. All such waiting threads are restarted when another thread sets or pulses the event.
|
|
EVENT_YES
#include <event.h>
|
stand-alone
|
The value of an EVENT that has been set; there are no threads waiting on it. Threads are waiting on an EVENT if its value is neither EVENT_NO nor EVENT_YES.
|
|
exit
#include <stdlib.h>
void exit (
int status
);
|
stand-alone
|
exit is the normal means of terminating program execution. It calls all the functions registered by calls to atexit (in reverse order of registration), and then closes all the task's files. The call to exit never returns.
status is used to tell the operating system about the status of the terminating program. The header <stdlib.h> defines two macros so that this may be done in a machine-independent way. If status is zero or EXIT_SUCCESS, the program is terminating successfully. If status is EXIT_FAILURE it is
terminating unsuccessfully.
The value of status is given to the host operating system result code: 0 indicates success, and non-zero indicates failure.
An implicit call is made to exit(EXIT_SUCCESS) when the main function returns.
|
|
exp
#include <math.h>
double exp (
double x
);
|
stand-alone
|
exp returns ex. The function returns HUGE_VAL and errno is set to ERANGE if the value of ex is too large to be represented.
|
|
|