have_cpuid_h="no"
AC_CHECK_HEADERS(cpuid.h, [have_cpuid_h="yes"])
-AC_CHECK_HEADERS(sys/capability.h)
+have_capability="yes"
+AC_CHECK_HEADERS(sys/capability.h,
+ [have_capability="yes"],
+ [have_capability="no (<sys/capability.h> not found)"])
+if test "x$have_capability" = "xyes"; then
+AC_CHECK_LIB(cap, cap_get_bound,
+ [have_capability="yes"],
+ [have_capability="no (cap_get_bound() not found)"])
+fi
+if test "x$have_capability" = "xyes"; then
+ AC_DEFINE(HAVE_CAPABILITY, 1, [Define to 1 if you have cap_get_bound() (-lcap).])
+fi
+AM_CONDITIONAL(BUILD_WITH_CAPABILITY, test "x$have_capability" = "xyes")
+
#
# Checks for typedefs, structures, and compiler characteristics.
#
if test -d "$with_java_home"
then
AC_MSG_CHECKING([for jni.h])
- TMPVAR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
+ TMPVAR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
if test "x$TMPVAR" != "x"
then
AC_MSG_RESULT([found in $TMPVAR])
fi
AC_MSG_CHECKING([for jni_md.h])
- TMPVAR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
+ TMPVAR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
if test "x$TMPVAR" != "x"
then
AC_MSG_RESULT([found in $TMPVAR])
fi
AC_MSG_CHECKING([for libjvm.so])
- TMPVAR=`find -L "$with_java_home" -type f \( -name libjvm.so -o -name libjvm.dylib \) -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
+ TMPVAR=`find -L "$with_java_home" -type f \( -name libjvm.so -o -name libjvm.dylib \) -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
if test "x$TMPVAR" != "x"
then
AC_MSG_RESULT([found in $TMPVAR])
if test "x$JAVAC" = "x"
then
AC_MSG_CHECKING([for javac])
- TMPVAR=`find -L "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
+ TMPVAR=`find -L "$with_java_home" -name javac -type f 2>/dev/null | LC_ALL=C sort | head -n 1`
if test "x$TMPVAR" != "x"
then
JAVAC="$TMPVAR"
if test "x$JAR" = "x"
then
AC_MSG_CHECKING([for jar])
- TMPVAR=`find -L "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
+ TMPVAR=`find -L "$with_java_home" -name jar -type f 2>/dev/null | LC_ALL=C sort | head -n 1`
if test "x$TMPVAR" != "x"
then
JAR="$TMPVAR"
if (status == 0)
return (0);
- ERROR ("battery plugin: Add available input methods failed.");
+ ERROR ("battery plugin: All available input methods failed.");
return (-1);
} /* }}} int battery_read */
#endif /* KERNEL_LINUX */
# Link to these libraries..
COMMON_LIBS = $(PTHREAD_LIBS)
+if BUILD_WITH_CAPABILITY
+COMMON_LIBS += -lcap
+endif
if BUILD_WITH_LIBRT
COMMON_LIBS += -lrt
endif
# include <arpa/inet.h>
#endif
-#ifdef HAVE_SYS_CAPABILITY_H
+#if HAVE_CAPABILITY
# include <sys/capability.h>
#endif
sfree (array);
} /* }}} void strarray_free */
-#ifdef HAVE_SYS_CAPABILITY_H
-int check_capability (int capability) /* {{{ */
+#if HAVE_CAPABILITY
+int check_capability (int arg) /* {{{ */
{
-#ifdef _LINUX_CAPABILITY_VERSION_3
- cap_user_header_t cap_header = calloc(1, sizeof (*cap_header));
- if (cap_header == NULL)
- {
- ERROR("check_capability: calloc failed");
- return (-1);
- }
+ cap_value_t cap = (cap_value_t) arg;
- cap_user_data_t cap_data = calloc(1, sizeof (*cap_data));
- if (cap_data == NULL)
- {
- ERROR("check_capability: calloc failed");
- sfree(cap_header);
+ if (!CAP_IS_SUPPORTED (cap))
return (-1);
- }
- cap_header->pid = getpid();
- cap_header->version = _LINUX_CAPABILITY_VERSION_3;
- if (capget(cap_header, cap_data) < 0)
- {
- ERROR("check_capability: capget failed");
- sfree(cap_header);
- sfree(cap_data);
+ int have_cap = cap_get_bound (cap);
+ if (have_cap != 1)
return (-1);
- }
- if ((cap_data->effective & (1 << capability)) == 0)
- {
- sfree(cap_header);
- sfree(cap_data);
- return (-1);
- }
- else
- {
- sfree(cap_header);
- sfree(cap_data);
- return (0);
- }
+ return (0);
+} /* }}} int check_capability */
#else
+int check_capability (__attribute__((unused)) int arg) /* {{{ */
+{
WARNING ("check_capability: unsupported capability implementation. "
- "Some plugin(s) may require elevated privileges to work properly.");
+ "Some plugin(s) may require elevated privileges to work properly.");
return (0);
-#endif /* _LINUX_CAPABILITY_VERSION_3 */
} /* }}} int check_capability */
-#endif /* HAVE_SYS_CAPABILITY_H */
+#endif /* HAVE_CAPABILITY */
int read;
read = 0;
+
+ if (vpn_num == 0)
+ return (0);
/* call the right read function for every status entry in the list */
for (int i = 0; i < vpn_num; i++)
if (status_version == 0)
{
- WARNING ("openvpn plugin: unable to detect status version, \
- discarding status file \"%s\".", value);
+ WARNING ("openvpn plugin: unable to detect status version, "
+ "discarding status file \"%s\".", value);
return (1);
}
#define RECURSOR_SOCKET LOCALSTATEDIR"/run/pdns_recursor.controlsocket"
#define RECURSOR_COMMAND "get noerror-answers nxdomain-answers " \
"servfail-answers sys-msec user-msec qa-latency cache-entries cache-hits " \
- "cache-misses questions\n"
+ "cache-misses questions \n"
struct list_item_s;
typedef struct list_item_s list_item_t;
}
memcpy((void *) (buffer + buffer_pos), message, message_len);
buffer_pos += message_len;
+ buffer[buffer_pos] = '\0';
}
sfree (rates);
return (status);
return hash;
}
+/* 31 bit -> 4 byte -> 8 byte hex string + null byte */
+#define KAFKA_RANDOM_KEY_SIZE 9
+#define KAFKA_RANDOM_KEY_BUFFER (char[KAFKA_RANDOM_KEY_SIZE]) {""}
+static char *kafka_random_key(char buffer[static KAFKA_RANDOM_KEY_SIZE])
+{
+ ssnprintf(buffer, KAFKA_RANDOM_KEY_SIZE, "%08lX", (unsigned long) mrand48());
+ return buffer;
+}
+
static int32_t kafka_partition(const rd_kafka_topic_t *rkt,
const void *keydata, size_t keylen,
int32_t partition_cnt, void *p, void *m)
return -1;
}
- key = ctx->key;
- if (key != NULL)
- keylen = strlen (key);
- else
- keylen = 0;
+ key = (ctx->key != NULL)
+ ? ctx->key
+ : kafka_random_key(KAFKA_RANDOM_KEY_BUFFER);
+ keylen = strlen (key);
rd_kafka_produce(ctx->topic, RD_KAFKA_PARTITION_UA,
RD_KAFKA_MSG_F_COPY, buffer, blen,
}
} else if (strcasecmp ("Key", child->key) == 0) {
- cf_util_get_string (child, &tctx->key);
- assert (tctx->key != NULL);
+ if (cf_util_get_string (child, &tctx->key) != 0)
+ continue;
+ if (strcasecmp ("Random", tctx->key) == 0) {
+ sfree(tctx->key);
+ tctx->key = strdup (kafka_random_key (KAFKA_RANDOM_KEY_BUFFER));
+ }
} else if (strcasecmp ("Format", child->key) == 0) {
status = cf_util_get_string(child, &key);
if (status != 0)
za_read_derive (ksp, "mfu_ghost_hits", "cache_result", "mfu_ghost-hit");
za_read_derive (ksp, "mru_hits", "cache_result", "mru-hit");
za_read_derive (ksp, "mru_ghost_hits", "cache_result", "mru_ghost-hit");
- za_read_derive (ksp, "prefetch_metadata_misses", "cache_result", "prefetch_metadata-miss");
/* Ratios */
arc_hits = (gauge_t) get_zfs_value(ksp, "hits");