[PATCH] Cygwin: Fix return value of sched_getaffinity
Corinna Vinschen
corinna-cygwin@cygwin.com
Tue Jun 25 07:31:00 GMT 2019
Hi Mark,
On Jun 24 22:25, Mark Geisert wrote:
> Return what the documentation says, instead of a misreading of it.
> ---
> winsup/cygwin/sched.cc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/winsup/cygwin/sched.cc b/winsup/cygwin/sched.cc
> index e7b44d319..8f24bf80d 100644
> --- a/winsup/cygwin/sched.cc
> +++ b/winsup/cygwin/sched.cc
> @@ -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
says
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
this:
if (status)
{
set_errno (status)
return -1;
}
return 0;
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20190625/6e11635f/attachment.sig>
More information about the Cygwin-patches
mailing list