On Thu, Mar 10, 2016 at 05:12:25PM +0800, Fei Jie wrote:
[...]
> --- /dev/null
> +++ b/tests/sched_xetscheduler.c
> @@ -0,0 +1,52 @@
> +#include "tests.h"
> +#include <sys/syscall.h>
> +
> +#if defined __NR_sched_getscheduler && defined __NR_sched_setscheduler
> +
> +# include <errno.h>
> +# include <sched.h>
> +# include <stdio.h>
> +# include <unistd.h>
> +
> +int
> +main(void)
> +{
> +     struct sched_param *const param = tail_alloc(sizeof(struct 
> sched_param));
> +     int rc = syscall(__NR_sched_getscheduler, 0);
> +     const char *scheduler;
> +     switch (rc) {
> +             case SCHED_FIFO:
> +                     scheduler = "SCHED_FIFO";
> +                     break;
> +             case SCHED_RR:
> +                     scheduler = "SCHED_RR";
> +                     break;
> +# ifdef __USE_GNU
> +             case SCHED_BATCH:
> +                     scheduler = "SCHED_BATCH";
> +                     break;
> +             case SCHED_IDLE:
> +                     scheduler = "SCHED_IDLE";
> +                     break;
> +# endif

__USE_GNU is an internal GNU libc macro, don't use it.

If you need to check whether SCHED_BATCH is available, use traditional
#ifdef SCHED_BATCH
instead.  The same rule is applicable to other SCHED constants.

Note that there are other scheduler policy constants that could be
returned by this syscall, see xlat/schedulers.in


-- 
ldv

Attachment: pgpvVkXMfXALj.pgp
Description: PGP signature

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to