From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/15047 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alex Brachet-Mialot Newsgroups: gmane.linux.lib.musl.general Subject: mmap implementation confusion Date: Thu, 19 Dec 2019 03:37:14 -0500 Message-ID: Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000075f335059a0a784d" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="153140"; mail-complaints-to="usenet@blaine.gmane.org" To: "musl@lists.openwall.com" Original-X-From: musl-return-15063-gllmg-musl=m.gmane.org@lists.openwall.com Thu Dec 19 09:37:41 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 1ihrJU-000djb-6y for gllmg-musl@m.gmane.org; Thu, 19 Dec 2019 09:37:40 +0100 Original-Received: (qmail 21834 invoked by uid 550); 19 Dec 2019 08:37:37 -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 21801 invoked from network); 19 Dec 2019 08:37:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=iLc8CpbD1NVK+2/0eAGP94RXO1gvVZIeByCMbMrCxBI=; b=BrVRgqeKsWwf95jAX6VUy2HK7NS91/CtfPxKVmosXqDrPap6b/jMRG/FuX5KT0ZgTJ l4BOFHZaUhHT6pUs2LFka20hOjGLr9dRqNUaJuzPVxIkxNo6FESnWCXJ4D3mV40TmAPQ FJnA396mfSPTWiYpvX0yQqaYbjrZRmZ62JoVnreNjb0+tmq6kqcL55y2Aeki0YQ+y+Pn hvw/XHy3Sk5Dbe3eRTRuToF+aaS3hRzN1zsUSWFA307+2Xy1MwIm0fpQKNHsXqoNARJm RD9icA04OYm9GUvaHdHze/zBQS4RxBWl06UlmIqW+OfyHmfVY37NFiUlSbCV09a1WL3Y MZgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=iLc8CpbD1NVK+2/0eAGP94RXO1gvVZIeByCMbMrCxBI=; b=ZZq472IoHl0zceESc5yJGbsHXRAx1h4dNQNizCAWnlWRsc8lxan33IL7N8Y36jJgc7 Ewi1vPSOBwyTBZbH25XlaZnnNJ8/7Bnwa7w+psZbOPYVzbHc8kRhfBZD9eY2UDKO9DXh f95/31BqNIYCe5tBqtGrHfmZvzQC3XWGRJJ1BAw5a0RDbTNh/xQudg9eyGtQcPD64ukx +mDT1GGvG8RmqTp2e/cibEGZGGTWhd8mK3IneH7xlcoaYR0px6JmvTO+siAypPQZK3aB tAbAh/xLJahyYnDSXECpRSz4f1FxH6hrr5Z5GjzyXlmC0MxR1hcseXE44RQ6cZPFsG3R bVyg== X-Gm-Message-State: APjAAAW/s8RLUF7I3DFQGknyXhcVnhomcmsDBZ/4JseEhiUPAyTlHG3D z+gIsxai3fGJu/VZsgOjxQudhTgi6+Q4r4V0DCQ6sFFZ X-Google-Smtp-Source: APXvYqzNtLVYhxpqEANHdVkuq0XvT4sWhFS2Od4bPoeaaulYX54LtAba+UXuftL3/ZlryxbqMC/RXqmmt/mzpvXS5iE= X-Received: by 2002:a05:6102:405:: with SMTP id d5mr4278007vsq.94.1576744644898; Thu, 19 Dec 2019 00:37:24 -0800 (PST) Xref: news.gmane.org gmane.linux.lib.musl.general:15047 Archived-At: --00000000000075f335059a0a784d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E2=80=99m not seeing that logic. Am I miss= ing something here? Thanks. Best, Alex --00000000000075f335059a0a784d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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=E2=80=99m not seeing that logic. A= m I missing something here? Thanks.

Best,
Alex
--00000000000075f335059a0a784d--