configure: check whether gettid() is declared

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2016-11-25 20:02:24 +01:00
parent b5e3950161
commit 6a22e86258
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D
2 changed files with 15 additions and 1 deletions

View File

@ -628,7 +628,7 @@ AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
# Check for some syscalls functions
AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat])
AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid])
# Check for some functions
AC_CHECK_LIB(pthread, main)

View File

@ -45,6 +45,20 @@
#define LXC_LOG_DATEFOMAT_SIZE 15
#ifndef HAVE_GETTID
static inline pid_t gettid(void)
{
#ifdef __NR_gettid
return (pid_t)syscall(SYS_gettid);
#else
errno = ENOSYS;
return -1;
#endif
}
#else
extern pid_t gettid(void);
#endif
int lxc_log_fd = -1;
static int syslog_enable = 0;
int lxc_quiet_specified;