Bug 153654

Summary: [patch] incorrect include in sysctl.9
Product: Documentation Reporter: Joris Dedieu <joris.dedieu>
Component: Books & ArticlesAssignee: freebsd-doc (Nobody) <doc>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Joris Dedieu 2011-01-03 18:00:24 UTC
Has DATA_SET is defined in sys/kernel.h most SYSTL_* macros don't work if you don't include it.
Comment 1 John Baldwin freebsd_committer freebsd_triage 2011-01-03 19:06:18 UTC
<sys/kernel.h> does not include <sys/types.h>.  Plus, all of <sys/kernel.h>
is not needed.  <sys/linker_set.h> is what defines DATA_SET().  This is
probably the "right" set of includes:

#include <sys/types.h>
#include <sys/linker_set.h>
#include <sys/sysctl.h>

OTOH, <sysctl.h> should perhaps have a nested include of <sys/linker_set.h>
in the #ifdef _KERNEL case in which case the manpage would not need changing.

-- 
John Baldwin
Comment 2 Joris Dedieu 2011-01-07 11:58:21 UTC
You are right. My patch is wrong and your solution sounds better.
Should I submit an other pr ?

Joris
Comment 3 dfilter service freebsd_committer freebsd_triage 2011-01-10 20:59:25 UTC
Author: jhb
Date: Mon Jan 10 20:59:19 2011
New Revision: 217239
URL: http://svn.freebsd.org/changeset/base/217239

Log:
  Add a nested include of <sys/linker_set.h> to make the sysctl(9) manpage
  accurate.  <sys/linker_set.h> is one of the very few headers similar to
  <sys/queue.h> for which nested includes is allowed.
  
  PR:		docs/153654
  Reviewed by:	bde
  MFC after:	1 month

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==============================================================================
--- head/sys/sys/sysctl.h	Mon Jan 10 20:56:59 2011	(r217238)
+++ head/sys/sys/sysctl.h	Mon Jan 10 20:59:19 2011	(r217239)
@@ -115,6 +115,8 @@ struct ctlname {
 #define CTL_AUTO_START	0x100
 
 #ifdef _KERNEL
+#include <sys/linker_set.h>
+
 #define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
 	struct sysctl_req *req
 
_______________________________________________
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-unsubscribe@freebsd.org"
Comment 4 John Baldwin freebsd_committer freebsd_triage 2011-01-10 21:30:31 UTC
State Changed
From-To: open->closed

bde@ agreed to add a nested include to <sys/sysctl.h> so that the manpage 
is now correct.