From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/15048 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Joakim Sindholt Newsgroups: gmane.linux.lib.musl.general Subject: Re: mmap implementation confusion Date: Thu, 19 Dec 2019 09:43:02 +0100 Message-ID: <20191219084302.GC986899@wirbelwind.zhasha.com> References: Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="174875"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) To: musl@lists.openwall.com Original-X-From: musl-return-15064-gllmg-musl=m.gmane.org@lists.openwall.com Thu Dec 19 09:43:17 2019 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.89) (envelope-from ) id 1ihrOv-000jP5-GU for gllmg-musl@m.gmane.org; Thu, 19 Dec 2019 09:43:17 +0100 Original-Received: (qmail 24337 invoked by uid 550); 19 Dec 2019 08:43:15 -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 24319 invoked from network); 19 Dec 2019 08:43:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zhasha.com; s=mail; t=1576744983; bh=fRYA/n7Z9EOKMbEcXbqXBdrWDRvlA/a09S3Jp9zNPbE=; h=Date:From:To:Subject:References:In-Reply-To; b=fKfLPwY5B4JJBT68Ph5QlbKymrH+MBnFM+wnftPJ0XlGjOp/Moot+p9H5DKQKdWYE d4V5XKHwDXuEtp1FXJXPK2A9voQXdirzRXFi6VlxN2MsAu3aPPGuu2NLXz2DcK6PFQ A8I+p8b2zyi/6A9JBhqVg+4Nvjs2P50EnkKKQWaY= Content-Disposition: inline In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:15048 Archived-At: On Thu, Dec 19, 2019 at 03:37:14AM -0500, Alex Brachet-Mialot wrote: > In src/mman/mmap.c mmap (after light einval checks) just returns the result > of the syscall directly. But presumably the OS returns -E* and not -1 for > all failures. Otherwise something like EBADF could never go reported. > Presumably musl is compliant here and returns -1 on error and not the > negative value from the OS but I’m not seeing that logic. Am I missing > something here? Thanks. It returns (void *)__syscall_ret(ret) Have a look in src/internal/syscall_ret.c