ha_dup()

Duplicate an HA connection

Synopsis:

#include <ha/unistd.h>
    
int ha_dup(int oldfd);

Library:

libha

Description:

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.

Returns:

The new file descriptor or -1 if an error occurred (errno is set).

Errors:

EBADF
The connection identified by oldfd isn't an HA-aware connection.
ENOMEM
Couldn't allocate memory for structures in the library to successfully duplicate the connection.

In addition, the ha_dup() call returns any errors returned by the underlying dup() call.

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

ha_attach(), ha_close(), ha_detach(), ha_open()

In the Library Reference: dup()