[libc-commits] [PATCH] D71634: Add implementations of POSIX mmap and munmap functions.
Petr Hosek via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Dec 18 19:25:33 PST 2019
phosek added inline comments.
================
Comment at: libc/config/linux/platfrom_defs.h.inc:15
+
+#define PAGE_SIZE 4096
----------------
abrachet wrote:
> Shouldn't this be defined in some linux header that we can include? Either way I don't think we should just be defining it like this, as this is platform specific (although what platforms use a different page size) it should go in the config files I reckon.
I'm not sure whether this should be defined at all, the man page for `getpagesize` says:
Whether getpagesize() is present as a Linux system call depends on the architecture. If it is, it returns the kernel symbol PAGE_SIZE, whose value depends on the architecture and machine model. Generally, one uses binaries that are dependent on the architecture but not on the machine model, in order to have a single binary distribution per architecture. This means that a user program should not find PAGE_SIZE at compile time from a header file, but use an actual system call, at least for those architectures (like sun4) where this dependency exists. Here glibc 2.0 fails because its getpagesize() returns a statically derived value, and does not use a system call. Things are OK in glibc 2.1.
================
Comment at: libc/include/sys/syscall.h.def:1
+//===------------------------ Linux header syscall.h ----------------------===//
+//
----------------
The comment should be updated.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71634/new/
https://reviews.llvm.org/D71634
More information about the libc-commits
mailing list