mailing list of musl libc
 help / color / 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, back to index

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

mailing list of musl libc

Archives are clonable: git clone --mirror http://inbox.vuxu.org/musl

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.musl


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git