Commit 2f7bb8780af4a007e90045b4cc97f558e956adf9

Authored by Juan Quintela
Committed by Anthony Liguori
1 parent 75b5a697

rename USE_NPTL to CONFIG_USE_NPTL

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
bsd-user/mmap.c
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 30
31 //#define DEBUG_MMAP 31 //#define DEBUG_MMAP
32 32
33 -#if defined(USE_NPTL) 33 +#if defined(CONFIG_USE_NPTL)
34 pthread_mutex_t mmap_mutex; 34 pthread_mutex_t mmap_mutex;
35 static int __thread mmap_lock_count; 35 static int __thread mmap_lock_count;
36 36
bsd-user/qemu.h
@@ -24,7 +24,7 @@ enum BSDType { @@ -24,7 +24,7 @@ enum BSDType {
24 #include "target_signal.h" 24 #include "target_signal.h"
25 #include "gdbstub.h" 25 #include "gdbstub.h"
26 26
27 -#if defined(USE_NPTL) 27 +#if defined(CONFIG_USE_NPTL)
28 #define THREAD __thread 28 #define THREAD __thread
29 #else 29 #else
30 #define THREAD 30 #define THREAD
@@ -188,7 +188,7 @@ void mmap_lock(void); @@ -188,7 +188,7 @@ void mmap_lock(void);
188 void mmap_unlock(void); 188 void mmap_unlock(void);
189 void cpu_list_lock(void); 189 void cpu_list_lock(void);
190 void cpu_list_unlock(void); 190 void cpu_list_unlock(void);
191 -#if defined(USE_NPTL) 191 +#if defined(CONFIG_USE_NPTL)
192 void mmap_fork_start(void); 192 void mmap_fork_start(void);
193 void mmap_fork_end(int child); 193 void mmap_fork_end(int child);
194 #endif 194 #endif
@@ -382,7 +382,7 @@ static inline void *lock_user_string(abi_ulong guest_addr) @@ -382,7 +382,7 @@ static inline void *lock_user_string(abi_ulong guest_addr)
382 #define unlock_user_struct(host_ptr, guest_addr, copy) \ 382 #define unlock_user_struct(host_ptr, guest_addr, copy) \
383 unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0) 383 unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0)
384 384
385 -#if defined(USE_NPTL) 385 +#if defined(CONFIG_USE_NPTL)
386 #include <pthread.h> 386 #include <pthread.h>
387 #endif 387 #endif
388 388
configure
@@ -2056,7 +2056,7 @@ if test &quot;$target_user_only&quot; = &quot;yes&quot; -a &quot;$bflt&quot; = &quot;yes&quot;; then @@ -2056,7 +2056,7 @@ if test &quot;$target_user_only&quot; = &quot;yes&quot; -a &quot;$bflt&quot; = &quot;yes&quot;; then
2056 fi 2056 fi
2057 if test "$target_user_only" = "yes" \ 2057 if test "$target_user_only" = "yes" \
2058 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 2058 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2059 - echo "USE_NPTL=y" >> $config_mak 2059 + echo "CONFIG_USE_NPTL=y" >> $config_mak
2060 fi 2060 fi
2061 # 32 bit ELF loader in addition to native 64 bit loader? 2061 # 32 bit ELF loader in addition to native 64 bit loader?
2062 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then 2062 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
create_config
@@ -46,10 +46,6 @@ case $line in @@ -46,10 +46,6 @@ case $line in
46 value=${line#*=} 46 value=${line#*=}
47 echo "#define $name $value" 47 echo "#define $name $value"
48 ;; 48 ;;
49 - USE_NPTL=y) # configuration  
50 - name=${line%=*}  
51 - echo "#define $name 1"  
52 - ;;  
53 esac 49 esac
54 50
55 done # read 51 done # read
@@ -1515,7 +1515,7 @@ void cpu_set_log_filename(const char *filename) @@ -1515,7 +1515,7 @@ void cpu_set_log_filename(const char *filename)
1515 1515
1516 static void cpu_unlink_tb(CPUState *env) 1516 static void cpu_unlink_tb(CPUState *env)
1517 { 1517 {
1518 -#if defined(USE_NPTL) 1518 +#if defined(CONFIG_USE_NPTL)
1519 /* FIXME: TB unchaining isn't SMP safe. For now just ignore the 1519 /* FIXME: TB unchaining isn't SMP safe. For now just ignore the
1520 problem and hope the cpu will stop of its own accord. For userspace 1520 problem and hope the cpu will stop of its own accord. For userspace
1521 emulation this often isn't actually as bad as it sounds. Often 1521 emulation this often isn't actually as bad as it sounds. Often
gdbstub.c
@@ -1592,7 +1592,7 @@ static void gdb_set_cpu_pc(GDBState *s, target_ulong pc) @@ -1592,7 +1592,7 @@ static void gdb_set_cpu_pc(GDBState *s, target_ulong pc)
1592 1592
1593 static inline int gdb_id(CPUState *env) 1593 static inline int gdb_id(CPUState *env)
1594 { 1594 {
1595 -#if defined(CONFIG_USER_ONLY) && defined(USE_NPTL) 1595 +#if defined(CONFIG_USER_ONLY) && defined(CONFIG_USE_NPTL)
1596 return env->host_tid; 1596 return env->host_tid;
1597 #else 1597 #else
1598 return env->cpu_index + 1; 1598 return env->cpu_index + 1;
linux-user/main.c
@@ -108,7 +108,7 @@ int64_t cpu_get_real_ticks(void) @@ -108,7 +108,7 @@ int64_t cpu_get_real_ticks(void)
108 108
109 #endif 109 #endif
110 110
111 -#if defined(USE_NPTL) 111 +#if defined(CONFIG_USE_NPTL)
112 /***********************************************************/ 112 /***********************************************************/
113 /* Helper routines for implementing atomic operations. */ 113 /* Helper routines for implementing atomic operations. */
114 114
@@ -222,7 +222,7 @@ void cpu_list_unlock(void) @@ -222,7 +222,7 @@ void cpu_list_unlock(void)
222 { 222 {
223 pthread_mutex_unlock(&cpu_list_mutex); 223 pthread_mutex_unlock(&cpu_list_mutex);
224 } 224 }
225 -#else /* if !USE_NPTL */ 225 +#else /* if !CONFIG_USE_NPTL */
226 /* These are no-ops because we are not threadsafe. */ 226 /* These are no-ops because we are not threadsafe. */
227 static inline void cpu_exec_start(CPUState *env) 227 static inline void cpu_exec_start(CPUState *env)
228 { 228 {
@@ -2357,7 +2357,7 @@ THREAD CPUState *thread_env; @@ -2357,7 +2357,7 @@ THREAD CPUState *thread_env;
2357 void task_settid(TaskState *ts) 2357 void task_settid(TaskState *ts)
2358 { 2358 {
2359 if (ts->ts_tid == 0) { 2359 if (ts->ts_tid == 0) {
2360 -#ifdef USE_NPTL 2360 +#ifdef CONFIG_USE_NPTL
2361 ts->ts_tid = (pid_t)syscall(SYS_gettid); 2361 ts->ts_tid = (pid_t)syscall(SYS_gettid);
2362 #else 2362 #else
2363 /* when no threads are used, tid becomes pid */ 2363 /* when no threads are used, tid becomes pid */
linux-user/mmap.c
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 33
34 //#define DEBUG_MMAP 34 //#define DEBUG_MMAP
35 35
36 -#if defined(USE_NPTL) 36 +#if defined(CONFIG_USE_NPTL)
37 pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER; 37 pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER;
38 static int __thread mmap_lock_count; 38 static int __thread mmap_lock_count;
39 39
linux-user/qemu.h
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 #include "gdbstub.h" 20 #include "gdbstub.h"
21 #include "sys-queue.h" 21 #include "sys-queue.h"
22 22
23 -#if defined(USE_NPTL) 23 +#if defined(CONFIG_USE_NPTL)
24 #define THREAD __thread 24 #define THREAD __thread
25 #else 25 #else
26 #define THREAD 26 #define THREAD
@@ -104,7 +104,7 @@ typedef struct TaskState { @@ -104,7 +104,7 @@ typedef struct TaskState {
104 uint32_t v86flags; 104 uint32_t v86flags;
105 uint32_t v86mask; 105 uint32_t v86mask;
106 #endif 106 #endif
107 -#ifdef USE_NPTL 107 +#ifdef CONFIG_USE_NPTL
108 abi_ulong child_tidptr; 108 abi_ulong child_tidptr;
109 #endif 109 #endif
110 #ifdef TARGET_M68K 110 #ifdef TARGET_M68K
@@ -244,7 +244,7 @@ void mmap_unlock(void); @@ -244,7 +244,7 @@ void mmap_unlock(void);
244 abi_ulong mmap_find_vma(abi_ulong, abi_ulong); 244 abi_ulong mmap_find_vma(abi_ulong, abi_ulong);
245 void cpu_list_lock(void); 245 void cpu_list_lock(void);
246 void cpu_list_unlock(void); 246 void cpu_list_unlock(void);
247 -#if defined(USE_NPTL) 247 +#if defined(CONFIG_USE_NPTL)
248 void mmap_fork_start(void); 248 void mmap_fork_start(void);
249 void mmap_fork_end(int child); 249 void mmap_fork_end(int child);
250 #endif 250 #endif
@@ -441,7 +441,7 @@ static inline void *lock_user_string(abi_ulong guest_addr) @@ -441,7 +441,7 @@ static inline void *lock_user_string(abi_ulong guest_addr)
441 #define unlock_user_struct(host_ptr, guest_addr, copy) \ 441 #define unlock_user_struct(host_ptr, guest_addr, copy) \
442 unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0) 442 unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0)
443 443
444 -#if defined(USE_NPTL) 444 +#if defined(CONFIG_USE_NPTL)
445 #include <pthread.h> 445 #include <pthread.h>
446 #endif 446 #endif
447 447
linux-user/syscall.c
@@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
82 #include "qemu.h" 82 #include "qemu.h"
83 #include "qemu-common.h" 83 #include "qemu-common.h"
84 84
85 -#if defined(USE_NPTL) 85 +#if defined(CONFIG_USE_NPTL)
86 #define CLONE_NPTL_FLAGS2 (CLONE_SETTLS | \ 86 #define CLONE_NPTL_FLAGS2 (CLONE_SETTLS | \
87 CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID) 87 CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)
88 #else 88 #else
@@ -219,7 +219,7 @@ _syscall1(int,exit_group,int,error_code) @@ -219,7 +219,7 @@ _syscall1(int,exit_group,int,error_code)
219 #if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address) 219 #if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address)
220 _syscall1(int,set_tid_address,int *,tidptr) 220 _syscall1(int,set_tid_address,int *,tidptr)
221 #endif 221 #endif
222 -#if defined(USE_NPTL) 222 +#if defined(CONFIG_USE_NPTL)
223 #if defined(TARGET_NR_futex) && defined(__NR_futex) 223 #if defined(TARGET_NR_futex) && defined(__NR_futex)
224 _syscall6(int,sys_futex,int *,uaddr,int,op,int,val, 224 _syscall6(int,sys_futex,int *,uaddr,int,op,int,val,
225 const struct timespec *,timeout,int *,uaddr2,int,val3) 225 const struct timespec *,timeout,int *,uaddr2,int,val3)
@@ -3458,7 +3458,7 @@ static abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr) @@ -3458,7 +3458,7 @@ static abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr)
3458 3458
3459 #endif /* defined(TARGET_I386) */ 3459 #endif /* defined(TARGET_I386) */
3460 3460
3461 -#if defined(USE_NPTL) 3461 +#if defined(CONFIG_USE_NPTL)
3462 3462
3463 #define NEW_STACK_SIZE PTHREAD_STACK_MIN 3463 #define NEW_STACK_SIZE PTHREAD_STACK_MIN
3464 3464
@@ -3527,7 +3527,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp, @@ -3527,7 +3527,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
3527 TaskState *ts; 3527 TaskState *ts;
3528 uint8_t *new_stack; 3528 uint8_t *new_stack;
3529 CPUState *new_env; 3529 CPUState *new_env;
3530 -#if defined(USE_NPTL) 3530 +#if defined(CONFIG_USE_NPTL)
3531 unsigned int nptl_flags; 3531 unsigned int nptl_flags;
3532 sigset_t sigmask; 3532 sigset_t sigmask;
3533 #endif 3533 #endif
@@ -3538,7 +3538,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp, @@ -3538,7 +3538,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
3538 3538
3539 if (flags & CLONE_VM) { 3539 if (flags & CLONE_VM) {
3540 TaskState *parent_ts = (TaskState *)env->opaque; 3540 TaskState *parent_ts = (TaskState *)env->opaque;
3541 -#if defined(USE_NPTL) 3541 +#if defined(CONFIG_USE_NPTL)
3542 new_thread_info info; 3542 new_thread_info info;
3543 pthread_attr_t attr; 3543 pthread_attr_t attr;
3544 #endif 3544 #endif
@@ -3552,7 +3552,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp, @@ -3552,7 +3552,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
3552 new_env->opaque = ts; 3552 new_env->opaque = ts;
3553 ts->bprm = parent_ts->bprm; 3553 ts->bprm = parent_ts->bprm;
3554 ts->info = parent_ts->info; 3554 ts->info = parent_ts->info;
3555 -#if defined(USE_NPTL) 3555 +#if defined(CONFIG_USE_NPTL)
3556 nptl_flags = flags; 3556 nptl_flags = flags;
3557 flags &= ~CLONE_NPTL_FLAGS2; 3557 flags &= ~CLONE_NPTL_FLAGS2;
3558 3558
@@ -3621,7 +3621,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp, @@ -3621,7 +3621,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
3621 /* Child Process. */ 3621 /* Child Process. */
3622 cpu_clone_regs(env, newsp); 3622 cpu_clone_regs(env, newsp);
3623 fork_end(1); 3623 fork_end(1);
3624 -#if defined(USE_NPTL) 3624 +#if defined(CONFIG_USE_NPTL)
3625 /* There is a race condition here. The parent process could 3625 /* There is a race condition here. The parent process could
3626 theoretically read the TID in the child process before the child 3626 theoretically read the TID in the child process before the child
3627 tid is set. This would require using either ptrace 3627 tid is set. This would require using either ptrace
@@ -4016,7 +4016,7 @@ static inline abi_long host_to_target_stat64(void *cpu_env, @@ -4016,7 +4016,7 @@ static inline abi_long host_to_target_stat64(void *cpu_env,
4016 } 4016 }
4017 #endif 4017 #endif
4018 4018
4019 -#if defined(USE_NPTL) 4019 +#if defined(CONFIG_USE_NPTL)
4020 /* ??? Using host futex calls even when target atomic operations 4020 /* ??? Using host futex calls even when target atomic operations
4021 are not really atomic probably breaks things. However implementing 4021 are not really atomic probably breaks things. However implementing
4022 futexes locally would make futexes shared between multiple processes 4022 futexes locally would make futexes shared between multiple processes
@@ -4126,7 +4126,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, @@ -4126,7 +4126,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
4126 4126
4127 switch(num) { 4127 switch(num) {
4128 case TARGET_NR_exit: 4128 case TARGET_NR_exit:
4129 -#ifdef USE_NPTL 4129 +#ifdef CONFIG_USE_NPTL
4130 /* In old applications this may be used to implement _exit(2). 4130 /* In old applications this may be used to implement _exit(2).
4131 However in threaded applictions it is used for thread termination, 4131 However in threaded applictions it is used for thread termination,
4132 and _exit_group is used for application termination. 4132 and _exit_group is used for application termination.
@@ -6828,7 +6828,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, @@ -6828,7 +6828,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
6828 } 6828 }
6829 break; 6829 break;
6830 #endif 6830 #endif
6831 -#if defined(USE_NPTL) 6831 +#if defined(CONFIG_USE_NPTL)
6832 case TARGET_NR_futex: 6832 case TARGET_NR_futex:
6833 ret = do_futex(arg1, arg2, arg3, arg4, arg5, arg6); 6833 ret = do_futex(arg1, arg2, arg3, arg4, arg5, arg6);
6834 break; 6834 break;
qemu-lock.h
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 likely to release it soon. In environments where you have more threads 23 likely to release it soon. In environments where you have more threads
24 than physical CPUs (the extreme case being a single CPU host) a spinlock 24 than physical CPUs (the extreme case being a single CPU host) a spinlock
25 simply wastes CPU until the OS decides to preempt it. */ 25 simply wastes CPU until the OS decides to preempt it. */
26 -#if defined(USE_NPTL) 26 +#if defined(CONFIG_USE_NPTL)
27 27
28 #include <pthread.h> 28 #include <pthread.h>
29 #define spin_lock pthread_mutex_lock 29 #define spin_lock pthread_mutex_lock