this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add sys_madvise()

+39 -7
+3 -2
src/kernel/emulation/linux/CMakeLists.txt
··· 20 20 unistd/pwrite.c 21 21 unistd/readv.c 22 22 unistd/writev.c 23 - mman.c 23 + mman/mman.c 24 + mman/madvise.c 24 25 unistd/fsync.c 25 26 unistd/sync.c 26 27 unistd/fdatasync.c ··· 117 118 syscalls-amd64.asm 118 119 ) 119 120 120 - set_source_files_properties(mman.c PROPERTIES COMPILE_FLAGS 121 + set_source_files_properties(mman/mman.c PROPERTIES COMPILE_FLAGS 121 122 "-I${DARLING_TOP_DIRECTORY}/platform-include") 122 123 set_source_files_properties(signal/duct_signals.c PROPERTIES COMPILE_FLAGS 123 124 "-I${DARLING_TOP_DIRECTORY}/platform-include -I${DARLING_TOP_DIRECTORY}/src/libc/include -nostdinc")
+1 -1
src/kernel/emulation/linux/duct_mman.h src/kernel/emulation/linux/mman/duct_mman.h
··· 47 47 #define LINUX_MCL_CURRENT 1 48 48 #define LINUX_MCL_FUTURE 2 49 49 50 - #include "../../../../platform-include/sys/mman.h" 50 + #include "../../../../../platform-include/sys/mman.h" 51 51 52 52 #endif 53 53
+2 -2
src/kernel/emulation/linux/mman.c src/kernel/emulation/linux/mman/mman.c
··· 1 1 #include "mman.h" 2 2 #include "duct_mman.h" 3 - #include "errno.h" 4 - #include "base.h" 3 + #include "../errno.h" 4 + #include "../base.h" 5 5 #include <asm/unistd.h> 6 6 7 7 static int prot_bsd_to_linux(int prot)
src/kernel/emulation/linux/mman.h src/kernel/emulation/linux/mman/mman.h
+23
src/kernel/emulation/linux/mman/madvise.c
··· 1 + #include "madvise.h" 2 + #include "../errno.h" 3 + #include "../base.h" 4 + #include "../../../../../platform-include/sys/errno.h" 5 + #include <asm/unistd.h> 6 + 7 + long sys_madvise(void* addr, unsigned long len, int advice) 8 + { 9 + int ret; 10 + 11 + // advice < 0 are identical between OS X and Linux 12 + // advice >= 5 are specific to OS X/BSD 13 + if (advice >= 5) 14 + return -ENOTSUP; 15 + 16 + ret = LINUX_SYSCALL(__NR_madvise, addr, len, advice); 17 + 18 + if (ret < 0) 19 + ret = errno_linux_to_bsd(ret); 20 + 21 + return ret; 22 + } 23 +
+7
src/kernel/emulation/linux/mman/madvise.h
··· 1 + #ifndef LINUX_MADVISE_H 2 + #define LINUX_MADVISE_H 3 + 4 + long sys_madvise(void* addr, unsigned long len, int advice); 5 + 6 + #endif 7 +
+3 -2
src/kernel/emulation/linux/syscalls.c
··· 2 2 3 3 #include "unistd/write.h" 4 4 #include "unistd/read.h" 5 - #include "mman.h" 6 - 5 + #include "mman/mman.h" 6 + #include "mman/madvise.h" 7 7 #include "unistd/sync.h" 8 8 #include "unistd/fsync.h" 9 9 #include "unistd/fdatasync.h" ··· 125 125 [66] = sys_vfork, 126 126 [73] = sys_munmap, 127 127 [74] = sys_mprotect, 128 + [75] = sys_madvise, 128 129 [78] = sys_mincore, 129 130 [90] = sys_dup2, 130 131 [92] = sys_fcntl,