Duplicate an HA connection
#include <ha/unistd.h> int ha_dup(int oldfd);
libha
The ha_dup() function duplicates the HA-aware file descriptor specified by oldfd. The functionality of ha_dup() is similar to that of the standard dup() call, with the addition that the new file descriptor also shares the recovery mechanisms associated with oldfd.
Changing the recovery function for one file descriptor will automatically change the recovery function for the other as well.
Note that HA connections are also reference-counted across ha_dup() calls. This implies that when HA connections that have been dup()'d are closed, the recovery functions will continue to exist until the last reference to them has been closed.
The new file descriptor or -1 if an error occurred (errno is set).
In addition, the ha_dup() call returns any errors returned by the underlying dup() call.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
ha_attach(), ha_close(), ha_detach(), ha_open()
In the Library Reference: dup()