summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
af87c45)
Multiple fixes to comments in lttng and lttng-consumerd.
Adds --list-commands as an arguments to ignore when auto spawning the
session daemon from lttng cli.
Usage of the consumerd now output on a stream and usage is set to stdout
when asked with --help.
Signed-off-by: David Goulet <dgoulet@efficios.com>
#include "lttng-consumerd.h"
#include "lttng-consumerd.h"
-/* TODO : support UST (all direct kernctl accesses). */
+/* TODO : support UST (all direct kern-ctl accesses). */
/* the two threads (receive fd and poll) */
static pthread_t threads[2];
/* the two threads (receive fd and poll) */
static pthread_t threads[2];
-/* to count the number of time the user pressed ctrl+c */
+/* to count the number of times the user pressed ctrl+c */
static int sigintcount = 0;
/* Argument variables */
static int sigintcount = 0;
/* Argument variables */
- * usage function on stderr
+ * Usage function on stream file.
+static void usage(FILE *fp)
- fprintf(stderr, "Usage: %s OPTIONS\n\nOptions:\n", progname);
- fprintf(stderr, " -h, --help "
+ fprintf(fp, "Usage: %s OPTIONS\n\nOptions:\n", progname);
+ fprintf(fp, " -h, --help "
"Display this usage.\n");
"Display this usage.\n");
- fprintf(stderr, " -c, --consumerd-cmd-sock PATH "
+ fprintf(fp, " -c, --consumerd-cmd-sock PATH "
"Specify path for the command socket\n");
"Specify path for the command socket\n");
- fprintf(stderr, " -e, --consumerd-err-sock PATH "
+ fprintf(fp, " -e, --consumerd-err-sock PATH "
"Specify path for the error socket\n");
"Specify path for the error socket\n");
- fprintf(stderr, " -d, --daemonize "
+ fprintf(fp, " -d, --daemonize "
- fprintf(stderr, " -q, --quiet "
+ fprintf(fp, " -q, --quiet "
- fprintf(stderr, " -v, --verbose "
+ fprintf(fp, " -v, --verbose "
"Verbose mode. Activate DBG() macro.\n");
"Verbose mode. Activate DBG() macro.\n");
- fprintf(stderr, " -V, --version "
+ fprintf(fp, " -V, --version "
"Show version number.\n");
"Show version number.\n");
- fprintf(stderr, " -k, --kernel "
+ fprintf(fp, " -k, --kernel "
"Consumer kernel buffers (default).\n");
"Consumer kernel buffers (default).\n");
- fprintf(stderr, " -u, --ust "
+ fprintf(fp, " -u, --ust "
"Consumer UST buffers.%s\n",
#ifdef HAVE_LIBLTTNG_UST_CTL
""
"Consumer UST buffers.%s\n",
#ifdef HAVE_LIBLTTNG_UST_CTL
""
opt_daemon = 1;
break;
case 'h':
opt_daemon = 1;
break;
case 'h':
- usage();
- exit(EXIT_FAILURE);
+ usage(stdout);
+ exit(EXIT_SUCCESS);
case 'q':
opt_quiet = 1;
break;
case 'q':
opt_quiet = 1;
break;
ret = lttcomm_connect_unix_sock(error_sock_path);
/* not a fatal error, but all communication with lttng-sessiond will fail */
if (ret < 0) {
ret = lttcomm_connect_unix_sock(error_sock_path);
/* not a fatal error, but all communication with lttng-sessiond will fail */
if (ret < 0) {
- WARN("Cannot connect to error socket, is lttng-sessiond started ?");
+ WARN("Cannot connect to error socket (is lttng-sessiond started ?)");
}
lttng_consumer_set_error_sock(ctx, ret);
}
lttng_consumer_set_error_sock(ctx, ret);
if (opt_sessiond_path != NULL) {
ret = access(opt_sessiond_path, F_OK | X_OK);
if (ret < 0) {
if (opt_sessiond_path != NULL) {
ret = access(opt_sessiond_path, F_OK | X_OK);
if (ret < 0) {
- ERR("No such file: %s", opt_sessiond_path);
+ ERR("No such file or access denied: %s", opt_sessiond_path);
goto end;
}
pathname = opt_sessiond_path;
goto end;
}
pathname = opt_sessiond_path;
ret = spawn_sessiond(pathname);
free(alloc_pathname);
if (ret < 0) {
ret = spawn_sessiond(pathname);
free(alloc_pathname);
if (ret < 0) {
- ERR("Problem occurs when starting %s", pathname);
+ ERR("Problem occurred when starting %s", pathname);
for (i = 0; i < argc; i++) {
if ((strncmp(argv[i], "-h", sizeof("-h")) == 0) ||
strncmp(argv[i], "--h", sizeof("--h")) == 0 ||
for (i = 0; i < argc; i++) {
if ((strncmp(argv[i], "-h", sizeof("-h")) == 0) ||
strncmp(argv[i], "--h", sizeof("--h")) == 0 ||
- strncmp(argv[i], "--list-options", sizeof("--list-options")) == 0) {
+ strncmp(argv[i], "--list-options", sizeof("--list-options")) == 0 ||
+ strncmp(argv[i], "--list-commands", sizeof("--list-commands")) == 0) {
+ * Parse command line arguments.
- * Parse command line arguments.
- * Return 0 if OK, else -1
+ * Return 0 if OK, else -1
*/
static int parse_args(int argc, char **argv)
{
*/
static int parse_args(int argc, char **argv)
{
while ((opt = getopt_long(argc, argv, "+hnvqg:", long_options, NULL)) != -1) {
switch (opt) {
case 'h':
while ((opt = getopt_long(argc, argv, "+hnvqg:", long_options, NULL)) != -1) {
switch (opt) {
case 'h':
- usage(stderr);
- goto error;
+ usage(stdout);
+ goto end;
case 'v':
opt_verbose += 1;
break;
case 'v':
opt_verbose += 1;
break;
case OPT_DUMP_OPTIONS:
list_options(stdout);
ret = 0;
case OPT_DUMP_OPTIONS:
list_options(stdout);
ret = 0;
case OPT_DUMP_COMMANDS:
list_commands(stdout);
ret = 0;
case OPT_DUMP_COMMANDS:
list_commands(stdout);
ret = 0;
default:
usage(stderr);
goto error;
default:
usage(stderr);
goto error;
+ DBG2("Config file path found: %s", path);
DBG("Session name found: %s", session_name);
return session_name;
DBG("Session name found: %s", session_name);
return session_name;