* Re: musl nice() posix compliance issue
[not found] <CAKTZs+oqBk6M8JihSTPQphrLTL18EOnjvp+Atwd6a5NMLn0o=Q@mail.gmail.com>
@ 2018-04-15 18:58 ` Rich Felker
2018-04-16 21:35 ` Rich Felker
0 siblings, 1 reply; 2+ messages in thread
From: Rich Felker @ 2018-04-15 18:58 UTC (permalink / raw)
To: Justine Tunney; +Cc: musl
On Sun, Apr 15, 2018 at 10:17:37AM -0700, Justine Tunney wrote:
> According to Python 2.7 autoconf, musl's nice() function needs to do this.
> I checked latest release and HEAD.
>
> C library/kernel differences
> POSIX.1 specifies that nice() should return the new nice value.
> However, the raw Linux system call returns 0 on success. Likewise, the
> nice() wrapper function provided in glibc 2.2.3 and
> earlier returns 0 on success.
This analysis seems correct, and from what I can tell, the SYS_nice
syscall simply isn't usable to implement nice() because it doesn't
provide the resulting nice level. So I think we have to fully drop use
of it. OTOH SYS_get/setpriority are also problematic because of
non-atomicity; we can and probably should try to patch that up by
blocking signals and taking a lock around the operation -- but I'm not
sure Linux even correctly applies the priority to all threads rather
than just the calling thread, anyway... Do you know?
Rich
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Re: musl nice() posix compliance issue
2018-04-15 18:58 ` musl nice() posix compliance issue Rich Felker
@ 2018-04-16 21:35 ` Rich Felker
0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2018-04-16 21:35 UTC (permalink / raw)
To: Justine Tunney; +Cc: musl
On Sun, Apr 15, 2018 at 02:58:16PM -0400, Rich Felker wrote:
> On Sun, Apr 15, 2018 at 10:17:37AM -0700, Justine Tunney wrote:
> > According to Python 2.7 autoconf, musl's nice() function needs to do this.
> > I checked latest release and HEAD.
> >
> > C library/kernel differences
> > POSIX.1 specifies that nice() should return the new nice value.
> > However, the raw Linux system call returns 0 on success. Likewise, the
> > nice() wrapper function provided in glibc 2.2.3 and
> > earlier returns 0 on success.
>
> This analysis seems correct, and from what I can tell, the SYS_nice
> syscall simply isn't usable to implement nice() because it doesn't
> provide the resulting nice level. So I think we have to fully drop use
> of it. OTOH SYS_get/setpriority are also problematic because of
> non-atomicity; we can and probably should try to patch that up by
> blocking signals and taking a lock around the operation -- but I'm not
> sure Linux even correctly applies the priority to all threads rather
> than just the calling thread, anyway... Do you know?
It doesn't, but this is a separate bug that can be worked around on
its own. I'll apply a fix for the part you reported first.
Rich
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-16 21:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CAKTZs+oqBk6M8JihSTPQphrLTL18EOnjvp+Atwd6a5NMLn0o=Q@mail.gmail.com>
2018-04-15 18:58 ` musl nice() posix compliance issue Rich Felker
2018-04-16 21:35 ` Rich Felker
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).