Skip to content

incorrect usage of mmap return value in the standard library #2415

Description

@andrewrk
../std/heap.zig:                if (addr == p.MAP_FAILED) return error.OutOfMemory;
../std/os.zig:    if (mmap_addr == posix.MAP_FAILED) return error.OutOfMemory;

These assume the libc API of mmap. However that is a libc thing. mmap returns an error in the normal syscall return code format and posix.getErrno() is needed to find out the error code.

Related: #2380

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions