include: do not override kernel headers with libaudit headers

Overriding <linux/audit.h> to implicitly include <libaudit.h> turns out to
be problematic. Because <linux/audit.h> is pulled in by various other kernel
headers, any source file including those kernel headers indirectly ends up
depending on <libaudit.h>, even if the executable or library being built
does not require libaudit at all.

Let's drop the override header and include <libaudit.h> only where explicitly
needed. This also moves the fallback definitions of AUDIT_SERVICE_* and
MAX_AUDIT_MESSAGE_LENGTH to libaudit-util.h.
This commit is contained in:
Yu Watanabe
2026-07-03 17:25:34 +09:00
parent 193749a52e
commit 0d06dbabc3
7 changed files with 37 additions and 42 deletions
-5
View File
@@ -33,11 +33,6 @@ ipproto_sources = files(
'uapi/linux/in.h',
)
# Source files that provides AUDIT_XYZ
audit_sources = files(
'override/linux/audit.h',
)
# Source files that provides KEY_XYZ
keyboard_sources = files(
'uapi/linux/input.h',
-33
View File
@@ -1,33 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include_next <linux/audit.h> /* IWYU pragma: export */
#if HAVE_AUDIT
# include <libaudit.h> /* IWYU pragma: export */
#endif
#include <assert.h>
/* We use static_assert() directly here instead of assert_cc()
* because if we include macro.h in this header, the invocation
* of generate-audit_type-list.sh becomes more complex.
*/
#ifndef AUDIT_SERVICE_START
# define AUDIT_SERVICE_START 1130 /* Service (daemon) start */
#else
static_assert(AUDIT_SERVICE_START == 1130, "");
#endif
#ifndef AUDIT_SERVICE_STOP
# define AUDIT_SERVICE_STOP 1131 /* Service (daemon) stop */
#else
static_assert(AUDIT_SERVICE_STOP == 1131, "");
#endif
#ifndef MAX_AUDIT_MESSAGE_LENGTH
# define MAX_AUDIT_MESSAGE_LENGTH 8970
#else
static_assert(MAX_AUDIT_MESSAGE_LENGTH == 8970, "");
#endif