Title: How to monitor SIGHUP in QNX 4.xx
Keywords: How to monitor SIGHUP in QNX 4.xx
Date: March 19, 1997
KDB: KDB-172
Revision: 0.00
Author: Support
Distribution: External
Please refer to the signal() function description in the QNX Watcom C Library Reference Manual.
This function, signal(), would be used in detecting when a SIGHUP occurs (carrier detect goes low due to a disconnection).
signal(SIGHUP, CleanUpAfterSighup);
When this occurs your custom handler (CleanUpAfterSighup) would do the housekeeping operations of closing any files that are open, and or go on, to monitor another incoming call.
Pseudo-code snippet:
#include
sig_atomic_t signal_count;
void CleanUpAfterSighup(int sig_number)
{
++signal_count;
}
void main()
{
signal(SIGHUP, CleanUpAfterSighup); /*set own handler to perform a clean up*/
/* …the rest of your application… */
}
Generally examples can be found at the following resources:
- quics, QSSL has lots of free source in the /usr/free area.
- You can also post a question on quics, or post to comp.os.qnx newsgroups.
End of KDB-172