git: 5140ccf2268b - main - MAC: mac.h: Fix missing includes/typedefs

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Mon, 16 Dec 2024 14:45:07 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=5140ccf2268b0e771c89e46f46c60e1fee7637c3

commit 5140ccf2268b0e771c89e46f46c60e1fee7637c3
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-07-29 14:21:52 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-12-16 14:42:26 +0000

    MAC: mac.h: Fix missing includes/typedefs
    
    This fixes inclusion from userspace, and also kernel inclusion for
    source files not including explicitly nor implicitly <sys/types.h>.
    
    Reviewed by:    jamie
    Approved by:    markj (mentor)
    MFC after:      5 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D46896
---
 sys/sys/mac.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sys/sys/mac.h b/sys/sys/mac.h
index facdc14c332d..ae8d8d38f17b 100644
--- a/sys/sys/mac.h
+++ b/sys/sys/mac.h
@@ -47,6 +47,13 @@
 #ifndef _SYS_MAC_H_
 #define	_SYS_MAC_H_
 
+#include <sys/_types.h>
+
+#ifndef _SIZE_T_DECLARED
+typedef	__size_t	size_t;
+#define	_SIZE_T_DECLARED
+#endif
+
 #ifndef _POSIX_MAC
 #define	_POSIX_MAC
 #endif
@@ -72,6 +79,13 @@ typedef struct mac	*mac_t;
 
 #ifndef _KERNEL
 
+#include <sys/cdefs.h> /* For __BEGIN_DECLS and __END_DECLS. */
+
+#ifndef _PID_T_DECLARED
+typedef	__pid_t		pid_t;		/* process id */
+#define	_PID_T_DECLARED
+#endif
+
 /*
  * Location of the userland MAC framework configuration file.  mac.conf
  * set defaults for MAC-aware applications.