[apparmor] [PATCH 1/5] Abstract the libraries getting of the tid

John Johansen john.johansen at canonical.com
Tue Jul 12 18:49:01 UTC 2011


Signed-off-by: John Johansen <john.johansen at canonical.com>
---
 libraries/libapparmor/src/kernel_interface.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/libraries/libapparmor/src/kernel_interface.c b/libraries/libapparmor/src/kernel_interface.c
index 06f96ed..4a48799 100644
--- a/libraries/libapparmor/src/kernel_interface.c
+++ b/libraries/libapparmor/src/kernel_interface.c
@@ -37,16 +37,21 @@
 #define default_symbol_version(real, name, version) \
 		__asm__ (".symver " #real "," #name "@@" #version)
 
+static inline pid_t aa_gettid(void)
+{
+#ifdef SYS_gettid
+	return syscall(SYS_gettid);
+#else
+	return getpid();
+#endif
+}
+
 static int setprocattr(const char *path, const char *buf, int len)
 {
 	int rc = -1;
 	int fd, ret, ctlerr = 0;
 	char *ctl = NULL;
-#ifdef SYS_gettid
-	pid_t tid = syscall(SYS_gettid);
-#else
-	pid_t tid = getpid();
-#endif
+	pid_t tid = aa_gettid();
 
 	if (!buf) {
 		errno = EINVAL;
-- 
1.7.5.4




More information about the AppArmor mailing list