static int sigintcount = 0;
/* Argument variables */
-int opt_quiet;
-int opt_verbose;
+int lttng_opt_quiet; /* not static in error.h */
+int lttng_opt_verbose; /* not static in error.h */
static int opt_daemon;
static const char *progname;
static char command_sock_path[PATH_MAX]; /* Global command socket path */
usage(stdout);
exit(EXIT_SUCCESS);
case 'q':
- opt_quiet = 1;
+ lttng_opt_quiet = 1;
break;
case 'v':
- opt_verbose = 1;
+ lttng_opt_verbose = 1;
break;
case 'V':
fprintf(stdout, "%s\n", VERSION);
const char default_ust_sock_dir[] = DEFAULT_UST_SOCK_DIR;
const char default_global_apps_pipe[] = DEFAULT_GLOBAL_APPS_PIPE;
-/* Variables */
-int opt_verbose; /* Not static for lttngerr.h */
-int opt_verbose_consumer; /* Not static for lttngerr.h */
-int opt_quiet; /* Not static for lttngerr.h */
-
const char *progname;
const char *opt_tracing_group;
static int opt_sig_parent;
+static int opt_verbose_consumer;
static int opt_daemon;
static int opt_no_kernel;
static int is_root; /* Set to 1 if the daemon is running as root */
opt_no_kernel = 1;
break;
case 'q':
- opt_quiet = 1;
+ lttng_opt_quiet = 1;
break;
case 'v':
/* Verbose level can increase using multiple -v */
- opt_verbose += 1;
+ lttng_opt_verbose += 1;
break;
case 'Z':
opt_verbose_consumer += 1;
/* Variables */
static char *progname;
-
-int opt_quiet;
-int opt_verbose;
static int opt_no_sessiond;
static char *opt_sessiond_path;
static pid_t sessiond_pid;
ret = 0;
goto end;
case 'v':
- opt_verbose += 1;
+ lttng_opt_verbose += 1;
break;
case 'q':
- opt_quiet = 1;
+ lttng_opt_quiet = 1;
break;
case 'g':
lttng_set_tracing_group(optarg);
}
/* If both options are specified, quiet wins */
- if (opt_verbose && opt_quiet) {
- opt_verbose = 0;
+ if (lttng_opt_verbose && lttng_opt_quiet) {
+ lttng_opt_verbose = 0;
}
/* Spawn session daemon if needed */
#define XSTR(d) STR(d)
#define STR(s) #s
-extern int opt_quiet;
-extern int opt_verbose;
+extern int lttng_opt_quiet;
+extern int lttng_opt_verbose;
#define PRINT_ERR 0x1
#define PRINT_WARN 0x2
/*
* Macro for printing message depending on command line option and verbosity.
*/
-#define __lttng_print(type, fmt, args...) \
- do { \
- if (opt_quiet == 0 && type == PRINT_MSG) { \
- fprintf(stdout, fmt, ## args); \
- } else if (opt_quiet == 0 && \
- (((type & PRINT_DBG) && opt_verbose == 1) || \
- ((type & (PRINT_DBG | PRINT_DBG2)) && \
- opt_verbose == 2) || \
- ((type & (PRINT_DBG | PRINT_DBG2 | PRINT_DBG3)) && \
- opt_verbose == 3))) { \
- fprintf(stderr, fmt, ## args); \
- } else if (opt_quiet == 0 && (type & (PRINT_WARN))) { \
- fprintf(stderr, fmt, ## args); \
- } else if (type & (PRINT_ERR | PRINT_BUG)) { \
- fprintf(stderr, fmt, ## args); \
- } \
+#define __lttng_print(type, fmt, args...) \
+ do { \
+ if (lttng_opt_quiet == 0 && type == PRINT_MSG) { \
+ fprintf(stdout, fmt, ## args); \
+ } else if (lttng_opt_quiet == 0 && \
+ (((type & PRINT_DBG) && lttng_opt_verbose == 1) || \
+ ((type & (PRINT_DBG | PRINT_DBG2)) && \
+ lttng_opt_verbose == 2) || \
+ ((type & (PRINT_DBG | PRINT_DBG2 | PRINT_DBG3)) && \
+ lttng_opt_verbose == 3))) { \
+ fprintf(stderr, fmt, ## args); \
+ } else if (lttng_opt_quiet == 0 && (type & (PRINT_WARN))) { \
+ fprintf(stderr, fmt, ## args); \
+ } else if (type & (PRINT_ERR | PRINT_BUG)) { \
+ fprintf(stderr, fmt, ## args); \
+ } \
} while (0);
#define MSG(fmt, args...) \
" [in %s() at " __FILE__ ":" XSTR(__LINE__) "]\n", ## args, __func__)
#if !defined(__linux__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE))
+
/*
* Version using XSI strerror_r.
*/
* Only warn about EPIPE when quiet mode is deactivated.
* We consider EPIPE as expected.
*/
- if (errno != EPIPE || !opt_quiet) {
+ if (errno != EPIPE || !lttng_opt_quiet) {
PERROR("sendmsg");
}
}
* Only warn about EPIPE when quiet mode is deactivated.
* We consider EPIPE as expected.
*/
- if (errno != EPIPE || !opt_quiet) {
+ if (errno != EPIPE || !lttng_opt_quiet) {
PERROR("sendmsg");
}
}
* Only warn about EPIPE when quiet mode is deactivated.
* We consider EPIPE as expected.
*/
- if (errno != EPIPE || !opt_quiet) {
+ if (errno != EPIPE || !lttng_opt_quiet) {
PERROR("sendmsg");
}
}
static char *tracing_group;
static int connected;
+/* Global */
+
+/*
+ * Those two variables are used by error.h to silent or control the verbosity of
+ * error message. They are global to the library so application linking with it
+ * are able to compile correctly and also control verbosity of the library.
+ *
+ * Note that it is *not* possible to silent ERR() and PERROR() macros.
+ */
+int lttng_opt_quiet;
+int lttng_opt_verbose;
+
/*
* Copy string from src to dst and enforce null terminated byte.
*/
#include "../utils.h"
-int opt_quiet = 0;
+int lttng_opt_quiet;
int main(int argc, char **argv)
{
#include "../utils.h"
-int opt_quiet = 0;
+int lttng_opt_quiet;
int main(int argc, char **argv)
{
#include "../utils.h"
-int opt_quiet = 0;
+int lttng_opt_quiet;
int main(int argc, char **argv)
{
#include "../utils.h"
-int opt_quiet = 0;
+int lttng_opt_quiet;
int main(int argc, char **argv)
{
#define RANDOM_STRING_LEN 11
/* For lttngerr.h */
-int opt_quiet = 1;
-int opt_verbose = 0;
+int lttng_opt_quiet = 1;
+int lttng_opt_verbose;
static const char alphanum[] =
"0123456789"
static struct ltt_session_list *session_list;
/* For lttngerr.h */
-int opt_quiet = 1;
-int opt_verbose = 0;
+int lttng_opt_quiet = 1;
+int lttng_opt_verbose = 0;
static const char alphanum[] =
"0123456789"
#define RANDOM_STRING_LEN 11
/* For lttngerr.h */
-int opt_quiet = 1;
-int opt_verbose = 0;
+int lttng_opt_quiet = 1;
+int lttng_opt_verbose;
static const char alphanum[] =
"0123456789"