projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement UST calibrate and change default
[lttng-tools.git]
/
src
/
bin
/
lttng
/
lttng.c
diff --git
a/src/bin/lttng/lttng.c
b/src/bin/lttng/lttng.c
index 65cea55a25e73a8698fd01c2846b4a405488916a..031b015efba4dd05da900b25a8d0c8ead4dfa7b7 100644
(file)
--- a/
src/bin/lttng/lttng.c
+++ b/
src/bin/lttng/lttng.c
@@
-22,14
+22,15
@@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#include <unistd.h>
#include <config.h>
#include <lttng/lttng.h>
#include <unistd.h>
#include <config.h>
#include <lttng/lttng.h>
-#include <common/
lttnger
r.h>
+#include <common/
erro
r.h>
-#include "cmd.h"
-#include "conf.h"
+#include "command.h"
/* Variables */
static char *progname;
/* Variables */
static char *progname;
@@
-38,6
+39,7
@@
int opt_quiet;
int opt_verbose;
static int opt_no_sessiond;
static char *opt_sessiond_path;
int opt_verbose;
static int opt_no_sessiond;
static char *opt_sessiond_path;
+static pid_t sessiond_pid;
enum {
OPT_SESSION_PATH,
enum {
OPT_SESSION_PATH,
@@
-169,17
+171,26
@@
static void clean_exit(int code)
*/
static void sighandler(int sig)
{
*/
static void sighandler(int sig)
{
+ int status;
+
switch (sig) {
case SIGTERM:
switch (sig) {
case SIGTERM:
- DBG("SIGTERM ca
tched
");
+ DBG("SIGTERM ca
ugth
");
clean_exit(EXIT_FAILURE);
break;
case SIGCHLD:
clean_exit(EXIT_FAILURE);
break;
case SIGCHLD:
+ DBG("SIGCHLD caugth");
+ waitpid(sessiond_pid, &status, 0);
+ /* Indicate that the session daemon died */
+ sessiond_pid = 0;
+ ERR("Session daemon died (exit status %d)", WEXITSTATUS(status));
+ break;
+ case SIGUSR1:
/* Notify is done */
/* Notify is done */
- DBG("SIG
CHLD catched
");
+ DBG("SIG
USR1 caugth
");
break;
default:
break;
default:
- DBG("Unknown signal %d ca
tched
", sig);
+ DBG("Unknown signal %d ca
ugth
", sig);
break;
}
break;
}
@@
-205,7
+216,7
@@
static int set_signal_handler(void)
sa.sa_handler = sighandler;
sa.sa_mask = sigset;
sa.sa_flags = 0;
sa.sa_handler = sighandler;
sa.sa_mask = sigset;
sa.sa_flags = 0;
- if ((ret = sigaction(SIG
CHLD
, &sa, NULL)) < 0) {
+ if ((ret = sigaction(SIG
USR1
, &sa, NULL)) < 0) {
perror("sigaction");
goto end;
}
perror("sigaction");
goto end;
}
@@
-215,6
+226,11
@@
static int set_signal_handler(void)
goto end;
}
goto end;
}
+ if ((ret = sigaction(SIGCHLD, &sa, NULL)) < 0) {
+ perror("sigaction");
+ goto end;
+ }
+
end:
return ret;
}
end:
return ret;
}
@@
-247,9
+263,6
@@
static int handle_command(int argc, char **argv)
case CMD_ERROR:
ERR("Command error");
break;
case CMD_ERROR:
ERR("Command error");
break;
- case CMD_NOT_IMPLEMENTED:
- ERR("Options not implemented");
- break;
case CMD_UNDEFINED:
ERR("Undefined command");
break;
case CMD_UNDEFINED:
ERR("Undefined command");
break;
@@
-297,8
+310,12
@@
static int spawn_sessiond(char *pathname)
kill(getppid(), SIGTERM); /* unpause parent */
exit(EXIT_FAILURE);
} else if (pid > 0) {
kill(getppid(), SIGTERM); /* unpause parent */
exit(EXIT_FAILURE);
} else if (pid > 0) {
+ sessiond_pid = pid;
/* Wait for lttng-sessiond to start */
pause();
/* Wait for lttng-sessiond to start */
pause();
+ if (!sessiond_pid) {
+ exit(EXIT_FAILURE);
+ }
goto end;
} else {
perror("fork");
goto end;
} else {
perror("fork");
This page took
0.025289 seconds
and
4
git commands to generate.