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

(cherry picked from commit 5140ccf2268b0e771c89e46f46c60e1fee7637c3)
This commit is contained in:
Olivier Certner 2024-07-29 16:21:52 +02:00
parent fa940dd2bf
commit b1fe5eac37
No known key found for this signature in database
GPG key ID: 8CA13040971E2627

View file

@ -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.