diff options
author | Paul Moore <paul@paul-moore.com> | 2018-09-22 14:15:33 -0400 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2018-09-22 14:15:33 -0400 |
commit | 124117e34978e3ef33d75088388de845709229d3 (patch) | |
tree | f952ea7ee9bf1f02530811f471b09f638593e221 /tools | |
parent | 70df5b32573772cf3d103b7523ee1be14c0251df (diff) | |
download | libseccomp-124117e34978e3ef33d75088388de845709229d3.tar.gz |
tools: add a new tool to detect the current API level
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 6 | ||||
-rw-r--r-- | tools/scmp_api_level.c | 39 |
2 files changed, 44 insertions, 1 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index 70b4aed..f768365 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -27,12 +27,14 @@ bin_PROGRAMS = \ noinst_PROGRAMS = \ scmp_arch_detect \ scmp_bpf_disasm \ - scmp_bpf_sim + scmp_bpf_sim \ + scmp_api_level EXTRA_DIST = check-syntax scmp_app_inspector scmp_bpf_disasm_SOURCES = scmp_bpf_disasm.c bpf.h util.h scmp_bpf_sim_SOURCES = scmp_bpf_sim.c bpf.h util.h +scmp_api_level_SOURCES = scmp_api_level.c scmp_sys_resolver_LDADD = ../src/libseccomp.la scmp_sys_resolver_LDFLAGS = -static @@ -40,3 +42,5 @@ scmp_arch_detect_LDADD = ../src/libseccomp.la scmp_arch_detect_LDFLAGS = -static scmp_bpf_disasm_LDADD = util.la scmp_bpf_sim_LDADD = util.la +scmp_api_level_LDADD = ../src/libseccomp.la +scmp_api_level_LDFLAGS = -static diff --git a/tools/scmp_api_level.c b/tools/scmp_api_level.c new file mode 100644 index 0000000..01ed7b8 --- /dev/null +++ b/tools/scmp_api_level.c @@ -0,0 +1,39 @@ +/** + * API Level Detector + * + * Copyright (c) 2018 Paul Moore <paul@paul-moore.com> + * Author: Paul Moore <paul@paul-moore.com> + */ + +/* + * This library is free software; you can redistribute it and/or modify it + * under the terms of version 2.1 of the GNU Lesser General Public License as + * published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see <http://www.gnu.org/licenses>. + */ + +#include <errno.h> +#include <stdlib.h> +#include <stdio.h> + +#include <seccomp.h> + +/** + * main + */ +int main(int argc, char *argv[]) +{ + unsigned int level; + + level = seccomp_api_get(); + printf("%d\n", level); + + return 0; +} |