/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/audit.h> /* IWYU pragma: keep */
#include <linux/liveupdate.h>
#include <math.h>
#include <sys/stat.h>
#include "glyph-util.h"
#include "id128-util.h"
#include "image-policy.h"
+#include "libaudit-util.h" /* IWYU pragma: keep */
#include "log.h"
#include "luo-util.h"
#include "manager.h"
'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',
+++ /dev/null
-/* 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
# SPDX-License-Identifier: LGPL-2.1-or-later
BEGIN{
+ print "#if HAVE_AUDIT"
+ print "# include <libaudit.h>"
+ print "#endif"
+ print ""
print "#include <linux/audit.h>"
print ""
print "#include \"audit-type.h\""
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/audit.h>
#include <linux/sockios.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include "journald-sync.h"
#include "journald-syslog.h"
#include "journald-varlink.h"
+#include "libaudit-util.h"
#include "log.h"
#include "log-ratelimit.h"
#include "memory-util.h"
systemd_journald_extract_sources += journald_gperf_c
generate_audit_type_list = files('generate-audit_type-list.sh')
+generate_audit_type_command = [env, 'bash', generate_audit_type_list, cpp]
+if libaudit.found()
+ generate_audit_type_command += [
+ '-include', 'libaudit.h',
+ '-I' + libaudit.get_variable('includedir'),
+ ]
+endif
+generate_audit_type_command += system_include_args
+
audit_type_list_txt = custom_target(
- input : [generate_audit_type_list, audit_sources],
+ input : [generate_audit_type_list],
output : 'audit_type-list.txt',
- command : [env, 'bash', generate_audit_type_list, cpp, system_include_args],
+ command : generate_audit_type_command,
capture : true)
audit_type_to_name = custom_target(
extern DLSYM_PROTOTYPE(audit_log_user_comm_message);
#endif
+/* libaudit.h defines these constants.
+ * Define them here too so they can be used even when libaudit.h is unavailable. */
+#ifndef AUDIT_SERVICE_START
+# define AUDIT_SERVICE_START 1130 /* Service (daemon) start */
+#else
+assert_cc(AUDIT_SERVICE_START == 1130);
+#endif
+
+#ifndef AUDIT_SERVICE_STOP
+# define AUDIT_SERVICE_STOP 1131 /* Service (daemon) stop */
+#else
+assert_cc(AUDIT_SERVICE_STOP == 1131);
+#endif
+
+#ifndef MAX_AUDIT_MESSAGE_LENGTH
+# define MAX_AUDIT_MESSAGE_LENGTH 8970
+#else
+assert_cc(MAX_AUDIT_MESSAGE_LENGTH == 8970);
+#endif
+
bool use_audit(void);
int close_audit_fd(int fd);