libdill: Structured Concurrency for C

NAME

hdup - duplicates a handle

SYNOPSIS

#include <libdill.h>

int hdup(int h);

DESCRIPTION

Duplicates a handle. The new handle will refer to the same underlying object.

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.

RETURN VALUE

Returns the new handle duplicate on success. On error, -1 is returned and errno is set to one of the following values.

ERRORS

EXAMPLE

int ch1 = chmake(sizeof(int));
int ch2 = hdup(ch1);
hclose(ch2);
hclose(ch1);