#include "ust-app.h"
#include "ust-consumer.h"
#include "ust-ctl.h"
+#include "fd-limit.h"
/*
* Delete ust context safely. RCU read lock must be held before calling
{
if (stream->obj) {
ustctl_release_object(sock, stream->obj);
+ lttng_fd_put(LTTNG_FD_APPS, 2);
free(stream->obj);
}
free(stream);
if (ua_chan->obj != NULL) {
ustctl_release_object(sock, ua_chan->obj);
+ lttng_fd_put(LTTNG_FD_APPS, 2);
free(ua_chan->obj);
}
free(ua_chan);
if (ua_sess->metadata) {
if (ua_sess->metadata->stream_obj) {
ustctl_release_object(sock, ua_sess->metadata->stream_obj);
+ lttng_fd_put(LTTNG_FD_APPS, 2);
free(ua_sess->metadata->stream_obj);
}
if (ua_sess->metadata->obj) {
ustctl_release_object(sock, ua_sess->metadata->obj);
+ lttng_fd_put(LTTNG_FD_APPS, 2);
free(ua_sess->metadata->obj);
}
+ trace_ust_destroy_metadata(ua_sess->metadata);
}
cds_lfht_for_each_entry(ua_sess->channels->ht, &iter.iter, ua_chan,
if (ret) {
PERROR("close");
}
+ lttng_fd_put(LTTNG_FD_APPS, 1);
DBG2("UST app pid %d deleted", app->pid);
free(app);
ua_sess->metadata->attr.read_timer_interval;
uattr.output = ua_sess->metadata->attr.output;
+ /* We are going to receive 2 fds, we need to reserve them. */
+ ret = lttng_fd_get(LTTNG_FD_APPS, 2);
+ if (ret < 0) {
+ ERR("Exhausted number of available FD upon metadata open");
+ goto error;
+ }
/* UST tracer metadata creation */
ret = ustctl_open_metadata(app->sock, ua_sess->handle, &uattr,
&ua_sess->metadata->obj);
{
int ret;
+ /* We are going to receive 2 fds, we need to reserve them. */
+ ret = lttng_fd_get(LTTNG_FD_APPS, 2);
+ if (ret < 0) {
+ ERR("Exhausted number of available FD upon metadata stream create");
+ goto error;
+ }
ret = ustctl_create_stream(app->sock, ua_sess->metadata->obj,
&ua_sess->metadata->stream_obj);
if (ret < 0) {
int ret;
/* TODO: remove cast and use lttng-ust-abi.h */
+
+ /* We are going to receive 2 fds, we need to reserve them. */
+ ret = lttng_fd_get(LTTNG_FD_APPS, 2);
+ if (ret < 0) {
+ ERR("Exhausted number of available FD upon create channel");
+ goto error;
+ }
ret = ustctl_create_channel(app->sock, ua_sess->handle,
(struct lttng_ust_channel_attr *)&ua_chan->attr, &ua_chan->obj);
if (ret < 0) {
"and session handle %d with ret %d",
ua_chan->name, app->pid, app->sock,
ua_sess->handle, ret);
+ lttng_fd_put(LTTNG_FD_APPS, 2);
goto error;
}
if (ret) {
PERROR("close");
}
+ lttng_fd_put(LTTNG_FD_APPS, 1);
return -EINVAL;
}
if (msg->major != LTTNG_UST_COMM_MAJOR) {
if (ret) {
PERROR("close");
}
+ lttng_fd_put(LTTNG_FD_APPS, 1);
return -EINVAL;
}
lta = zmalloc(sizeof(struct ust_app));
goto error_rcu_unlock;
}
+ /* We are going to receive 2 fds, we need to reserve them. */
+ ret = lttng_fd_get(LTTNG_FD_APPS, 2);
+ if (ret < 0) {
+ ERR("Exhausted number of available FD upon stream create");
+ free(ustream);
+ goto error_rcu_unlock;
+ }
ret = ustctl_create_stream(app->sock, ua_chan->obj,
&ustream->obj);
if (ret < 0) {
/* Got all streams */
+ lttng_fd_put(LTTNG_FD_APPS, 2);
+ free(ustream);
break;
}
ustream->handle = ustream->obj->handle;
ua_chan->streams.count++);
if (ret < 0) {
PERROR("asprintf UST create stream");
+ /*
+ * XXX what should we do here with the
+ * stream ?
+ */
continue;
}
DBG2("UST stream %d ready at %s", ua_chan->streams.count,