mailing list of musl libc
 help / color / mirror / code / Atom feed
* mmap implementation confusion
@ 2019-12-19  8:37 Alex Brachet-Mialot
  2019-12-19  8:43 ` Joakim Sindholt
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Brachet-Mialot @ 2019-12-19  8:37 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 408 bytes --]

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.

Best,
Alex

[-- Attachment #2: Type: text/html, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mmap implementation confusion
  2019-12-19  8:37 mmap implementation confusion Alex Brachet-Mialot
@ 2019-12-19  8:43 ` Joakim Sindholt
  0 siblings, 0 replies; 2+ messages in thread
From: Joakim Sindholt @ 2019-12-19  8:43 UTC (permalink / raw)
  To: musl

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-19  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-19  8:37 mmap implementation confusion Alex Brachet-Mialot
2019-12-19  8:43 ` Joakim Sindholt

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).