diff --git a/CMakeLists.txt b/CMakeLists.txt index 46ab92bd43..1ee12eb844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,6 +93,8 @@ if(NOT WIN32) set(PROBE_NAME "sysdig-probe") endif() + string(REGEX REPLACE "[,-]" "_" SYSFS_NAME ${PROBE_NAME}) + if(NOT DEFINED PROBE_DEVICE_NAME) set(PROBE_DEVICE_NAME "sysdig") endif() diff --git a/driver/driver_config.h.in b/driver/driver_config.h.in index 5afb3acd8e..2d9416733a 100644 --- a/driver/driver_config.h.in +++ b/driver/driver_config.h.in @@ -13,3 +13,5 @@ or GPL2.txt for full copies of the license. #define PROBE_NAME "${PROBE_NAME}" #define PROBE_DEVICE_NAME "${PROBE_DEVICE_NAME}" + +#define SYSFS_NAME "${SYSFS_NAME}" diff --git a/userspace/libscap/scap.c b/userspace/libscap/scap.c index e9faea5184..824aaa0010 100644 --- a/userspace/libscap/scap.c +++ b/userspace/libscap/scap.c @@ -100,7 +100,7 @@ scap_t* scap_open_live_int(char *error, int32_t *rc, static uint32_t get_max_consumers() { uint32_t max; - FILE *pfile = fopen("/sys/module/" PROBE_DEVICE_NAME "_probe/parameters/max_consumers", "r"); + FILE *pfile = fopen("/sys/module/" SYSFS_NAME "/parameters/max_consumers", "r"); if(pfile != NULL) { int w = fscanf(pfile, "%"PRIu32, &max); @@ -328,7 +328,7 @@ scap_t* scap_open_live_int(char *error, int32_t *rc, else if(errno == EBUSY) { uint32_t curr_max_consumers = get_max_consumers(); - snprintf(error, SCAP_LASTERR_SIZE, "Too many sysdig instances attached to device %s. Current value for /sys/module/" PROBE_DEVICE_NAME "_probe/parameters/max_consumers is '%"PRIu32"'.", filename, curr_max_consumers); + snprintf(error, SCAP_LASTERR_SIZE, "Too many sysdig instances attached to device %s. Current value for /sys/module/" SYSFS_NAME "/parameters/max_consumers is '%"PRIu32"'.", filename, curr_max_consumers); } else {