Hi Christian,

On Dec  6 17:52, Christian Franke wrote:
> A first attempt to add SCHED_BATCH.
> 
> Still TODO:
> - Add SCHED_IDLE/BATCH to winsup/doc/posix.xml
> - Provide correct values in (18) and (19) of /proc/PID/stat for SCHED_BATCH.
> - Provide correct value in (18) of /proc/PID/stat for SCHED_FIFO/RR.
> 
> -- 
> Regards,
> Christian
> 

> From 0822917252fdade3edc240b4fbfd3c0f47ef1deb Mon Sep 17 00:00:00 2001
> From: Christian Franke <christian.fra...@t-online.de>
> Date: Fri, 6 Dec 2024 17:32:29 +0100
> Subject: [PATCH] Cygwin: sched_setscheduler: accept SCHED_BATCH
> 
> Add SCHED_BATCH to <sys/sched.h>.  SCHED_BATCH is similar to SCHED_OTHER,
> except that the nice value is mapped to a one step lower Windows priority.
> Rework the mapping functions to ease the addition of this functionality.
> 
> Signed-off-by: Christian Franke <christian.fra...@t-online.de>
> ---
>  newlib/libc/include/sys/sched.h          |   8 ++
>  winsup/cygwin/local_includes/miscfuncs.h |   4 +-
>  winsup/cygwin/miscfuncs.cc               | 155 +++++++++++++----------
>  winsup/cygwin/release/3.6.0              |  11 +-
>  winsup/cygwin/sched.cc                   |  15 ++-
>  winsup/cygwin/syscalls.cc                |  20 +--
>  6 files changed, 129 insertions(+), 84 deletions(-)
> 
> diff --git a/newlib/libc/include/sys/sched.h b/newlib/libc/include/sys/sched.h
> index c96355c24..265215211 100644
> --- a/newlib/libc/include/sys/sched.h
> +++ b/newlib/libc/include/sys/sched.h
> @@ -38,6 +38,14 @@ extern "C" {
>  #define SCHED_FIFO     1
>  #define SCHED_RR       2
>  
> +#if __GNU_VISIBLE
> +#if defined(__CYGWIN__)
> +#define SCHED_BATCH    0
> +#else
> +#define SCHED_BATCH    3
> +#endif
> +#endif

I would prefer that SCHED_BATCH gets its own, single value.
There's no good reason to add another ifdef for that.  Why
not just #define SCHED_BATCH 6?


Thanks,
Corinna

Reply via email to