Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
44843972
Unverified
Commit
44843972
authored
Mar 29, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: fix thread_local detection
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
be43adcd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
35 deletions
+8
-35
configure.ac
configure.ac
+1
-1
compiler.h
src/lxc/compiler.h
+7
-16
conf.c
src/lxc/conf.c
+0
-6
conf.h
src/lxc/conf.h
+0
-6
initutils.c
src/lxc/initutils.c
+0
-6
No files found.
configure.ac
View file @
44843972
...
@@ -629,7 +629,7 @@ AC_CHECK_DECLS([PR_SET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
...
@@ -629,7 +629,7 @@ AC_CHECK_DECLS([PR_SET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
# Check for some headers
# Check for some headers
AC_CHECK_HEADERS([pty.h sys/memfd.h sys/personality.h sys/resource.h sys/signalfd.h sys/timerfd.h utmpx.h
threads.h
])
AC_CHECK_HEADERS([pty.h sys/memfd.h sys/personality.h sys/resource.h sys/signalfd.h sys/timerfd.h utmpx.h])
AC_CHECK_HEADER([ifaddrs.h],
AC_CHECK_HEADER([ifaddrs.h],
AM_CONDITIONAL(HAVE_IFADDRS_H, true)
AM_CONDITIONAL(HAVE_IFADDRS_H, true)
...
...
src/lxc/compiler.h
View file @
44843972
...
@@ -12,23 +12,14 @@
...
@@ -12,23 +12,14 @@
#include "config.h"
#include "config.h"
#if
defined(HAVE_THREADS_H)
#if
ndef thread_local
#include <threads.h>
#if __STDC_VERSION__ >= 201112L && \
#define THREAD_LOCAL_STORAGE_SUPPORTED
!(defined(__STDC_NO_THREADS__) || \
#elif defined(thread_local
)
(defined(__GNU_LIBRARY__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 16)
)
#define THREAD_LOCAL_STORAGE_SUPPORTED
#define thread_local _Thread_local
#else
#else
#if __STDC_VERSION__ >= 201112L && \
#define thread_local __thread
!(defined(__STDC_NO_THREADS__) || \
#endif
(defined(__GNU_LIBRARY__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 16))
#define thread_local _Thread_local
#define THREAD_LOCAL_STORAGE_SUPPORTED
#else
#define thread_local __thread
#define THREAD_LOCAL_STORAGE_SUPPORTED
#endif
#endif
#endif
#if __GNUC__ >= 7
#if __GNUC__ >= 7
...
...
src/lxc/conf.c
View file @
44843972
...
@@ -104,13 +104,7 @@ lxc_log_define(conf, lxc);
...
@@ -104,13 +104,7 @@ lxc_log_define(conf, lxc);
* The lxc_conf of the container currently being worked on in an API call.
* The lxc_conf of the container currently being worked on in an API call.
* This is used in the error calls.
* This is used in the error calls.
*/
*/
#if defined(THREAD_LOCAL_STORAGE_SUPPORTED)
thread_local
struct
lxc_conf
*
current_config
;
thread_local
struct
lxc_conf
*
current_config
;
#elif defined(ENFORCE_THREAD_SAFETY)
#error ENFORCE_THREAD_SAFETY was set but cannot be guaranteed due to missing TLS
#else
struct
lxc_conf
*
current_config
;
#endif
char
*
lxchook_names
[
NUM_LXC_HOOKS
]
=
{
char
*
lxchook_names
[
NUM_LXC_HOOKS
]
=
{
"pre-start"
,
"pre-start"
,
...
...
src/lxc/conf.h
View file @
44843972
...
@@ -474,13 +474,7 @@ struct lxc_conf {
...
@@ -474,13 +474,7 @@ struct lxc_conf {
__hidden
extern
int
write_id_mapping
(
enum
idtype
idtype
,
pid_t
pid
,
const
char
*
buf
,
size_t
buf_size
)
__hidden
extern
int
write_id_mapping
(
enum
idtype
idtype
,
pid_t
pid
,
const
char
*
buf
,
size_t
buf_size
)
__access_r
(
3
,
4
);
__access_r
(
3
,
4
);
#if defined(THREAD_LOCAL_STORAGE_SUPPORTED)
extern
thread_local
struct
lxc_conf
*
current_config
;
extern
thread_local
struct
lxc_conf
*
current_config
;
#elif defined(ENFORCE_THREAD_SAFETY)
#error ENFORCE_THREAD_SAFETY was set but cannot be guaranteed due to missing TLS
#else
struct
lxc_conf
*
current_config
;
#endif
__hidden
extern
int
run_lxc_hooks
(
const
char
*
name
,
char
*
hook
,
struct
lxc_conf
*
conf
,
char
*
argv
[]);
__hidden
extern
int
run_lxc_hooks
(
const
char
*
name
,
char
*
hook
,
struct
lxc_conf
*
conf
,
char
*
argv
[]);
__hidden
extern
struct
lxc_conf
*
lxc_conf_init
(
void
);
__hidden
extern
struct
lxc_conf
*
lxc_conf_init
(
void
);
...
...
src/lxc/initutils.c
View file @
44843972
...
@@ -54,13 +54,7 @@ const char *lxc_global_config_value(const char *option_name)
...
@@ -54,13 +54,7 @@ const char *lxc_global_config_value(const char *option_name)
};
};
/* placed in the thread local storage pool for non-bionic targets */
/* placed in the thread local storage pool for non-bionic targets */
#if defined(THREAD_LOCAL_STORAGE_SUPPORTED)
static
thread_local
const
char
*
values
[
sizeof
(
options
)
/
sizeof
(
options
[
0
])]
=
{
0
};
static
thread_local
const
char
*
values
[
sizeof
(
options
)
/
sizeof
(
options
[
0
])]
=
{
0
};
#elif defined(ENFORCE_THREAD_SAFETY)
#error ENFORCE_THREAD_SAFETY was set but cannot be guaranteed due to missing TLS
#else
static
const
char
*
values
[
sizeof
(
options
)
/
sizeof
(
options
[
0
])]
=
{
0
};
#endif
/* user_config_path is freed as soon as it is used */
/* user_config_path is freed as soon as it is used */
char
*
user_config_path
=
NULL
;
char
*
user_config_path
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment