Why is taskset still not in util-linux?

Marco Atzeri marco.atzeri@gmail.com
Thu Mar 19 10:41:00 GMT 2020

Am 19.03.2020 um 11:14 schrieb Eliot Moss:
> On 3/16/2020 7:34 PM, Mark Geisert wrote:
>  > Mark Geisert wrote:
>  >> Eliot Moss wrote:
>  >>>
>  >>> Dear cygwin-ers --
>  >>>
>  >>> Something I had asked about a while ago was the absence os taskset 
> in cygwin's
>  >>> util-linux.  At the time, it was pointed out that the necessary 
> get/set
>  >>> affinity library/system calls were not yet supported.  These were 
> added a
>  >>> while ago, so it would seem that taskset ought to work.  In fact, I 
> think
>  >>> someone got it going on their own.  Can we add it to util-linux now,
>  >>> officially?  I think this was intended but perhaps was overlooked or
>  >>> something.
>  >>
>  >> Report noted; thanks.  A solution is being worked.
>  >
>  > There's been no forward progress on this.  If you're comfortable 
> getting the util-linux source
>  > package through Cygwin setup*.exe, you can follow the steps shown in
>  > https://cygwin.com/pipermail/cygwin-apps/2020-March/039855.html to 
> build (with cygport) a local copy
>  > of util-linux that includes a taskset.exe you can move into 
> /usr/local/bin, for example.
>  >
>  > You might try that route if you're up for it.  Feel free to ask 
> questions here if you hit a snag.
>  > HTH,
> Thank you, Mark.  I decided to give it a try and got some distance, but 
> hit a snag.
> First, I had to change configure.ac to add control to disable ionice 
> (Cygwin
> does not support a required syscall) while still trying to build taskset.
> Previously taskset and ionice (and one other program) were controlled by 
> the
> single --enable-schedutils.
> Now, including sched.h does not provide the prototypes for 
> sched_getaffinity,
> etc.  I found a previous post that suggests we need to do -D_GNU_SOURCE 
> for it
> to work.  I am not sure of the best place to stick that, but I will see 
> about
> maybe a one line patch to taskset.c or something.
> Regards - Eliot

one brutal solution I recently used

         echo "defining _GNU_SOURCE on config.h"
         echo "#define _GNU_SOURCE 1" >> config.h

the patch approach is usually restricted to a portion
of the code or a general header.
May be there is already something like that in the code,
or you can add a similar stuff

  #if defined(__linux__) || defined(__CYGWIN__)
  #   ifndef _GNU_SOURCE
  #       define _GNU_SOURCE
  #   endif

More information about the Cygwin mailing list