Date: Sat, 14 Mar 2015 21:38:52 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280005 - head/sys/sys Message-ID: <201503142138.t2ELcqh6002971@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Sat Mar 14 21:38:51 2015 New Revision: 280005 URL: https://svnweb.freebsd.org/changeset/base/280005 Log: 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. Modified: head/sys/sys/sysctl.h Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Sat Mar 14 21:15:45 2015 (r280004) +++ head/sys/sys/sysctl.h Sat Mar 14 21:38:51 2015 (r280005) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503142138.t2ELcqh6002971>