summaryrefslogtreecommitdiff
path: root/userland/libc/sys/mman/mmap.c
blob: 53c6f77bec4a06b2f31dab59f0538ba25d7eee55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <errno.h>
#include <sys/mman.h>
#include <syscall.h>

extern int errno;

void *mmap(void *addr, size_t length, int prot, int flags, int fd,
           size_t offset) {
  SYS_MMAP_PARAMS args = {
      .addr = addr,
      .length = length,
      .prot = prot,
      .flags = flags,
      .fd = fd,
      .offset = offset,
  };
  //  return (void*)syscall(SYS_MMAP, &args, 0, 0, 0, 0);
  RC_ERRNO(syscall(SYS_MMAP, &args, 0, 0, 0, 0));
}