Changeset e8e9052


Ignore:
Timestamp:
05/18/18 14:54:59 (2 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, master, rc-4.0.4, ringdecrementfix, ringperformance
Children:
5577521
Parents:
a7e4f40
Message:

Fix build error on older kernels that don't have memfd_create

We now fall back to shm_open() if memfd_create isn't available.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • configure.in

    rb663d33 re8e9052  
    554554
    555555
     556have_memfd_create=no
     557AC_RUN_IFELSE([AC_LANG_PROGRAM([
     558#include <sys/syscall.h>
     559],[
     560#ifndef __NR_memfd_create
     561exit(1)
     562#endif
     563])], [have_memfd_create=yes])
     564
     565if test "$have_memfd_create" = "yes"; then
     566        AC_DEFINE(HAVE_MEMFD_CREATE, 1, [Set to 1 if kernel supports memfd_create syscall])
     567fi
     568
    556569# Stupid AC_SEARCH_LIB appends stuff to LIBS even when I don't want it to, so
    557570# just set libs to null here to avoid linking against them by default
  • lib/data-struct/simple_circular_buffer.c

    r25c305d re8e9052  
    77#include <stdio.h>
    88#include <sys/syscall.h>
     9#include <sys/stat.h>
     10#include <fcntl.h>
    911#include <sys/socket.h>
    1012
     
    2123
    2224        snprintf(anonname, 32, "lt_scb_%u", id);
     25#ifdef HAVE_MEMFD_CREATE
    2326        buf->fd = syscall(__NR_memfd_create, anonname, 0);
     27#else
     28        buf->fd = shm_open(anonname, O_RDWR | O_CREAT, 0600);
     29#endif
    2430        ftruncate(buf->fd, size);
    2531
     
    3642
    3743DLLEXPORT void libtrace_scb_destroy(libtrace_scb_t *buf) {
     44        /* TODO shm_unlink the file name if we used shm_open? */
     45
    3846        munmap(buf->address, buf->count_bytes * 2);
     47        close(buf->fd);
    3948}
    4049
Note: See TracChangeset for help on using the changeset viewer.