summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
178a055)
PERROR prints the perror() message in our own logging format rather
than going straight to stderr.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
15 files changed:
* Add --socket option if no HOME found (sessiond)
* Use realloc() in ask_sessiond() (liblttngctl)
* Add --socket option if no HOME found (sessiond)
* Use realloc() in ask_sessiond() (liblttngctl)
-* perror() --> PERROR() (everywhere in the code)
* Add a command to "lttng" to consume data when the tracer is in flightrecorder mode
* Fix error handling for UST support when enabling events on all applications.
* Support for UST remaining domains (PID, EXEC_NAME, FOLLOW_CHILDREN).
* Add a command to "lttng" to consume data when the tracer is in flightrecorder mode
* Fix error handling for UST support when enabling events on all applications.
* Support for UST remaining domains (PID, EXEC_NAME, FOLLOW_CHILDREN).
#include <errno.h>
#include <stdio.h>
#include "fd-limit.h"
#include <errno.h>
#include <stdio.h>
#include "fd-limit.h"
+#include <common/error.h>
/* total count of fd. */
static long fd_count;
/* total count of fd. */
static long fd_count;
ret = getrlimit(RLIMIT_NOFILE, &rlim);
if (ret < 0) {
ret = getrlimit(RLIMIT_NOFILE, &rlim);
if (ret < 0) {
}
max_nr_fd = rlim.rlim_cur;
}
}
max_nr_fd = rlim.rlim_cur;
}
}
tracing_group_name = strdup(arg);
if (!tracing_group_name) {
}
tracing_group_name = strdup(arg);
if (!tracing_group_name) {
ret = -ENOMEM;
}
tracing_group_name_override = 1;
ret = -ENOMEM;
}
tracing_group_name_override = 1;
}
consumerd32_bin = strdup(arg);
if (!consumerd32_bin) {
}
consumerd32_bin = strdup(arg);
if (!consumerd32_bin) {
ret = -ENOMEM;
}
consumerd32_bin_override = 1;
ret = -ENOMEM;
}
consumerd32_bin_override = 1;
}
consumerd32_libdir = strdup(arg);
if (!consumerd32_libdir) {
}
consumerd32_libdir = strdup(arg);
if (!consumerd32_libdir) {
ret = -ENOMEM;
}
consumerd32_libdir_override = 1;
ret = -ENOMEM;
}
consumerd32_libdir_override = 1;
}
consumerd64_bin = strdup(arg);
if (!consumerd64_bin) {
}
consumerd64_bin = strdup(arg);
if (!consumerd64_bin) {
ret = -ENOMEM;
}
consumerd64_bin_override = 1;
ret = -ENOMEM;
}
consumerd64_bin_override = 1;
}
consumerd64_libdir = strdup(arg);
if (!consumerd64_libdir) {
}
consumerd64_libdir = strdup(arg);
if (!consumerd64_libdir) {
ret = -ENOMEM;
}
consumerd64_libdir_override = 1;
ret = -ENOMEM;
}
consumerd64_libdir_override = 1;
free(opt_pidfile);
opt_pidfile = strdup(arg);
if (!opt_pidfile) {
free(opt_pidfile);
opt_pidfile = strdup(arg);
if (!opt_pidfile) {
free(opt_load_session_path);
opt_load_session_path = strdup(arg);
if (!opt_load_session_path) {
free(opt_load_session_path);
opt_load_session_path = strdup(arg);
if (!opt_load_session_path) {
free(kmod_probes_list);
kmod_probes_list = strdup(arg);
if (!kmod_probes_list) {
free(kmod_probes_list);
kmod_probes_list = strdup(arg);
if (!kmod_probes_list) {
free(kmod_extra_probes_list);
kmod_extra_probes_list = strdup(arg);
if (!kmod_extra_probes_list) {
free(kmod_extra_probes_list);
kmod_extra_probes_list = strdup(arg);
if (!kmod_extra_probes_list) {
type = zmalloc(sizeof(struct ctx_type));
if (type == NULL) {
type = zmalloc(sizeof(struct ctx_type));
if (type == NULL) {
- perror("malloc ctx_type");
+ PERROR("malloc ctx_type");
ret = CMD_FATAL;
goto end;
}
ret = CMD_FATAL;
goto end;
}
/* Caller must free() *cmdline */
cmdline = zmalloc(PATH_MAX);
if (!cmdline) {
/* Caller must free() *cmdline */
cmdline = zmalloc(PATH_MAX);
if (!cmdline) {
- perror("malloc cmdline");
+ PERROR("malloc cmdline");
goto end;
}
ret = fread(cmdline, 1, PATH_MAX, fp);
if (ret < 0) {
goto end;
}
ret = fread(cmdline, 1, PATH_MAX, fp);
if (ret < 0) {
- perror("fread proc list");
+ PERROR("fread proc list");
ret = gethostname(hostname, sizeof(hostname));
if (ret < 0) {
ret = gethostname(hostname, sizeof(hostname));
if (ret < 0) {
goto error;
}
ret = asprintf(&path, "net://localhost/host/%s/%s", hostname,
session_name);
if (ret < 0) {
goto error;
}
ret = asprintf(&path, "net://localhost/host/%s/%s", hostname,
session_name);
if (ret < 0) {
- perror("asprintf live path");
+ PERROR("asprintf live path");
DBG("Removing %s\n", config_path);
ret = remove(config_path);
if (ret < 0) {
DBG("Removing %s\n", config_path);
ret = remove(config_path);
if (ret < 0) {
- perror("remove config file");
+ PERROR("remove config file");
}
end:
free(config_path);
}
end:
free(config_path);
sigset_t sigset;
if ((ret = sigemptyset(&sigset)) < 0) {
sigset_t sigset;
if ((ret = sigemptyset(&sigset)) < 0) {
sa.sa_mask = sigset;
sa.sa_flags = 0;
if ((ret = sigaction(SIGUSR1, &sa, NULL)) < 0) {
sa.sa_mask = sigset;
sa.sa_flags = 0;
if ((ret = sigaction(SIGUSR1, &sa, NULL)) < 0) {
goto end;
}
if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
goto end;
}
if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
goto end;
}
if ((ret = sigaction(SIGCHLD, &sa, NULL)) < 0) {
goto end;
}
if ((ret = sigaction(SIGCHLD, &sa, NULL)) < 0) {
if (errno == ENOENT) {
ERR("No session daemon found. Use --sessiond-path.");
} else {
if (errno == ENOENT) {
ERR("No session daemon found. Use --sessiond-path.");
} else {
}
kill(getppid(), SIGTERM); /* wake parent */
exit(EXIT_FAILURE);
}
kill(getppid(), SIGTERM); /* wake parent */
exit(EXIT_FAILURE);
if (errno == ENOENT) {
ERR("No relayd found. Use --relayd-path.");
} else {
if (errno == ENOENT) {
ERR("No relayd found. Use --relayd-path.");
} else {
}
kill(getppid(), SIGTERM); /* wake parent */
exit(EXIT_FAILURE);
} else if (pid > 0) {
goto end;
} else {
}
kill(getppid(), SIGTERM); /* wake parent */
exit(EXIT_FAILURE);
} else if (pid > 0) {
goto end;
} else {
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) {
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) {
- perror("socket check relayd");
+ PERROR("socket check relayd");
ret = -1;
goto error_socket;
}
ret = -1;
goto error_socket;
}
sin.sin_port = htons(DEFAULT_NETWORK_VIEWER_PORT);
ret = inet_pton(sin.sin_family, "127.0.0.1", &sin.sin_addr);
if (ret < 1) {
sin.sin_port = htons(DEFAULT_NETWORK_VIEWER_PORT);
ret = inet_pton(sin.sin_family, "127.0.0.1", &sin.sin_addr);
if (ret < 1) {
- perror("inet_pton check relayd");
+ PERROR("inet_pton check relayd");
error:
if (close(fd) < 0) {
error:
if (close(fd) < 0) {
- perror("close relayd fd");
+ PERROR("close relayd fd");
}
error_socket:
return ret;
}
error_socket:
return ret;
/* This *must* be freed by using lttng_poll_free() */
wait->events = zmalloc(size * sizeof(struct pollfd));
if (wait->events == NULL) {
/* This *must* be freed by using lttng_poll_free() */
wait->events = zmalloc(size * sizeof(struct pollfd));
if (wait->events == NULL) {
- perror("zmalloc struct pollfd");
+ PERROR("zmalloc struct pollfd");
current->events = zmalloc(size * sizeof(struct pollfd));
if (current->events == NULL) {
current->events = zmalloc(size * sizeof(struct pollfd));
if (current->events == NULL) {
- perror("zmalloc struct current pollfd");
+ PERROR("zmalloc struct current pollfd");
ret = poll(events->wait.events, events->wait.nb_fd, timeout);
if (ret < 0) {
/* At this point, every error is fatal */
ret = poll(events->wait.events, events->wait.nb_fd, timeout);
if (ret < 0) {
/* At this point, every error is fatal */
ret = getrlimit(RLIMIT_NOFILE, &lim);
if (ret < 0) {
ret = getrlimit(RLIMIT_NOFILE, &lim);
if (ret < 0) {
- perror("getrlimit poll RLIMIT_NOFILE");
+ PERROR("getrlimit poll RLIMIT_NOFILE");
if (events->epfd >= 0) {
ret = close(events->epfd);
if (ret) {
if (events->epfd >= 0) {
ret = close(events->epfd);
if (ret) {
ret = lttng_write(fd, (void *) &hdr, sizeof(hdr));
if (ret < sizeof(hdr)) {
/*
ret = lttng_write(fd, (void *) &hdr, sizeof(hdr));
if (ret < sizeof(hdr)) {
/*
- * This error means that the fd's end is closed so ignore the perror
+ * This error means that the fd's end is closed so ignore the PERROR
* not to clubber the error output since this can happen in a normal
* code path.
*/
* not to clubber the error output since this can happen in a normal
* code path.
*/
}
ret = fseek(fp, 0L, SEEK_SET);
if (ret < 0) {
}
ret = fseek(fp, 0L, SEEK_SET);
if (ret < 0) {
goto error_close;
}
/* We keep the handle open, but can unlink the file on the VFS. */
ret = unlink(tmpname);
if (ret < 0) {
goto error_close;
}
/* We keep the handle open, but can unlink the file on the VFS. */
ret = unlink(tmpname);
if (ret < 0) {
}
return fp;
error_close:
ret = fclose(fp);
if (ret < 0) {
}
return fp;
error_close:
ret = fclose(fp);
if (ret < 0) {
}
error_unlink:
ret = unlink(tmpname);
if (ret < 0) {
}
error_unlink:
ret = unlink(tmpname);
if (ret < 0) {
*/
ret = unlink(tmpname);
if (ret < 0) {
*/
ret = unlink(tmpname);
if (ret < 0) {
}
return fp;
error_unlink:
ret = unlink(tmpname);
if (ret < 0) {
}
return fp;
error_unlink:
ret = unlink(tmpname);
if (ret < 0) {
ret = fflush(fp);
if (ret < 0) {
ret = fflush(fp);
if (ret < 0) {
return ret;
}
ret = fseek(fp, 0L, SEEK_END);
if (ret < 0) {
return ret;
}
ret = fseek(fp, 0L, SEEK_END);
if (ret < 0) {
return ret;
}
pos = ftell(fp);
if (ret < 0) {
return ret;
}
pos = ftell(fp);
if (ret < 0) {
return ret;
}
*size = pos;
return ret;
}
*size = pos;
}
ret = fseek(fp, 0L, SEEK_SET);
if (ret < 0) {
}
ret = fseek(fp, 0L, SEEK_SET);
if (ret < 0) {
goto error_free;
}
/* Copy the entire file into the buffer */
goto error_free;
}
/* Copy the entire file into the buffer */
}
ret = fclose(fp);
if (ret < 0) {
}
ret = fclose(fp);
if (ret < 0) {
error_close:
ret = fclose(fp);
if (ret < 0) {
error_close:
ret = fclose(fp);
if (ret < 0) {
}
error_free:
free(*buf);
}
error_free:
free(*buf);
/* Get number of supplementary group IDs */
grp_list_size = getgroups(0, NULL);
if (grp_list_size < 0) {
/* Get number of supplementary group IDs */
grp_list_size = getgroups(0, NULL);
if (grp_list_size < 0) {
goto end;
}
/* Alloc group list of the right size */
grp_list = zmalloc(grp_list_size * sizeof(gid_t));
if (!grp_list) {
goto end;
}
/* Alloc group list of the right size */
grp_list = zmalloc(grp_list_size * sizeof(gid_t));
if (!grp_list) {
goto end;
}
grp_id = getgroups(grp_list_size, grp_list);
if (grp_id < 0) {
goto end;
}
grp_id = getgroups(grp_list_size, grp_list);
if (grp_id < 0) {
ret = lttcomm_close_unix_sock(ret);
if (ret < 0) {
ret = lttcomm_close_unix_sock(ret);
if (ret < 0) {
- perror("lttcomm_close_unix_sock");
+ PERROR("lttcomm_close_unix_sock");
/* No need to keep the memory stream. */
if (fclose(fmem) != 0) {
/* No need to keep the memory stream. */
if (fclose(fmem) != 0) {
filter_parser_ctx_free(ctx);
filter_alloc_error:
if (fclose(fmem) != 0) {
filter_parser_ctx_free(ctx);
filter_alloc_error:
if (fclose(fmem) != 0) {
}
if ((control_sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
}
if ((control_sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
if (connect(control_sock, (struct sockaddr *) &server_addr,
sizeof(struct sockaddr)) == -1) {
if (connect(control_sock, (struct sockaddr *) &server_addr,
sizeof(struct sockaddr)) == -1) {
data = zmalloc(len);
if (!data) {
data = zmalloc(len);
if (!data) {
- perror("relay data zmalloc");
+ PERROR("relay data zmalloc");