@@ -111,13 +111,8 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
111
111
112
112
#include "qemu.h"
113
113
114
- #if defined(CONFIG_USE_NPTL )
115
114
#define CLONE_NPTL_FLAGS2 (CLONE_SETTLS | \
116
115
CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)
117
- #else
118
- /* XXX: Hardcode the above values. */
119
- #define CLONE_NPTL_FLAGS2 0
120
- #endif
121
116
122
117
//#define DEBUG
123
118
@@ -234,12 +229,10 @@ _syscall1(int,exit_group,int,error_code)
234
229
#if defined(TARGET_NR_set_tid_address ) && defined(__NR_set_tid_address )
235
230
_syscall1 (int ,set_tid_address ,int * ,tidptr )
236
231
#endif
237
- #if defined(CONFIG_USE_NPTL )
238
232
#if defined(TARGET_NR_futex ) && defined(__NR_futex )
239
233
_syscall6 (int ,sys_futex ,int * ,uaddr ,int ,op ,int ,val ,
240
234
const struct timespec * ,timeout ,int * ,uaddr2 ,int ,val3 )
241
235
#endif
242
- #endif
243
236
#define __NR_sys_sched_getaffinity __NR_sched_getaffinity
244
237
_syscall3 (int , sys_sched_getaffinity , pid_t , pid , unsigned int , len ,
245
238
unsigned long * , user_mask_ptr );
@@ -4227,7 +4220,6 @@ abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr)
4227
4220
4228
4221
#define NEW_STACK_SIZE 0x40000
4229
4222
4230
- #if defined(CONFIG_USE_NPTL )
4231
4223
4232
4224
static pthread_mutex_t clone_lock = PTHREAD_MUTEX_INITIALIZER ;
4233
4225
typedef struct {
@@ -4272,16 +4264,6 @@ static void *clone_func(void *arg)
4272
4264
/* never exits */
4273
4265
return NULL ;
4274
4266
}
4275
- #else
4276
-
4277
- static int clone_func (void * arg )
4278
- {
4279
- CPUArchState * env = arg ;
4280
- cpu_loop (env );
4281
- /* never exits */
4282
- return 0 ;
4283
- }
4284
- #endif
4285
4267
4286
4268
/* do_fork() Must return host values and target errnos (unlike most
4287
4269
do_*() functions). */
@@ -4292,23 +4274,18 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
4292
4274
int ret ;
4293
4275
TaskState * ts ;
4294
4276
CPUArchState * new_env ;
4295
- #if defined(CONFIG_USE_NPTL )
4296
4277
unsigned int nptl_flags ;
4297
4278
sigset_t sigmask ;
4298
- #else
4299
- uint8_t * new_stack ;
4300
- #endif
4301
4279
4302
4280
/* Emulate vfork() with fork() */
4303
4281
if (flags & CLONE_VFORK )
4304
4282
flags &= ~(CLONE_VFORK | CLONE_VM );
4305
4283
4306
4284
if (flags & CLONE_VM ) {
4307
4285
TaskState * parent_ts = (TaskState * )env -> opaque ;
4308
- #if defined(CONFIG_USE_NPTL )
4309
4286
new_thread_info info ;
4310
4287
pthread_attr_t attr ;
4311
- #endif
4288
+
4312
4289
ts = g_malloc0 (sizeof (TaskState ));
4313
4290
init_task_state (ts );
4314
4291
/* we create a new CPU instance. */
@@ -4321,7 +4298,6 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
4321
4298
new_env -> opaque = ts ;
4322
4299
ts -> bprm = parent_ts -> bprm ;
4323
4300
ts -> info = parent_ts -> info ;
4324
- #if defined(CONFIG_USE_NPTL )
4325
4301
nptl_flags = flags ;
4326
4302
flags &= ~CLONE_NPTL_FLAGS2 ;
4327
4303
@@ -4371,17 +4347,6 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
4371
4347
pthread_cond_destroy (& info .cond );
4372
4348
pthread_mutex_destroy (& info .mutex );
4373
4349
pthread_mutex_unlock (& clone_lock );
4374
- #else
4375
- if (flags & CLONE_NPTL_FLAGS2 )
4376
- return - EINVAL ;
4377
- /* This is probably going to die very quickly, but do it anyway. */
4378
- new_stack = g_malloc0 (NEW_STACK_SIZE );
4379
- #ifdef __ia64__
4380
- ret = __clone2 (clone_func , new_stack , NEW_STACK_SIZE , flags , new_env );
4381
- #else
4382
- ret = clone (clone_func , new_stack + NEW_STACK_SIZE , flags , new_env );
4383
- #endif
4384
- #endif
4385
4350
} else {
4386
4351
/* if no CLONE_VM, we consider it is a fork */
4387
4352
if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2 )) != 0 )
@@ -4392,7 +4357,6 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
4392
4357
/* Child Process. */
4393
4358
cpu_clone_regs (env , newsp );
4394
4359
fork_end (1 );
4395
- #if defined(CONFIG_USE_NPTL )
4396
4360
/* There is a race condition here. The parent process could
4397
4361
theoretically read the TID in the child process before the child
4398
4362
tid is set. This would require using either ptrace
@@ -4408,7 +4372,6 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
4408
4372
cpu_set_tls (env , newtls );
4409
4373
if (flags & CLONE_CHILD_CLEARTID )
4410
4374
ts -> child_tidptr = child_tidptr ;
4411
- #endif
4412
4375
} else {
4413
4376
fork_end (0 );
4414
4377
}
@@ -4834,7 +4797,6 @@ static inline abi_long host_to_target_stat64(void *cpu_env,
4834
4797
}
4835
4798
#endif
4836
4799
4837
- #if defined(CONFIG_USE_NPTL )
4838
4800
/* ??? Using host futex calls even when target atomic operations
4839
4801
are not really atomic probably breaks things. However implementing
4840
4802
futexes locally would make futexes shared between multiple processes
@@ -4886,7 +4848,6 @@ static int do_futex(target_ulong uaddr, int op, int val, target_ulong timeout,
4886
4848
return - TARGET_ENOSYS ;
4887
4849
}
4888
4850
}
4889
- #endif
4890
4851
4891
4852
/* Map host to target signal numbers for the wait family of syscalls.
4892
4853
Assume all other status bits are the same. */
@@ -5132,9 +5093,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
5132
5093
abi_long arg5 , abi_long arg6 , abi_long arg7 ,
5133
5094
abi_long arg8 )
5134
5095
{
5135
- #ifdef CONFIG_USE_NPTL
5136
5096
CPUState * cpu = ENV_GET_CPU (cpu_env );
5137
- #endif
5138
5097
abi_long ret ;
5139
5098
struct stat st ;
5140
5099
struct statfs stfs ;
@@ -5148,7 +5107,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
5148
5107
5149
5108
switch (num ) {
5150
5109
case TARGET_NR_exit :
5151
- #ifdef CONFIG_USE_NPTL
5152
5110
/* In old applications this may be used to implement _exit(2).
5153
5111
However in threaded applictions it is used for thread termination,
5154
5112
and _exit_group is used for application termination.
@@ -5186,7 +5144,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
5186
5144
g_free (ts );
5187
5145
pthread_exit (NULL );
5188
5146
}
5189
- #endif
5190
5147
#ifdef TARGET_GPROF
5191
5148
_mcleanup ();
5192
5149
#endif
@@ -8687,11 +8644,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
8687
8644
}
8688
8645
break ;
8689
8646
#endif
8690
- #if defined(CONFIG_USE_NPTL )
8691
8647
case TARGET_NR_futex :
8692
8648
ret = do_futex (arg1 , arg2 , arg3 , arg4 , arg5 , arg6 );
8693
8649
break ;
8694
- #endif
8695
8650
#if defined(TARGET_NR_inotify_init ) && defined(__NR_inotify_init )
8696
8651
case TARGET_NR_inotify_init :
8697
8652
ret = get_errno (sys_inotify_init ());
0 commit comments