int ret;
struct fd_handle *handle = container_of(ref, struct fd_handle, ref);
- assert(handle->fd >= 0);
+ LTTNG_ASSERT(handle->fd >= 0);
ret = close(handle->fd);
if (ret == -1) {
PERROR("Failed to close file descriptor of fd_handle upon release: fd = %d",
LTTNG_HIDDEN
void fd_handle_get(struct fd_handle *handle)
{
- assert(handle);
+ if (!handle) {
+ return;
+ }
+
urcu_ref_get(&handle->ref);
}
LTTNG_HIDDEN
void fd_handle_put(struct fd_handle *handle)
{
- assert(handle);
+ if (!handle) {
+ return;
+ }
+
urcu_ref_put(&handle->ref, fd_handle_release);
}
LTTNG_HIDDEN
int fd_handle_get_fd(struct fd_handle *handle)
{
- assert(handle);
+ LTTNG_ASSERT(handle);
return handle->fd;
}