The sqlsignal() function
The sqlsignal() function enables or disables signal handling of the signals that the Informix® ESQL/C library handles.
Syntax
void sqlsignal(sigvalue, sigfunc_ptr, mode)
mint sigvalue;
void (*sigfunc_ptr) (void);
int mode;
- sigvalue
- The mint value of the particular signal that needs to be
trapped (as signal.h) defines).
Currently, this parameter is a placeholder for future functionality. Initialize this argument to
-1
. - sigfunc_ptr
- A pointer to the user-defined function, which takes no arguments,
to call as a signal handler for the sigvalue signal.
Currently, this parameter is a placeholder for future functionality. Initialize this argument to a null pointer to a function that receives no arguments.
- mode
- Can be one of three possible modes:
- 0
- Initializes signal handling.
- 1
- Disables signal handling.
- 2
- Re-enables signal handling.
Usage
The sqlsignal() function currently provides handling only for the SIGCHLD signal. In some instances, defunct child processes remain after the application ends. If the application does not clean up these processes, they can cause needless use of process IDs and increase the risk that you run out of processes. This behavior is only apparent when the application uses pipes for client-server communication (that is, the nettype field of the sqlhosts file is ipcpip). You do not need to call sqlsignal() for other communication mechanisms (for example, a nettype of tlipcp).
- Set mode to
0
to initialize signal handling.sqlsignal(-1, (void (*)(void))0, 0);
When you initialize signal handling with sqlsignal(), the Informix® ESQL/C library traps the SIGCHLD signal to handle the cleanup of defunct child processes. This initial call to sqlsignal() must occur at the beginning of your application, before the first SQL statement in the program. If you omit this initial call, you cannot turn on the signal-handling capability later in your program.
- Enable and disable signal handling. If you want to have the Informix® ESQL/C library perform signal handling for portions of the program and your own code perform signal handling for other portions, you can take the following actions:
- To disable signal handling, call sqlsignal() with mode set
to
1
, at the point where you want your program to handle signals:sqlsignal(-1, (void (*)(void))0, 1);
- To re-enable signal handling, call sqlsignal() with mode set
to
2
, at the point where you want the Informix® ESQL library to handle signals:sqlsignal(-1, (void (*)(void))0, 2);
When you initialize SIGCHLD signal handling with sqlsignal(), you allow the Informix® ESQL/C library to process SIGCHLD cleanup. Otherwise, your application must perform the cleanup for these processes if defunct child processes are a problem.
- To disable signal handling, call sqlsignal() with mode set
to