hdup - duplicates a handle
#include <libdill.h> int hdup( int h);
Duplicates a handle. The new handle will refer to the same underlying object.
h: Handle to duplicate.
Each duplicate of a handle requires its own call to hclose. The underlying object is deallocated when all handles pointing to it have been closed.
In case of success the function returns newly duplicated handle. In case of error it returns -1 and sets errno to one of the values below.
int h1 = tcp_connect(&addr, deadline); h2 = hdup(h1); hclose(h1); hclose(h2); /* The socket gets deallocated here. */
hclose(3) hclose(3) hdone(3) hmake(3) hquery(3)