From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12716 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: musl nice() posix compliance issue Date: Sun, 15 Apr 2018 14:58:16 -0400 Message-ID: <20180415185816.GW3094@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1523818593 9098 195.159.176.226 (15 Apr 2018 18:56:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 15 Apr 2018 18:56:33 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) Cc: musl@lists.openwall.com To: Justine Tunney Original-X-From: musl-return-12732-gllmg-musl=m.gmane.org@lists.openwall.com Sun Apr 15 20:56:28 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1f7mp7-0002Aa-Ra for gllmg-musl@m.gmane.org; Sun, 15 Apr 2018 20:56:25 +0200 Original-Received: (qmail 29723 invoked by uid 550); 15 Apr 2018 18:58:31 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 28666 invoked from network); 15 Apr 2018 18:58:30 -0000 Content-Disposition: inline In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:12716 Archived-At: 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