From 8a0d2c613bf1342e228618918b8628c6764a61b4 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Sat, 14 Mar 2015 21:38:51 +0000 Subject: [PATCH] Define a convenience macro, SYSCTL_OUT_STR() for handling strings the standard way (including the nulterm byte in the data returned to userland). This augments the existing sysctl_handle_string() in that this can be used with const strings without ugly inappropriate casting. --- sys/sys/sysctl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index f3173c28707..988dbae9408 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -186,6 +186,7 @@ struct sysctl_oid { #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) #define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l) +#define SYSCTL_OUT_STR(r, p) (r->oldfunc)(r, p, strlen(p) + 1) int sysctl_handle_int(SYSCTL_HANDLER_ARGS); int sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS);