Commit c2423296 authored by Kirill Smelkov's avatar Kirill Smelkov

X Fix mlock2 build on Debian 8

@rporchetto reports build failure on Debian 8 / Linux 3.16

    [2021-07-30 15:40:35,677] INFO     gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/srv/slapgrid/slappart19/srv/runner/shared/python2.7/3b7a074d1ded44046871b13502341482/include/python2.7 -c wcfs/internal/mm.c -o build/temp.linux-x86_64-2.7/wcfs/internal/mm.o
    [2021-07-30 15:40:35,677] INFO     wcfs/internal/mm.c: In function 'mlock2':
    [2021-07-30 15:40:35,677] INFO     wcfs/internal/mm.c:618:28: error: 'SYS_mlock2' undeclared (first use in this function); did you mean 'SYS_mlock'?
    [2021-07-30 15:40:35,677] INFO              long err = syscall(SYS_mlock2, addr, len, flags);
    [2021-07-30 15:40:35,677] INFO                                 ^~~~~~~~~~
    [2021-07-30 15:40:35,677] INFO                                 SYS_mlock

Fix the build.

NOTE mlock2 was added in Linux 4.3.

Similarly MCL_ONFAULT is not provided on that old glibc 2.19:

    [2021-07-30 15:40:35,677] INFO     wcfs/internal/mm.c:986:55: error: 'MCL_ONFAULT' undeclared here (not in a function); did you mean 'MLOCK_ONFAULT'?
    [2021-07-30 15:40:35,677] INFO        __pyx_e_8wendelin_4wcfs_8internal_2mm_MCL_ONFAULT = MCL_ONFAULT,
    [2021-07-30 15:40:35,678] INFO                                                            ^~~~~~~~~~~
    [2021-07-30 15:40:35,678] INFO                                                            MLOCK_ONFAULT

-> Comment MCL_ONFAULT for now since we do not actually use it anywhere yet.
parent 0853cc9f
...@@ -33,12 +33,17 @@ cdef extern from *: ...@@ -33,12 +33,17 @@ cdef extern from *:
#include <unistd.h> #include <unistd.h>
#include <sys/syscall.h> #include <sys/syscall.h>
static int mlock2(const void *addr, size_t len, int flags) { static int mlock2(const void *addr, size_t len, int flags) {
#ifndef SYS_mlock2
errno = ENOSYS;
return -1;
#else
long err = syscall(SYS_mlock2, addr, len, flags); long err = syscall(SYS_mlock2, addr, len, flags);
if (err != 0) { if (err != 0) {
errno = -err; errno = -err;
return -1; return -1;
} }
return 0; return 0;
#endif
} }
#endif #endif
#endif #endif
...@@ -62,7 +67,7 @@ cpdef enum: ...@@ -62,7 +67,7 @@ cpdef enum:
MLOCK_ONFAULT = mman.MLOCK_ONFAULT MLOCK_ONFAULT = mman.MLOCK_ONFAULT
MCL_CURRENT = mman.MCL_CURRENT MCL_CURRENT = mman.MCL_CURRENT
MCL_FUTURE = mman.MCL_FUTURE MCL_FUTURE = mman.MCL_FUTURE
MCL_ONFAULT = mman.MCL_ONFAULT #MCL_ONFAULT = mman.MCL_ONFAULT
MADV_NORMAL = mman.MADV_NORMAL MADV_NORMAL = mman.MADV_NORMAL
MADV_RANDOM = mman.MADV_RANDOM MADV_RANDOM = mman.MADV_RANDOM
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment