/* Variables */
int opt_verbose; /* Not static for lttngerr.h */
+int opt_verbose_kconsumerd; /* Not static for lttngerr.h */
int opt_quiet; /* Not static for lttngerr.h */
const char *progname;
/*
* Exec kconsumerd.
*/
- if (opt_verbose > 1) {
+ if (opt_verbose > 1 || opt_verbose_kconsumerd) {
verbosity = "--verbose";
} else {
verbosity = "--quiet";
fprintf(stderr, " -S, --sig-parent Send SIGCHLD to parent pid to notify readiness.\n");
fprintf(stderr, " -q, --quiet No output at all.\n");
fprintf(stderr, " -v, --verbose Verbose mode. Activate DBG() macro.\n");
+ fprintf(stderr, " --verbose-kconsumerd Verbose mode for kconsumerd. Activate DBG() macro.\n");
}
/*
{ "version", 0, 0, 'V' },
{ "quiet", 0, 0, 'q' },
{ "verbose", 0, 0, 'v' },
+ { "verbose-kconsumerd", 0, 0, 'Z' },
{ NULL, 0, 0, 0 }
};
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "dhqvVS" "a:c:g:s:E:C:", long_options, &option_index);
+ c = getopt_long(argc, argv, "dhqvVS" "a:c:g:s:E:C:Z", long_options, &option_index);
if (c == -1) {
break;
}
/* Verbose level can increase using multiple -v */
opt_verbose += 1;
break;
+ case 'Z':
+ opt_verbose_kconsumerd += 1;
+ break;
default:
/* Unknown option or other error.
* Error is printed by getopt, just return */
}
/*
- * Check if the global socket is available. If yes, error is returned.
+ * Check if the global socket is available, and if a daemon is answering
+ * at the other side. If yes, error is returned.
*/
static int check_existing_daemon(void)
{
int ret;
- ret = access(client_unix_sock_path, F_OK);
- if (ret == 0) {
- ret = access(apps_unix_sock_path, F_OK);
- }
-
- return ret;
+ if (access(client_unix_sock_path, F_OK) < 0 &&
+ access(apps_unix_sock_path, F_OK) < 0)
+ return 0;
+ /* Is there anybody out there ? */
+ if (lttng_session_daemon_alive())
+ return -EEXIST;
+ else
+ return 0;
}
/*
DBG("Application socket path %s", apps_unix_sock_path);
/*
- * See if daemon already exist. If any of the two socket needed by the
- * daemon are present, this test fails. However, if the daemon is killed
- * with a SIGKILL, those unix socket must be unlinked by hand.
+ * See if daemon already exist.
*/
- if ((ret = check_existing_daemon()) == 0) {
+ if ((ret = check_existing_daemon()) < 0) {
ERR("Already running daemon.\n");
/*
* We do not goto exit because we must not cleanup()