public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: ltp@lists.linux.it
Cc: Khem Raj <raj.khem@gmail.com>
Subject: [LTP] [PATCH] sched_attr: Do not define for glibc >= 2.41
Date: Wed, 30 Oct 2024 14:45:34 -0700	[thread overview]
Message-ID: <20241030214534.539684-1-raj.khem@gmail.com> (raw)

glibc 2.41+ has added [1] definitions for sched_setattr and sched_getattr functions
and struct sched_attr. Therefore, it needs to be checked for here as well before
defining sched_attr

Define sched_attr conditionally on SCHED_ATTR_SIZE_VER0

Fixes builds with glibc/trunk

[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=21571ca0d70302909cf72707b2a7736cf12190a0;hp=298bc488fdc047da37482f4003023cb9adef78f8

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 include/lapi/sched.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/lapi/sched.h b/include/lapi/sched.h
index 26fdb628d..e1c7ff011 100644
--- a/include/lapi/sched.h
+++ b/include/lapi/sched.h
@@ -15,6 +15,8 @@
 #include "lapi/syscalls.h"
 #include "lapi/sched.h"
 
+/* sched_attr is not defined in glibc < 2.41 */
+#ifndef SCHED_ATTR_SIZE_VER0
 struct sched_attr {
 	uint32_t size;
 
@@ -44,6 +46,7 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
 {
 	return syscall(__NR_sched_getattr, pid, attr, size, flags);
 }
+#endif
 
 #ifndef HAVE_CLONE3
 struct clone_args {

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2024-10-30 21:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30 21:45 Khem Raj [this message]
2024-10-31  6:45 ` [LTP] [PATCH] sched_attr: Do not define for glibc >= 2.41 Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241030214534.539684-1-raj.khem@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox