mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 06:45:38 +00:00
Abstract the libraries getting of the tid
Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Kees Cook <kees.cook@canonical.com>
This commit is contained in:
@@ -37,16 +37,21 @@
|
|||||||
#define default_symbol_version(real, name, version) \
|
#define default_symbol_version(real, name, version) \
|
||||||
__asm__ (".symver " #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)
|
static int setprocattr(const char *path, const char *buf, int len)
|
||||||
{
|
{
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
int fd, ret, ctlerr = 0;
|
int fd, ret, ctlerr = 0;
|
||||||
char *ctl = NULL;
|
char *ctl = NULL;
|
||||||
#ifdef SYS_gettid
|
pid_t tid = aa_gettid();
|
||||||
pid_t tid = syscall(SYS_gettid);
|
|
||||||
#else
|
|
||||||
pid_t tid = getpid();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
Reference in New Issue
Block a user