svn commit: r280005 - head/sys/sys

Ian Lepore ian at FreeBSD.org
Sat Mar 14 21:38:52 UTC 2015


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);


More information about the svn-src-head mailing list