This is the mail archive of the cygwin-patches mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Cygwin: Fix return value of sched_getaffinity

Hi Mark,

On Jun 24 22:25, Mark Geisert wrote:
> Return what the documentation says, instead of a misreading of it.
> ---
>  winsup/cygwin/ | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/winsup/cygwin/ b/winsup/cygwin/
> index e7b44d319..8f24bf80d 100644
> --- a/winsup/cygwin/
> +++ b/winsup/cygwin/
> @@ -608,7 +608,7 @@ done:
>    else
>      {
>        /* Emulate documented Linux kernel behavior on successful return */
> -      status = wincap.cpu_count ();
> +      status = sizeof (cpu_set_t);

Wait... what docs are you referring to?  The Linux man page in Fedora 29

 On success, sched_setaffinity() and sched_getaffinity() return  0.   On
 error, -1 is returned, and errno is set appropriately.

Also, while at it, would you mind to rearrange the code a bit at this
point?  I think it's a bit puzzeling that status indicates an error code
as well as the non-errno return code from this function.  Kind of like

  if (status)
      set_errno (status)
      return -1;
  return 0;


Corinna Vinschen
Cygwin Maintainer

Attachment: signature.asc
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]