From nobody Wed Nov 27 08:30:40 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC1AE1C5798 for ; Fri, 11 Oct 2024 17:30:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667818; cv=none; b=OCRKQRIlVa2b5n50QU8wdGzDuLAa46ZO34yL4/TjKTgBE+ZuovRlgzbjxI6tAqGxAs9MUs9AZBELYLuish3OPc+Y9zw1yNrTGstbN1X/FVx2390shaVB7cL9QUtXUWdIdXM2ah/flZFsj0LxgTy71cWgzjsfEHOTGY+7Z42XAEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667818; c=relaxed/simple; bh=PT7qf5DjdBQGFg1ZvnN6DJYxZK7XLLXsABsgkG6VxQk=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=o77PTt+8uZP7xcyEDwXDz/j+bH9F+5jHvM6DnaY86E0Jo76X+0DO6VKrpCC2i3uKCBzHN7VNPyeiYu7vEw0MuckxIc2y1NSJY7ws1Kj/VNjD4YlGfSq+8k8WevLIUI8H5ultKURmi2pI2H/Sww12zKTcbwv67YI4bFYpwHC+RRQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 812D0C4CED1; Fri, 11 Oct 2024 17:30:18 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1szJTB-00000001U1I-01u4; Fri, 11 Oct 2024 13:30:29 -0400 Message-ID: <20241011173028.871391989@goodmis.org> User-Agent: quilt/0.68 Date: Fri, 11 Oct 2024 13:30:17 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Jan Stancek Subject: [for-next][PATCH 7/9] tools/rtla: fix collision with glibc sched_attr/sched_set_attr References: <20241011173010.441043942@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Jan Stancek glibc commit 21571ca0d703 ("Linux: Add the sched_setattr and sched_getattr functions") now also provides 'struct sched_attr' and sched_setattr() which collide with the ones from rtla. In file included from src/trace.c:11: src/utils.h:49:8: error: redefinition of =E2=80=98struct sched_attr=E2=80= =99 49 | struct sched_attr { | ^~~~~~~~~~ In file included from /usr/include/bits/sched.h:60, from /usr/include/sched.h:43, from /usr/include/tracefs/tracefs.h:10, from src/trace.c:4: /usr/include/linux/sched/types.h:98:8: note: originally defined here 98 | struct sched_attr { | ^~~~~~~~~~ Define 'struct sched_attr' conditionally, similar to what strace did: https://lore.kernel.org/all/20240930222913.3981407-1-raj.khem@gmail.com/ and rename rtla's version of sched_setattr() to avoid collision. Link: https://lore.kernel.org/8088f66a7a57c1b209cd8ae0ae7c336a7f8c930d.1728= 572865.git.jstancek@redhat.com Signed-off-by: Jan Stancek Signed-off-by: Steven Rostedt (Google) --- tools/tracing/rtla/src/utils.c | 4 ++-- tools/tracing/rtla/src/utils.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index 05b2b3fc005e..6fae234aaf36 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -229,7 +229,7 @@ long parse_ns_duration(char *val) =20 #define SCHED_DEADLINE 6 =20 -static inline int sched_setattr(pid_t pid, const struct sched_attr *attr, +static inline int syscall_sched_setattr(pid_t pid, const struct sched_attr= *attr, unsigned int flags) { return syscall(__NR_sched_setattr, pid, attr, flags); } @@ -239,7 +239,7 @@ int __set_sched_attr(int pid, struct sched_attr *attr) int flags =3D 0; int retval; =20 - retval =3D sched_setattr(pid, attr, flags); + retval =3D syscall_sched_setattr(pid, attr, flags); if (retval < 0) { err_msg("Failed to set sched attributes to the pid %d: %s\n", pid, strerror(errno)); diff --git a/tools/tracing/rtla/src/utils.h b/tools/tracing/rtla/src/utils.h index d44513e6c66a..99c9cf81bcd0 100644 --- a/tools/tracing/rtla/src/utils.h +++ b/tools/tracing/rtla/src/utils.h @@ -46,6 +46,7 @@ update_sum(unsigned long long *a, unsigned long long *b) *a +=3D *b; } =20 +#ifndef SCHED_ATTR_SIZE_VER0 struct sched_attr { uint32_t size; uint32_t sched_policy; @@ -56,6 +57,7 @@ struct sched_attr { uint64_t sched_deadline; uint64_t sched_period; }; +#endif /* SCHED_ATTR_SIZE_VER0 */ =20 int parse_prio(char *arg, struct sched_attr *sched_param); int parse_cpu_set(char *cpu_list, cpu_set_t *set); --=20 2.45.2