miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
mman.h
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2026 Christian Spoo
4//
5// Permission is hereby granted, free of charge, to any person obtaining a copy
6// of this software and associated documentation files (the "Software"), to deal
7// in the Software without restriction, including without limitation the rights
8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9// copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in all
13// copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21// SOFTWARE.
22
23/*
24 * sys/mman.h — miniOS userspace mmap/munmap declarations
25 *
26 * Newlib 4.5.0 for x86_64-elf does not ship sys/mman.h.
27 * This header provides the POSIX-compatible subset used by testmmap.
28 * Constants match Linux x86-64 ABI values (which the kernel expects).
29 */
30
31#ifndef _SYS_MMAN_H
32#define _SYS_MMAN_H
33
34#include <stddef.h>
35
36/* Protection flags */
37#define PROT_NONE 0
38#define PROT_READ 1
39#define PROT_WRITE 2
40#define PROT_EXEC 4
41
42/* Mapping flags */
43#define MAP_SHARED 0x01
44#define MAP_PRIVATE 0x02
45#define MAP_ANONYMOUS 0x20
46#define MAP_ANON MAP_ANONYMOUS
47
48/* Error return value */
49#define MAP_FAILED ((void *)-1)
50
51void *mmap(void *addr, size_t len, int prot, int flags, int fd, long offset);
52int munmap(void *addr, size_t len);
53
54#endif /* _SYS_MMAN_H */
struct idt_entry_t * offset
Definition irq.h:1
int munmap(void *addr, size_t len)
Definition syscalls.c:419
void * mmap(void *addr, size_t len, int prot, int flags, int fd, long offset)
Definition syscalls.c:406
int fd
Definition syscall_fs.c:0
uint64_t addr
Definition virtio_net.c:0
uint16_t flags
Definition virtio_net.c:2
uint32_t len
Definition virtio_net.c:1