Introduce #include <cosmo.h> to toolchain users

This change improves the way internal APIs are being hidden behind the
`COSMO` define. The cosmo.h header will take care of defining that, so
that a separate define statement isn't needed. This change also does a
lot more to define which APIs are standard, and which belong to Cosmo.
This commit is contained in:
Justine Tunney 2023-06-09 18:02:06 -07:00
parent 9b55dbe417
commit 4a59210008
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
115 changed files with 699 additions and 422 deletions

View file

@ -367,10 +367,10 @@ noasan inline void *_Mmap(void *addr, size_t size, int prot, int flags, int fd,
// however this 1mb behavior oddly enough is smart enough to not
// apply if the mapping is a manually-created guard page.
int e = errno;
if ((dm = sys_mmap(p + size - GUARDSIZE, GUARDSIZE, prot,
if ((dm = sys_mmap(p + size - APE_GUARDSIZE, APE_GUARDSIZE, prot,
f | MAP_GROWSDOWN_linux, fd, off))
.addr != MAP_FAILED) {
_npassert(sys_mmap(p, GUARDSIZE, PROT_NONE,
_npassert(sys_mmap(p, APE_GUARDSIZE, PROT_NONE,
MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)
.addr == p);
dm.addr = p;
@ -398,11 +398,11 @@ noasan inline void *_Mmap(void *addr, size_t size, int prot, int flags, int fd,
if (needguard) {
if (!IsWindows()) {
// make windows fork() code simpler
mprotect(p, GUARDSIZE, PROT_NONE);
mprotect(p, APE_GUARDSIZE, PROT_NONE);
}
if (IsAsan()) {
__repstosb((void *)(((intptr_t)p >> 3) + 0x7fff8000),
kAsanStackOverflow, GUARDSIZE / 8);
kAsanStackOverflow, APE_GUARDSIZE / 8);
}
}
}