Skip to content

Commit 27a8d89

Browse files
krajpm215
authored andcommitted
linux-user: Do not define struct sched_attr if libc headers do
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, to avoid a compilation failure. Define sched_attr conditionally only when SCHED_ATTR_SIZE_VER0 is not defined. [1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=21571ca0d70302909cf72707b2a7736cf12190a0;hp=298bc488fdc047da37482f4003023cb9adef78f8 Signed-off-by: Khem Raj <[email protected]> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2799 Cc: [email protected] Reviewed-by: Peter Maydell <[email protected]> Signed-off-by: Peter Maydell <[email protected]>
1 parent 751002e commit 27a8d89

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

linux-user/syscall.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ _syscall3(int, sys_sched_getaffinity, pid_t, pid, unsigned int, len,
360360
#define __NR_sys_sched_setaffinity __NR_sched_setaffinity
361361
_syscall3(int, sys_sched_setaffinity, pid_t, pid, unsigned int, len,
362362
unsigned long *, user_mask_ptr);
363-
/* sched_attr is not defined in glibc */
363+
/* sched_attr is not defined in glibc < 2.41 */
364+
#ifndef SCHED_ATTR_SIZE_VER0
364365
struct sched_attr {
365366
uint32_t size;
366367
uint32_t sched_policy;
@@ -373,6 +374,7 @@ struct sched_attr {
373374
uint32_t sched_util_min;
374375
uint32_t sched_util_max;
375376
};
377+
#endif
376378
#define __NR_sys_sched_getattr __NR_sched_getattr
377379
_syscall4(int, sys_sched_getattr, pid_t, pid, struct sched_attr *, attr,
378380
unsigned int, size, unsigned int, flags);

0 commit comments

Comments
 (0)