X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttng-tracker-pid.c;h=747aec20f25aa60dc8dfc013006809dabca1b320;hb=59a49244b2cd0e06b15457a570ea7c5b3f0a5a53;hp=f8f0a51dcc1e738727286b69e28f343ac43476e1;hpb=e0130fabb0cbec05e19fcc7fe955fe9d8d8bc91e;p=lttng-modules.git diff --git a/lttng-tracker-pid.c b/lttng-tracker-pid.c index f8f0a51d..747aec20 100644 --- a/lttng-tracker-pid.c +++ b/lttng-tracker-pid.c @@ -1,23 +1,10 @@ -/* +/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) + * * lttng-tracker-pid.c * - * LTTng Process ID trackering. + * LTTng Process ID tracking. * * Copyright (C) 2014 Mathieu Desnoyers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; only - * version 2.1 of the License. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -25,12 +12,13 @@ #include #include #include -#include #include #include -#include "wrapper/tracepoint.h" -#include "lttng-events.h" +#include +#include +#include +#include /* * Hash table is allocated and freed when there are no possible @@ -42,10 +30,10 @@ * sessions_mutex across calls to create, destroy, add, and del * functions of this API. */ -struct lttng_pid_hash_node { - struct hlist_node hlist; - int pid; -}; +int lttng_pid_tracker_get_node_pid(const struct lttng_pid_hash_node *node) +{ + return node->pid; +} /* * Lookup performed from RCU read-side critical section (RCU sched), @@ -59,7 +47,7 @@ bool lttng_pid_tracker_lookup(struct lttng_pid_tracker *lpf, int pid) uint32_t hash = hash_32(pid, 32); head = &lpf->pid_hash[hash & (LTTNG_PID_TABLE_SIZE - 1)]; - hlist_for_each_entry_rcu_notrace(e, head, hlist) { + lttng_hlist_for_each_entry_rcu(e, head, hlist) { if (pid == e->pid) return 1; /* Found */ } @@ -77,7 +65,7 @@ int lttng_pid_tracker_add(struct lttng_pid_tracker *lpf, int pid) uint32_t hash = hash_32(pid, 32); head = &lpf->pid_hash[hash & (LTTNG_PID_TABLE_SIZE - 1)]; - hlist_for_each_entry(e, head, hlist) { + lttng_hlist_for_each_entry(e, head, hlist) { if (pid == e->pid) return -EEXIST; } @@ -127,7 +115,7 @@ int lttng_pid_tracker_del(struct lttng_pid_tracker *lpf, int pid) * No need of _safe iteration, because we stop traversal as soon * as we remove the entry. */ - hlist_for_each_entry(e, head, hlist) { + lttng_hlist_for_each_entry(e, head, hlist) { if (pid == e->pid) { pid_tracker_del_node_rcu(e); return 0; @@ -150,7 +138,7 @@ void lttng_pid_tracker_destroy(struct lttng_pid_tracker *lpf) struct lttng_pid_hash_node *e; struct hlist_node *tmp; - hlist_for_each_entry_safe(e, tmp, head, hlist) + lttng_hlist_for_each_entry_safe(e, tmp, head, hlist) pid_tracker_del_node(e); } kfree(lpf);