bin/56595: sys/mac.h, sys/mac_policy.h cannot be used as is in C++

KONDOU, Kazuhiro kazuhiro at alib.jp
Mon Sep 8 08:50:24 PDT 2003


>Number:         56595
>Category:       bin
>Synopsis:       sys/mac.h, sys/mac_policy.h cannot be used as is in C++
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 08 08:50:21 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     "KONDOU, Kazuhiro"
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
>Environment:
System: FreeBSD lilia.alib.jp 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Sat Sep  6 14:08:48 JST 2003     root@:/usr/obj/usr/src/sys/REAH  i386 

>Description:

sys/mac.h and sys/mac_policy.h cannot be used as is in C++ code.
because function prototypes doesn't exist between __BEGIN_DECLS and
__END_DECLS.


>How-To-Repeat:

#include <sys/mac.h> or #include <sys/mac_policy.h> in C++ code.


>Fix:

apply following patch.


diff -urdN old/mac.h new/mac.h
--- old/mac.h	Tue Sep  9 00:16:24 2003
+++ new/mac.h	Tue Sep  9 00:39:23 2003
@@ -76,6 +76,7 @@
  * Extended non-POSIX.1e interfaces that offer additional services
  * available from the userland and kernel MAC frameworks.
  */
+__BEGIN_DECLS
 int		 mac_execve(char *fname, char **argv, char **envv,
 		    mac_t _label);
 int		 mac_free(mac_t _label);
@@ -97,6 +98,7 @@
 int		 mac_set_proc(const mac_t _label);
 int		 mac_syscall(const char *_policyname, int _call, void *_arg);
 int		 mac_to_text(mac_t mac, char **_text);
+__END_DECLS
 
 #else /* _KERNEL */
 
diff -urdN old/mac_policy.h new/mac_policy.h
--- old/mac_policy.h	Tue Sep  9 00:16:35 2003
+++ new/mac_policy.h	Tue Sep  9 00:21:44 2003
@@ -471,7 +471,9 @@
 	DECLARE_MODULE(mpname, mpname##_mod, SI_SUB_MAC_POLICY,		\
 	    SI_ORDER_MIDDLE)
 
+__BEGIN_DECLS
 int	mac_policy_modevent(module_t mod, int type, void *data);
+__END_DECLS
 
 #define	LABEL_TO_SLOT(l, s)	(l)->l_perpolicy[s]
 
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list