Skip to content

Commit

Permalink
sched_attr: Do not define for glibc >= 2.41
Browse files Browse the repository at this point in the history
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

Link: https://lore.kernel.org/ltp/[email protected]/
Reviewed-by: Petr Vorel <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
  • Loading branch information
kraj authored and pevik committed Oct 31, 2024
1 parent b30c8d0 commit c48700d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/lapi/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c48700d

Please sign in to comment.