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);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to