dnl extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL;
dnl ^
-Wno-incomplete-setjmp-declaration dnl
+ -Wdiscarded-qualifiers dnl
],
[WARN_CFLAGS],
[-Werror])
};
/* Variables */
-static char *progname,
- *opt_viewer_path = NULL,
- *opt_output_path = NULL;
+static const char *progname;
+static char *opt_viewer_path = NULL;
+static char *opt_output_path = NULL;
static char *input_path;
}
if (!opt_viewer_path) {
- opt_viewer_path = DEFAULT_VIEWER;
+ opt_viewer_path = (char *) DEFAULT_VIEWER;
}
/* No leftovers, or more than one input path, print usage and quit */
case LTTNG_CONSUMER64_UST:
{
if (config.consumerd64_lib_dir.value) {
- char *tmp;
+ const char *tmp;
size_t tmplen;
char *tmpnew;
case LTTNG_CONSUMER32_UST:
{
if (config.consumerd32_lib_dir.value) {
- char *tmp;
+ const char *tmp;
size_t tmplen;
char *tmpnew;
/* LTTng kernel tracer mandatory core modules list */
struct kern_modules_param kern_modules_control_core[] = {
- { "lttng-ring-buffer-client-discard" },
- { "lttng-ring-buffer-client-overwrite" },
- { "lttng-ring-buffer-metadata-client" },
- { "lttng-ring-buffer-client-mmap-discard" },
- { "lttng-ring-buffer-client-mmap-overwrite" },
- { "lttng-ring-buffer-metadata-mmap-client" },
+ { (char *) "lttng-ring-buffer-client-discard" },
+ { (char *) "lttng-ring-buffer-client-overwrite" },
+ { (char *) "lttng-ring-buffer-metadata-client" },
+ { (char *) "lttng-ring-buffer-client-mmap-discard" },
+ { (char *) "lttng-ring-buffer-client-mmap-overwrite" },
+ { (char *) "lttng-ring-buffer-metadata-mmap-client" },
};
/* LTTng kernel tracer probe modules list */
struct kern_modules_param kern_modules_probes_default[] = {
- { "lttng-probe-asoc" },
- { "lttng-probe-block" },
- { "lttng-probe-btrfs" },
- { "lttng-probe-compaction" },
- { "lttng-probe-ext3" },
- { "lttng-probe-ext4" },
- { "lttng-probe-gpio" },
- { "lttng-probe-i2c" },
- { "lttng-probe-irq" },
- { "lttng-probe-jbd" },
- { "lttng-probe-jbd2" },
- { "lttng-probe-kmem" },
- { "lttng-probe-kvm" },
- { "lttng-probe-kvm-x86" },
- { "lttng-probe-kvm-x86-mmu" },
- { "lttng-probe-lock" },
- { "lttng-probe-module" },
- { "lttng-probe-napi" },
- { "lttng-probe-net" },
- { "lttng-probe-power" },
- { "lttng-probe-preemptirq" },
- { "lttng-probe-printk" },
- { "lttng-probe-random" },
- { "lttng-probe-rcu" },
- { "lttng-probe-regmap" },
- { "lttng-probe-regulator" },
- { "lttng-probe-rpm" },
- { "lttng-probe-sched" },
- { "lttng-probe-scsi" },
- { "lttng-probe-signal" },
- { "lttng-probe-skb" },
- { "lttng-probe-sock" },
- { "lttng-probe-statedump" },
- { "lttng-probe-sunrpc" },
- { "lttng-probe-timer" },
- { "lttng-probe-udp" },
- { "lttng-probe-vmscan" },
- { "lttng-probe-v4l2" },
- { "lttng-probe-workqueue" },
- { "lttng-probe-writeback" },
- { "lttng-probe-x86-irq-vectors" },
- { "lttng-probe-x86-exceptions" },
+ { (char *) "lttng-probe-asoc" },
+ { (char *) "lttng-probe-block" },
+ { (char *) "lttng-probe-btrfs" },
+ { (char *) "lttng-probe-compaction" },
+ { (char *) "lttng-probe-ext3" },
+ { (char *) "lttng-probe-ext4" },
+ { (char *) "lttng-probe-gpio" },
+ { (char *) "lttng-probe-i2c" },
+ { (char *) "lttng-probe-irq" },
+ { (char *) "lttng-probe-jbd" },
+ { (char *) "lttng-probe-jbd2" },
+ { (char *) "lttng-probe-kmem" },
+ { (char *) "lttng-probe-kvm" },
+ { (char *) "lttng-probe-kvm-x86" },
+ { (char *) "lttng-probe-kvm-x86-mmu" },
+ { (char *) "lttng-probe-lock" },
+ { (char *) "lttng-probe-module" },
+ { (char *) "lttng-probe-napi" },
+ { (char *) "lttng-probe-net" },
+ { (char *) "lttng-probe-power" },
+ { (char *) "lttng-probe-preemptirq" },
+ { (char *) "lttng-probe-printk" },
+ { (char *) "lttng-probe-random" },
+ { (char *) "lttng-probe-rcu" },
+ { (char *) "lttng-probe-regmap" },
+ { (char *) "lttng-probe-regulator" },
+ { (char *) "lttng-probe-rpm" },
+ { (char *) "lttng-probe-sched" },
+ { (char *) "lttng-probe-scsi" },
+ { (char *) "lttng-probe-signal" },
+ { (char *) "lttng-probe-skb" },
+ { (char *) "lttng-probe-sock" },
+ { (char *) "lttng-probe-statedump" },
+ { (char *) "lttng-probe-sunrpc" },
+ { (char *) "lttng-probe-timer" },
+ { (char *) "lttng-probe-udp" },
+ { (char *) "lttng-probe-vmscan" },
+ { (char *) "lttng-probe-v4l2" },
+ { (char *) "lttng-probe-workqueue" },
+ { (char *) "lttng-probe-writeback" },
+ { (char *) "lttng-probe-x86-irq-vectors" },
+ { (char *) "lttng-probe-x86-exceptions" },
};
/* dynamic probe modules list */
.daemonize = false,
.sig_parent = false,
- .tracing_group_name.value = DEFAULT_TRACING_GROUP,
+ .tracing_group_name.value = (char *) DEFAULT_TRACING_GROUP,
.kmod_probes_list.value = NULL,
.kmod_extra_probes_list.value = NULL,
* Alloc new UST app channel.
*/
static
-struct ust_app_channel *alloc_ust_app_channel(char *name,
+struct ust_app_channel *alloc_ust_app_channel(const char *name,
struct ust_app_session *ua_sess,
struct lttng_ust_channel_attr *attr)
{
*/
#define PERF_HW(optstr, name, type, hide) \
{ \
- optstr, type, hide, \
+ (char *) optstr, type, hide, \
.u.perf = { PERF_TYPE_HARDWARE, PERF_COUNT_HW_##name, },\
}
#define PERF_SW(optstr, name, type, hide) \
{ \
- optstr, type, hide, \
+ (char *) optstr, type, hide, \
.u.perf = { PERF_TYPE_SOFTWARE, PERF_COUNT_SW_##name, },\
}
#define _PERF_HW_CACHE(optstr, name, type, op, result, hide) \
{ \
- optstr, type, hide, \
+ (char *) optstr, type, hide, \
.u.perf = { \
PERF_TYPE_HW_CACHE, \
(uint64_t) PERF_COUNT_HW_CACHE_##name \
} app_ctx;
} u;
} ctx_opts[] = {
- { "pid", CONTEXT_PID },
- { "procname", CONTEXT_PROCNAME },
- { "prio", CONTEXT_PRIO },
- { "nice", CONTEXT_NICE },
- { "vpid", CONTEXT_VPID },
- { "tid", CONTEXT_TID },
- { "pthread_id", CONTEXT_PTHREAD_ID },
- { "vtid", CONTEXT_VTID },
- { "ppid", CONTEXT_PPID },
- { "vppid", CONTEXT_VPPID },
- { "hostname", CONTEXT_HOSTNAME },
- { "ip", CONTEXT_IP },
- { "interruptible", CONTEXT_INTERRUPTIBLE },
- { "preemptible", CONTEXT_PREEMPTIBLE },
- { "need_reschedule", CONTEXT_NEED_RESCHEDULE },
- { "migratable", CONTEXT_MIGRATABLE },
- { "callstack-kernel", CONTEXT_CALLSTACK_KERNEL },
+ /*
+ * These (char *) casts (as well as those in the PERF_* macros) are
+ * safe because we never free these instances of `struct ctx_opts`.
+ */
+ { (char *) "pid", CONTEXT_PID },
+ { (char *) "procname", CONTEXT_PROCNAME },
+ { (char *) "prio", CONTEXT_PRIO },
+ { (char *) "nice", CONTEXT_NICE },
+ { (char *) "vpid", CONTEXT_VPID },
+ { (char *) "tid", CONTEXT_TID },
+ { (char *) "pthread_id", CONTEXT_PTHREAD_ID },
+ { (char *) "vtid", CONTEXT_VTID },
+ { (char *) "ppid", CONTEXT_PPID },
+ { (char *) "vppid", CONTEXT_VPPID },
+ { (char *) "hostname", CONTEXT_HOSTNAME },
+ { (char *) "ip", CONTEXT_IP },
+ { (char *) "interruptible", CONTEXT_INTERRUPTIBLE },
+ { (char *) "preemptible", CONTEXT_PREEMPTIBLE },
+ { (char *) "need_reschedule", CONTEXT_NEED_RESCHEDULE },
+ { (char *) "migratable", CONTEXT_MIGRATABLE },
+ { (char *) "callstack-kernel", CONTEXT_CALLSTACK_KERNEL },
#if HAVE_MODULES_USERSPACE_CALLSTACK_CONTEXT
- { "callstack-user", CONTEXT_CALLSTACK_USER },
+ { (char *) "callstack-user", CONTEXT_CALLSTACK_USER },
#endif
- { "cgroup_ns", CONTEXT_CGROUP_NS },
- { "ipc_ns", CONTEXT_IPC_NS },
- { "mnt_ns", CONTEXT_MNT_NS },
- { "net_ns", CONTEXT_NET_NS },
- { "pid_ns", CONTEXT_PID_NS },
- { "user_ns", CONTEXT_USER_NS },
- { "uts_ns", CONTEXT_UTS_NS },
- { "uid", CONTEXT_UID },
- { "euid", CONTEXT_EUID },
- { "suid", CONTEXT_SUID },
- { "gid", CONTEXT_GID },
- { "egid", CONTEXT_EGID },
- { "sgid", CONTEXT_SGID },
- { "vuid", CONTEXT_VUID },
- { "veuid", CONTEXT_VEUID },
- { "vsuid", CONTEXT_VSUID },
- { "vgid", CONTEXT_VGID },
- { "vegid", CONTEXT_VEGID },
- { "vsgid", CONTEXT_VSGID },
+ { (char *) "cgroup_ns", CONTEXT_CGROUP_NS },
+ { (char *) "ipc_ns", CONTEXT_IPC_NS },
+ { (char *) "mnt_ns", CONTEXT_MNT_NS },
+ { (char *) "net_ns", CONTEXT_NET_NS },
+ { (char *) "pid_ns", CONTEXT_PID_NS },
+ { (char *) "user_ns", CONTEXT_USER_NS },
+ { (char *) "uts_ns", CONTEXT_UTS_NS },
+ { (char *) "uid", CONTEXT_UID },
+ { (char *) "euid", CONTEXT_EUID },
+ { (char *) "suid", CONTEXT_SUID },
+ { (char *) "gid", CONTEXT_GID },
+ { (char *) "egid", CONTEXT_EGID },
+ { (char *) "sgid", CONTEXT_SGID },
+ { (char *) "vuid", CONTEXT_VUID },
+ { (char *) "veuid", CONTEXT_VEUID },
+ { (char *) "vsuid", CONTEXT_VSUID },
+ { (char *) "vgid", CONTEXT_VGID },
+ { (char *) "vegid", CONTEXT_VEGID },
+ { (char *) "vsgid", CONTEXT_VSGID },
/* Perf options */
*
* Spawn a session daemon by forking and execv.
*/
-static int spawn_sessiond(char *pathname)
+static int spawn_sessiond(const char *pathname)
{
int ret = 0;
pid_t pid;
static int launch_sessiond(void)
{
int ret;
- char *pathname = NULL;
+ const char *pathname = NULL;
ret = lttng_session_daemon_alive();
if (ret) {
* enabled is 0 or 1
* success is 0 or 1
*/
-static int mi_print_event(char *event_name, int enabled, int success)
+static int mi_print_event(const char *event_name, int enabled, int success)
{
int ret;
ret = cmd_func(handle, tracker_type, item);
if (ret) {
- char *msg = NULL;
+ const char *msg = NULL;
switch (-ret) {
case LTTNG_ERR_ID_TRACKED:
memcpy(argv, opts, sizeof(char *) * opts_len);
if (session_live_mode) {
- argv[opts_len] = "-i";
- argv[opts_len + 1] = "lttng-live";
+ argv[opts_len] = (char *) "-i";
+ argv[opts_len + 1] = (char *) "lttng-live";
argv[opts_len + 2] = (char *) trace_path;
argv[opts_len + 3] = NULL;
} else {
int config_add_session_name(const char *path, const char *name)
{
int ret;
- char *attr = "session=";
+ const char *attr = "session=";
/* Max name len accepted plus attribute's len and the NULL byte. */
char session_name[NAME_MAX + strlen(attr) + 1];
;
/* Variables */
-static char *progname;
+static const char *progname;
int opt_no_sessiond;
char *opt_sessiond_path;
char *curr_sym_str = NULL;
char *symbol_table_data = NULL;
char *string_table_data = NULL;
- char *string_table_name = NULL;
+ const char *string_table_name = NULL;
struct lttng_elf_shdr symtab_hdr;
struct lttng_elf_shdr strtab_hdr;
struct lttng_elf *elf = NULL;
int ret;
struct lttcomm_relayd_status_stream reply;
char pathname[RELAYD_COMM_LTTNG_PATH_MAX];
- char *separator;
+ const char *separator;
/* Code flow error. Safety net. */
assert(rsock);
enum ast_link_type post_op; /* reverse */
enum ast_link_type pre_op; /* forward */
union {
- char *string;
+ const char *string;
uint64_t constant;
double float_constant;
- char *identifier;
+ const char *identifier;
/*
* child can be nested.
*/
}
static
-struct ir_op *make_op_load_string(char *string, enum ir_side side)
+struct ir_op *make_op_load_string(const char *string, enum ir_side side)
{
struct ir_op *op;
{
struct ir_load_expression *load_exp;
struct ir_load_expression_op *load_exp_op, *prev_op;
- char *str;
+ const char *str;
/* Get forward chain. */
node = load_expression_get_forward_chain(node);
/* Add loglevel filtering if any for the JUL domain. */
if (ev->loglevel_type != LTTNG_EVENT_LOGLEVEL_ALL) {
- char *op;
+ const char *op;
if (ev->loglevel_type == LTTNG_EVENT_LOGLEVEL_RANGE) {
op = ">=";
}
static
-int connect_viewer(char *hostname)
+int connect_viewer(const char *hostname)
{
struct hostent *host;
struct sockaddr_in server_addr;
return 1;
}
if (result == 0) {
- char *args[] = { "fork2", NULL };
+ char *args[] = { (char *) "fork2", NULL };
tracepoint(ust_tests_fork, after_fork_child, getpid());
#include <lttng/tracepoint.h>
TRACEPOINT_EVENT(tp, slow,
- TP_ARGS(unsigned int, c, char *, thread_name),
+ TP_ARGS(unsigned int, c, const char *, thread_name),
TP_FIELDS(
ctf_integer(unsigned int, counter, c)
ctf_string(th_name, thread_name)
#define NUM_TESTS_PER_TEST 1
struct test {
- char *stream_path;
- char *session_name;
- char *hostname;
- char *creation_time;
- char *extra_path;
- char *leftover;
+ const char *stream_path;
+ const char *session_name;
+ const char *hostname;
+ const char *creation_time;
+ const char *extra_path;
+ const char *leftover;
bool is_valid;
};
/*
* Return 0 if session name is found, else -1
*/
-static int find_session_name(char *name)
+static int find_session_name(const char *name)
{
struct ltt_session *iter;
/*
* Test creation of 1 session
*/
-static int create_one_session(char *name)
+static int create_one_session(const char *name)
{
int ret;
enum lttng_error_code ret_code;
int lttng_opt_mi;
struct valid_test_input {
- char *input;
- char *relative_part;
- char *absolute_part;
+ const char *input;
+ const char *relative_part;
+ const char *absolute_part;
};
struct tree_symlink {
- char *orig;
- char *dest;
+ const char *orig;
+ const char *dest;
};
struct symlink_test_input {
- char *input;
- char *expected_result;
+ const char *input;
+ const char *expected_result;
};
/* Valid test cases */
int lttng_opt_mi;
struct valid_test_input {
- char *input;
+ const char *input;
uint64_t expected_result;
};
static const int num_valid_tests = sizeof(valid_tests_inputs) / sizeof(valid_tests_inputs[0]);
/* Invalid test cases */
-static char *invalid_tests_inputs[] = {
+static const char *invalid_tests_inputs[] = {
"",
" ",
"-1",
int lttng_opt_mi;
struct valid_test_input {
- char *input;
+ const char *input;
uint64_t expected_result;
};
static const int num_valid_tests = sizeof(valid_tests_inputs) / sizeof(valid_tests_inputs[0]);
/* Invalid test cases */
-static char *invalid_tests_inputs[] = {
+static const char *invalid_tests_inputs[] = {
"",
" ",
"-1",
static unsigned int e_tests = 0; /* Expected number of tests to run */
static unsigned int failures = 0; /* Number of tests that failed */
static char *todo_msg = NULL;
-static char *todo_msg_fixed = "libtap malloc issue";
+static const char *todo_msg_fixed = "libtap malloc issue";
static int todo = 0;
static int test_died = 0;
* test_comment -- a comment to print afterwards, may be NULL
*/
unsigned int
-_gen_result(int ok, const char *func, char *file, unsigned int line,
- char *test_name, ...)
+_gen_result(int ok, const char *func, const char *file, unsigned int line,
+ const char *test_name, ...)
{
va_list ap;
char *local_test_name = NULL;
}
unsigned int
-diag(char *fmt, ...)
+diag(const char *fmt, ...)
{
va_list ap;
}
int
-skip(unsigned int n, char *fmt, ...)
+skip(unsigned int n, const char *fmt, ...)
{
va_list ap;
char *skip_msg = NULL;
#define skip_end() } while(0);
-unsigned int _gen_result(int, const char *, char *, unsigned int, char *, ...);
+unsigned int _gen_result(int, const char *, const char *, unsigned int, const char *, ...);
int plan_no_plan(void);
int plan_skip_all(char *);
int plan_tests(unsigned int);
-unsigned int diag(char *, ...);
+unsigned int diag(const char *, ...);
-int skip(unsigned int, char *, ...);
+int skip(unsigned int, const char *, ...);
void todo_start(char *, ...);
void todo_end(void);