mailing list of musl libc
 help / color / mirror / code / Atom feed
b543f4240b375d3d2cb8d2c3902fbf358d78f0a2 blob 962 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
#include <unistd.h>
#include <sys/mman.h>
#include <errno.h>
#include <stdint.h>
#include <limits.h>
#include "syscall.h"

static void dummy(void) { }
weak_alias(dummy, __vm_wait);

#define UNIT SYSCALL_MMAP2_UNIT
#define OFF_MASK ((-0x2000ULL << (8*sizeof(syscall_arg_t)-1)) | (UNIT-1))

void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)
{
	long ret;
	if (off & OFF_MASK) {
		errno = EINVAL;
		return MAP_FAILED;
	}
	if (len >= PTRDIFF_MAX) {
		errno = ENOMEM;
		return MAP_FAILED;
	}
	if (flags & MAP_FIXED) {
		__vm_wait();
	}
#ifdef SYS_mmap2
       ret = __syscall(SYS_mmap2, start, len, prot, flags, fd, (unsigned long)off/UNIT);
#else
	ret = __syscall(SYS_mmap, start, len, prot, flags, fd, off);
#endif
	/* Fixup incorrect EPERM from kernel. */
	if (ret == -EPERM && !start && (flags&MAP_ANON) && !(flags&MAP_FIXED))
		ret = -ENOMEM;
	return (void *)__syscall_ret(ret);
}

weak_alias(__mmap, mmap);

weak_alias(mmap, mmap64);
debug log:

solving f225cdbb ...
found f225cdbb in https://inbox.vuxu.org/musl/1F85A2EF-1942-48CE-989E-7552970E6877@gmail.com/
found eff88d82 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 eff88d82a8fcff843247a5436f42016690daac24	src/mman/mmap.c

applying [1/1] https://inbox.vuxu.org/musl/1F85A2EF-1942-48CE-989E-7552970E6877@gmail.com/
diff --git a/src/mman/mmap.c b/src/mman/mmap.c
index eff88d82..f225cdbb 100644

Checking patch src/mman/mmap.c...
Applied patch src/mman/mmap.c cleanly.

index at:
100644 b543f4240b375d3d2cb8d2c3902fbf358d78f0a2	src/mman/mmap.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).