summaryrefslogtreecommitdiff
path: root/tests/39-basic-api_level.py
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2017-09-21 10:27:38 -0400
committerPaul Moore <paul@paul-moore.com>2017-09-21 10:27:38 -0400
commite89d18205c7dcd7582f41051cd6389c9b12dfccf (patch)
tree7632e5aec969b29a20f60d75a8f690b33516c520 /tests/39-basic-api_level.py
parent9e61fd704dbaaa49b3ede59b99f80f39f123075f (diff)
downloadlibseccomp-e89d18205c7dcd7582f41051cd6389c9b12dfccf.tar.gz
api: create an API level construct as part of the supported API
This patch adds the concept of "API levels" which are a way of indicating what functionality is supported at runtime. There are two new API functions added, as explained by the manpage: "The seccomp_api_get() function returns an integer representing the functionality ("API level") provided by the current running kernel. It is important to note that while seccomp_api_get() can be called multiple times, the kernel is only probed the first time to see what functionality is supported, all following calls to seccomp_api_get() return a cached value. The seccomp_api_set() function allows callers to force the API level to the provided value; however, this is almost always a bad idea and use of this function is strongly discouraged." Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'tests/39-basic-api_level.py')
-rwxr-xr-xtests/39-basic-api_level.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/39-basic-api_level.py b/tests/39-basic-api_level.py
new file mode 100755
index 0000000..e958bf1
--- /dev/null
+++ b/tests/39-basic-api_level.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+#
+# Seccomp Library test program
+#
+# Copyright (c) 2016 Red Hat <pmoore@redhat.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>.
+#
+
+import argparse
+import sys
+
+import util
+
+from seccomp import *
+
+# NOTE: this is a NULL test since we don't support the seccomp_version() API
+# via the libseccomp python bindings
+
+# kate: syntax python;
+# kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;