[apparmor] [PATCH 1/5] Abstract the libraries getting of the tid
Seth Arnold
seth.arnold at gmail.com
Tue Jul 12 18:51:29 UTC 2011
Should aa_gettid() be moved into a header file for easier reuse in the future?
-----Original Message-----
From: John Johansen <john.johansen at canonical.com>
Sender: apparmor-bounces at lists.ubuntu.com
Date: Tue, 12 Jul 2011 11:49:01
To: <apparmor at lists.ubuntu.com>
Subject: [apparmor] [PATCH 1/5] Abstract the libraries getting of the tid
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
--
AppArmor mailing list
AppArmor at lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
More information about the AppArmor
mailing list