while ((ret = kernctl_create_stream(channel->fd)) >= 0) {
lks = trace_kernel_create_stream();
if (lks == NULL) {
- close(ret);
+ ret = close(ret);
+ if (ret) {
+ PERROR("close");
+ }
goto error;
}
*/
ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
{
- int fd, pos;
+ int fd, pos, ret;
char *event;
size_t nbmem, count = 0;
ssize_t size;
*events = elist;
DBG("Kernel list events done (%zu events)", count);
end:
- fclose(fp); /* closes both fp and fd */
+ ret = fclose(fp); /* closes both fp and fd */
+ if (ret) {
+ PERROR("fclose");
+ }
return count;
error_fp:
- close(fd);
+ ret = close(fd);
+ if (ret) {
+ PERROR("close");
+ }
error:
return -1;
}
/* Ignore error, we don't really care */
}
}
- fclose(fp);
+ ret = fclose(fp);
+ if (ret) {
+ PERROR("fclose");
+ }
end_boot_id:
-
return 0;
}
*/
void trace_kernel_destroy_stream(struct ltt_kernel_stream *stream)
{
+ int ret;
+
DBG("[trace] Closing stream fd %d", stream->fd);
/* Close kernel fd */
- close(stream->fd);
+ ret = close(stream->fd);
+ if (ret) {
+ PERROR("close");
+ }
/* Remove from stream list */
cds_list_del(&stream->list);
*/
void trace_kernel_destroy_event(struct ltt_kernel_event *event)
{
+ int ret;
+
if (event->fd >= 0) {
DBG("[trace] Closing event fd %d", event->fd);
/* Close kernel fd */
- close(event->fd);
+ ret = close(event->fd);
+ if (ret) {
+ PERROR("close");
+ }
} else {
DBG("[trace] Tearing down event (no associated fd)");
}
{
struct ltt_kernel_stream *stream, *stmp;
struct ltt_kernel_event *event, *etmp;
+ int ret;
DBG("[trace] Closing channel fd %d", channel->fd);
/* Close kernel fd */
- close(channel->fd);
+ ret = close(channel->fd);
+ if (ret) {
+ PERROR("close");
+ }
/* For each stream in the channel list */
cds_list_for_each_entry_safe(stream, stmp, &channel->stream_list.head, list) {
*/
void trace_kernel_destroy_metadata(struct ltt_kernel_metadata *metadata)
{
+ int ret;
+
DBG("[trace] Closing metadata fd %d", metadata->fd);
/* Close kernel fd */
- close(metadata->fd);
+ ret = close(metadata->fd);
+ if (ret) {
+ PERROR("close");
+ }
free(metadata->conf);
free(metadata->pathname);
void trace_kernel_destroy_session(struct ltt_kernel_session *session)
{
struct ltt_kernel_channel *channel, *ctmp;
+ int ret;
DBG("[trace] Closing session fd %d", session->fd);
/* Close kernel fds */
- close(session->fd);
+ ret = close(session->fd);
+ if (ret) {
+ PERROR("close");
+ }
if (session->metadata_stream_fd != 0) {
DBG("[trace] Closing metadata stream fd %d", session->metadata_stream_fd);
- close(session->metadata_stream_fd);
+ ret = close(session->metadata_stream_fd);
+ if (ret) {
+ PERROR("close");
+ }
}
if (session->metadata != NULL) {
* closing this socket, otherwise an application could re-use the socket ID
* and race with the teardown, using the same hash table entry.
*/
- close(sock);
+ ret = close(sock);
+ if (ret) {
+ PERROR("close");
+ }
DBG2("UST app pid %d deleted", app->key.pid);
free(app);
int ust_app_register(struct ust_register_msg *msg, int sock)
{
struct ust_app *lta;
+ int ret;
if ((msg->bits_per_long == 64 && ust_consumerd64_fd == -EINVAL)
|| (msg->bits_per_long == 32 && ust_consumerd32_fd == -EINVAL)) {
ERR("Registration failed: application \"%s\" (pid: %d) has "
"%d-bit long, but no consumerd for this long size is available.\n",
msg->name, msg->pid, msg->bits_per_long);
- close(sock);
+ ret = close(sock);
+ if (ret) {
+ PERROR("close");
+ }
return -EINVAL;
}
if (msg->major != LTTNG_UST_COMM_MAJOR) {
ERR("Registration failed: application \"%s\" (pid: %d) has "
"communication protocol version %u.%u, but sessiond supports 2.x.\n",
msg->name, msg->pid, msg->major, msg->minor);
- close(sock);
+ ret = close(sock);
+ if (ret) {
+ PERROR("close");
+ }
return -EINVAL;
}
lta = zmalloc(sizeof(struct ust_app));