1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 
3 #include <stddef.h>
4 
5 #include "alloc-util.h"
6 #include "apparmor-util.h"
7 #include "fileio.h"
8 #include "parse-util.h"
9 
mac_apparmor_use(void)10 bool mac_apparmor_use(void) {
11         static int cached_use = -1;
12 
13         if (cached_use < 0) {
14                 _cleanup_free_ char *p = NULL;
15 
16                 cached_use =
17                         read_one_line_file("/sys/module/apparmor/parameters/enabled", &p) >= 0 &&
18                         parse_boolean(p) > 0;
19         }
20 
21         return cached_use;
22 }
23