X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=liblttng-ust-ctl%2Fustctl.c;h=041434bda666a524814749c5ee8390474e520d89;hb=4c41b460614826ada066a7e0c26a8b116336bab2;hp=0272d9b9331c6750c276993b14552bbeb6e565f2;hpb=a834901f2890deadb815d7f9e3ab79c3ba673994;p=lttng-ust.git diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index 0272d9b9..041434bd 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -1,19 +1,8 @@ /* - * Copyright (C) 2011 - Julien Desfossez - * Copyright (C) 2011-2013 - Mathieu Desnoyers + * SPDX-License-Identifier: GPL-2.0-only * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License only. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Copyright (C) 2011 Julien Desfossez + * Copyright (C) 2011-2013 Mathieu Desnoyers */ #include @@ -26,14 +15,16 @@ #include #include #include -#include #include + #include #include -#include +#include +#include "ust-compat.h" #include "../libringbuffer/backend.h" #include "../libringbuffer/frontend.h" +#include "../liblttng-ust/ust-events-internal.h" #include "../liblttng-ust/wait.h" #include "../liblttng-ust/lttng-rb-clients.h" #include "../liblttng-ust/clock.h" @@ -81,6 +72,7 @@ struct ustctl_counter_attr { uint32_t nr_dimensions; int64_t global_sum_step; struct ustctl_counter_dimension dimensions[USTCTL_COUNTER_ATTR_DIMENSION_MAX]; + bool coalesce_hits; }; /* @@ -2008,7 +2000,7 @@ int ustctl_get_instance_id(struct ustctl_consumer_stream *stream, return client_cb->instance_id(buf, handle, id); } -#ifdef LTTNG_UST_HAVE_PERF_EVENT +#ifdef HAVE_PERF_EVENT int ustctl_has_perf_counters(void) { @@ -2067,6 +2059,7 @@ int get_cred(int sock, } #elif defined(__FreeBSD__) #include +#include /* * Override application uid/gid with unix socket credentials. Use the @@ -2094,11 +2087,11 @@ int get_cred(int sock, } DBG("Unix socket peercred [ uid: %u, gid: %u ], " "application registered claiming [ pid: %d, ppid: %d, uid: %u, gid: %u ]", - xucred.uid, xucred.cr_groups[0], + xucred.cr_uid, xucred.cr_groups[0], reg_msg->pid, reg_msg->ppid, reg_msg->uid, reg_msg->gid); *pid = reg_msg->pid; *ppid = reg_msg->ppid; - *uid = xucred.uid; + *uid = xucred.cr_uid; *gid = xucred.cr_groups[0]; return 0; } @@ -2576,7 +2569,8 @@ struct ustctl_daemon_counter * const int *counter_cpu_fds, enum ustctl_counter_bitness bitness, enum ustctl_counter_arithmetic arithmetic, - uint32_t alloc_flags) + uint32_t alloc_flags, + bool coalesce_hits) { const char *transport_name; struct ustctl_daemon_counter *counter; @@ -2642,6 +2636,7 @@ struct ustctl_daemon_counter * counter->attr->arithmetic = arithmetic; counter->attr->nr_dimensions = nr_dimensions; counter->attr->global_sum_step = global_sum_step; + counter->attr->coalesce_hits = coalesce_hits; for (i = 0; i < nr_dimensions; i++) counter->attr->dimensions[i] = dimensions[i]; @@ -2697,6 +2692,7 @@ int ustctl_create_counter_data(struct ustctl_daemon_counter *counter, } counter_conf.number_dimensions = counter->attr->nr_dimensions; counter_conf.global_sum_step = counter->attr->global_sum_step; + counter_conf.coalesce_hits = counter->attr->coalesce_hits; for (i = 0; i < counter->attr->nr_dimensions; i++) { counter_conf.dimensions[i].size = counter->attr->dimensions[i].size; counter_conf.dimensions[i].underflow_index = counter->attr->dimensions[i].underflow_index; @@ -2930,8 +2926,8 @@ int ustctl_counter_clear(struct ustctl_daemon_counter *counter, static __attribute__((constructor)) void ustctl_init(void) { - init_usterr(); - lttng_ust_getenv_init(); /* Needs init_usterr() to be completed. */ + ust_err_init(); + lttng_ust_getenv_init(); /* Needs ust_err_init() to be completed. */ lttng_ust_clock_init(); lttng_ring_buffer_metadata_client_init(); lttng_ring_buffer_client_overwrite_init();