Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • K kernel
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 13
    • Issues 13
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • erlends-os
  • kernel
  • kernel
  • Wiki
    • Abi
  • memman

Last edited by Erlend Sveen Oct 06, 2019
Page history

memman

Memory management functions. Currently, only only MAP_ANONYMOUS is supported. It is possible to request memory from a specific pool by supplying a file descriptor to the appropriate /kfs/mem/bank*/ file.

mmap

Map a section of memory into the current process address space.

Syntax

#include <sys/mman.h>

void *mmap (void *addr, size_t length, int prot, int flags, int fd, off_t offset);

Parameters

  • addr

    The offset of where to place the mapping. A value of zero means that the kernel is free to select the offset. Only a value of zero is currently allowed.

  • length

    The length (size) of memory to allocate.

  • prot

    Memory protection to apply. Must be a combination of PROT_READ and PROT_WRITE. PROT_EXEC is not supported.

  • flags

    Flags describing the memory allocation. Must be (MAP_PRIVATE | MAP_ANONYMOUS), since only "regular" memory allocation is supported.

  • fd

    File descriptor to map in. Currently only available for specifying the memory bank to allocate from, by giving a file descriptor for a file in /kfs/mem/bank*.

    A value of zero means that the kernel is free to choose what memory pool to allocate from.

  • offset

    Offset whithin the file. Must be zero.

Return Value

The return value is a pointer to the mapped memory if successful. Otherwise, the return value is null and errno is set:

  • EINVAL

    Operation not supported. May be returned if there was an internal system call error or the API is not available because it has been disabled.

    The length is zero.

    Invalid or unknown flags.

    Flags are not (MAP_PRIVATE | MAP_ANONYMOUS) (unsupported).

  • ENOTSUP

    Non-null address is not supported.

    Executable memory is not allowed.

  • ENOMEM

    Out of memory.

Remarks

None

munmap

Un-map a section of memory.

Syntax

#include <sys/mman.h>

int munmap (void *addr, size_t length);

Parameters

  • addr

    The offset/address of the memory to unmap.

  • length

    The length (size) of memory to de-allocate.

Return Value

The return value is zero successful. Otherwise, the return value is negative and errno is set:

  • EINVAL

    Operation not supported. May be returned if there was an internal system call error or the API is not available because it has been disabled.

    The address is not valid.

Remarks

None

Clone repository
  • abi
    • bind
    • chdir
    • close
    • closedir
    • dup2
    • exit
    • fstat
    • getcwd
    • getpgrp
    • getpid
    • gettimeofday
    • ioctl_fcntl
    • kill
    • link
    • lseek
View All Pages