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:
John Johansen 2011-07-21 11:06:57 -07:00
parent 0d9a39bd26
commit 2c110ed3d5

View file

@ -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;