Files
MontaukOS/programs/include/libc/sys/mman.h
T
danielandClaude Fable 5 f234c67a2b feat: native GCC - cc1, cc1plus and the gcc driver run on MontaukOS
Cross-build GCC 14.2.0 with --host=x86_64-montauk: the driver, cc1,
cc1plus and collect2 now link as static Montauk ET_EXEC binaries
against the hosted libstdc++, and ship in the SDK. Together with the
native binutils, TCC and the target sysroot, MontaukOS carries a
complete self-contained C and C++ toolchain at 0:/sdk.

libc: anonymous mmap/munmap over SYS_ALLOC (GCC's page allocator
wants mmap; SYS_ALLOC memory is page-aligned by construction),
getpagesize, minimal sysconf, MB_CUR_MAX, isascii/toascii, POSIX id
typedefs (ino_t, dev_t, nlink_t, ...), struct stat fields switched to
proper POSIX types (st_size is a signed off_t now), and a
conventional _STDIO_H guard marker so GMP's FILE detection works.

Build recipe and the five host-build gotchas (bundled config.subs,
gettext removal, stdio guard sniffing, endianness cache preset,
sysroot sdk symlink) are documented in toolchain/README.md. The
devkit stages the driver as gcc.elf/g++.elf/cpp.elf, the backends in
the libexec layout the driver expects, a copy of ld where collect2
searches, and a 0:/tmp scratch dir. Ramdisk: 1604 files, 368 MB.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-16 23:51:30 +02:00

42 lines
877 B
C

#ifndef _LIBC_SYS_MMAN_H
#define _LIBC_SYS_MMAN_H
#pragma once
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Anonymous-memory mmap over SYS_ALLOC. SYS_ALLOC returns
* page-aligned process memory, which is exactly what callers like
* GCC's page allocator need. File-backed mappings are not
* supported and fail with ENODEV.
*/
#define PROT_NONE 0
#define PROT_READ 1
#define PROT_WRITE 2
#define PROT_EXEC 4
#define MAP_SHARED 0x01
#define MAP_PRIVATE 0x02
#define MAP_FIXED 0x10
#define MAP_ANONYMOUS 0x20
#define MAP_ANON MAP_ANONYMOUS
#define MAP_FAILED ((void *)-1)
void *mmap(void *addr, size_t length, int prot, int flags, int fd,
long offset);
int munmap(void *addr, size_t length);
int mprotect(void *addr, size_t length, int prot);
#ifdef __cplusplus
}
#endif
#endif /* _LIBC_SYS_MMAN_H */