pthread.c 17.3 KB
Newer Older
1 2 3 4
/*
 * pthread emulation for re-entrant libcs
 *
 * We can't use pthreads directly, so why not let libcs
5
 * that want pthreads use Wine's own threading instead...
6 7
 *
 * Copyright 1999 Ove Kven
8 9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22 23 24
 */

#include "config.h"
25 26
#include "wine/port.h"

27
#define _GNU_SOURCE /* we may need to override some GNU extensions */
28

29
#include <assert.h>
30 31
#include <errno.h>
#include <stdlib.h>
32 33 34
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
35
#include <string.h>
36 37 38

#include "winbase.h"
#include "thread.h"
39
#include "ntddk.h"
40

41 42 43 44 45 46 47
static int init_done;

void PTHREAD_init_done(void)
{
    init_done = 1;
}

48 49 50 51 52 53 54 55
/* Currently this probably works only for glibc2,
 * which checks for the presence of double-underscore-prepended
 * pthread primitives, and use them if available.
 * If they are not available, the libc defaults to
 * non-threadsafe operation (not good). */

#if defined(__GLIBC__)
#include <pthread.h>
56
#include <signal.h>
57

58
#define PSTR(str) __ASM_NAME(#str)
Ove Kaaven's avatar
Ove Kaaven committed
59

60 61
/* adapt as necessary (a construct like this is used in glibc sources) */
#define strong_alias(orig, alias) \
62 63
 asm(".globl " PSTR(alias) "\n" \
     "\t.set " PSTR(alias) "," PSTR(orig))
64

65 66
/* strong_alias does not work on external symbols (.o format limitation?),
 * so for those, we need to use the pogo stick */
67 68
#if defined(__i386__) && !defined(__PIC__)
/* FIXME: PIC */
69
#define jump_alias(orig, alias) __ASM_GLOBAL_FUNC( alias, "jmp " PSTR(orig))
70 71
#endif

Ove Kaaven's avatar
Ove Kaaven committed
72
/* get necessary libc symbols */
73
#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1) && defined(HAVE___LIBC_FORK)
Ove Kaaven's avatar
Ove Kaaven committed
74 75 76 77 78 79 80 81 82 83
#define LIBC_FORK __libc_fork
#define PTHREAD_FORK __fork
#define ALIAS_FORK
#else
#define LIBC_FORK __fork
#define PTHREAD_FORK fork
#endif
extern pid_t LIBC_FORK(void);

#define LIBC_SIGACTION __sigaction
84 85
extern int LIBC_SIGACTION(int signum,
                         const struct sigaction *act,
86
                         struct sigaction *oldact);
Ove Kaaven's avatar
Ove Kaaven committed
87

88 89 90 91 92
/* NOTE: This is a truly extremely incredibly ugly hack!
 * But it does seem to work... */

/* assume that pthread_mutex_t has room for at least one pointer,
 * and hope that the users of pthread_mutex_t considers it opaque
93
 * (never checks what's in it)
94 95
 * also: assume that static initializer sets pointer to NULL
 */
96 97 98 99
typedef struct {
  CRITICAL_SECTION *critsect;
} *wine_mutex;

100 101 102 103 104
/* see wine_mutex above for comments */
typedef struct {
  RTL_RWLOCK *lock;
} *wine_rwlock;

105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
typedef struct _wine_cleanup {
  void (*routine)(void *);
  void *arg;
} *wine_cleanup;

typedef const void *key_data;

#define FIRST_KEY 0
#define MAX_KEYS 16 /* libc6 doesn't use that many, but... */

#define P_OUTPUT(stuff) write(2,stuff,strlen(stuff))

void __pthread_initialize(void)
{
}

121 122 123
struct pthread_thread_init {
	 void* (*start_routine)(void*);
	 void* arg;
124
};
125 126 127

static DWORD CALLBACK pthread_thread_start(LPVOID data)
{
128
  struct pthread_thread_init init = *(struct pthread_thread_init*)data;
129 130 131 132 133 134 135 136
  HeapFree(GetProcessHeap(),0,data);
  return (DWORD)init.start_routine(init.arg);
}

int pthread_create(pthread_t* thread, const pthread_attr_t* attr, void*
        (*start_routine)(void *), void* arg)
{
  HANDLE hThread;
137
  struct pthread_thread_init* idata = HeapAlloc(GetProcessHeap(), 0,
138 139
		sizeof(struct pthread_thread_init));

140
  idata->start_routine = start_routine;
141 142 143 144 145 146 147 148 149 150
  idata->arg = arg;
  hThread = CreateThread(NULL, 0, pthread_thread_start, idata, 0, thread);

  if(hThread)
    CloseHandle(hThread);
  else
  {
    HeapFree(GetProcessHeap(),0,idata); /* free idata struct on failure */
    return EAGAIN;
  }
151

152 153
  return 0;
}
154

155 156 157
int pthread_cancel(pthread_t thread)
{
  HANDLE hThread = OpenThread(THREAD_ALL_ACCESS, FALSE, thread);
158

159 160 161 162 163
  if(!TerminateThread(hThread, 0))
  {
    CloseHandle(hThread);
    return EINVAL;      /* return error */
  }
164

165
  CloseHandle(hThread);
166

167
  return 0;             /* return success */
168
}
169 170 171 172

int pthread_join(pthread_t thread, void **value_ptr)
{
  HANDLE hThread = OpenThread(THREAD_ALL_ACCESS, FALSE, thread);
173

174 175 176 177 178 179 180 181 182
  WaitForSingleObject(hThread, INFINITE);
  if(!GetExitCodeThread(hThread, (LPDWORD)value_ptr))
  {
    CloseHandle(hThread);
    return EINVAL; /* FIXME: make this more correctly match */
  }                /* windows errors */

  CloseHandle(hThread);
  return 0;
183
}
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205

/*FIXME: not sure what to do with this one... */
int pthread_detach(pthread_t thread)
{
  P_OUTPUT("FIXME:pthread_detach\n");
  return 0;
}

/* FIXME: we have no equivalents in win32 for the policys */
/* so just keep this as a stub */
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
{
  P_OUTPUT("FIXME:pthread_attr_setschedpolicy\n");
  return 0;
}

/* FIXME: no win32 equivalent for scope */
int pthread_attr_setscope(pthread_attr_t *attr, int scope)
{
  P_OUTPUT("FIXME:pthread_attr_setscope\n");
  return 0; /* return success */
}
206

207 208 209 210 211 212 213 214
/* FIXME: no win32 equivalent for schedule param */
int pthread_attr_setschedparam(pthread_attr_t *attr,
    const struct sched_param *param)
{
  P_OUTPUT("FIXME:pthread_attr_setschedparam\n");
  return 0; /* return success */
}

215 216 217
int __pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
{
  static pthread_once_t the_once = PTHREAD_ONCE_INIT;
218
  LONG once_now = *(LONG *)&the_once;
219

220
  if (InterlockedCompareExchange((LONG*)once_control, once_now+1, once_now) == once_now)
221 222 223 224 225
    (*init_routine)();
  return 0;
}
strong_alias(__pthread_once, pthread_once);

226 227
void __pthread_kill_other_threads_np(void)
{
228
    /* we don't need to do anything here */
229 230 231
}
strong_alias(__pthread_kill_other_threads_np, pthread_kill_other_threads_np);

232 233 234 235
/***** atfork *****/

#define MAX_ATFORK 8  /* libc doesn't need that many anyway */

236
static CRITICAL_SECTION atfork_section = CRITICAL_SECTION_INIT("atfork_section");
237 238 239 240 241 242
typedef void (*atfork_handler)();
static atfork_handler atfork_prepare[MAX_ATFORK];
static atfork_handler atfork_parent[MAX_ATFORK];
static atfork_handler atfork_child[MAX_ATFORK];
static int atfork_count;

243 244 245 246
int __pthread_atfork(void (*prepare)(void),
		     void (*parent)(void),
		     void (*child)(void))
{
247
    if (init_done) EnterCriticalSection( &atfork_section );
248 249 250 251 252
    assert( atfork_count < MAX_ATFORK );
    atfork_prepare[atfork_count] = prepare;
    atfork_parent[atfork_count] = parent;
    atfork_child[atfork_count] = child;
    atfork_count++;
253
    if (init_done) LeaveCriticalSection( &atfork_section );
254
    return 0;
255 256 257
}
strong_alias(__pthread_atfork, pthread_atfork);

Ove Kaaven's avatar
Ove Kaaven committed
258 259
pid_t PTHREAD_FORK(void)
{
260 261 262 263 264
    pid_t pid;
    int i;

    EnterCriticalSection( &atfork_section );
    /* prepare handlers are called in reverse insertion order */
265
    for (i = atfork_count - 1; i >= 0; i--) if (atfork_prepare[i]) atfork_prepare[i]();
266 267 268
    if (!(pid = LIBC_FORK()))
    {
        InitializeCriticalSection( &atfork_section );
269
        for (i = 0; i < atfork_count; i++) if (atfork_child[i]) atfork_child[i]();
270 271 272
    }
    else
    {
273
        for (i = 0; i < atfork_count; i++) if (atfork_parent[i]) atfork_parent[i]();
274 275 276
        LeaveCriticalSection( &atfork_section );
    }
    return pid;
Ove Kaaven's avatar
Ove Kaaven committed
277 278 279 280
}
#ifdef ALIAS_FORK
strong_alias(PTHREAD_FORK, fork);
#endif
281 282 283

/***** MUTEXES *****/

284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
int __pthread_mutex_init(pthread_mutex_t *mutex,
                        const pthread_mutexattr_t *mutexattr)
{
  /* glibc has a tendency to initialize mutexes very often, even
     in situations where they are not really used later on.

     As for us, initializing a mutex is very expensive, we postpone
     the real initialization until the time the mutex is first used. */

  ((wine_mutex)mutex)->critsect = NULL;
  return 0;
}
strong_alias(__pthread_mutex_init, pthread_mutex_init);

static void mutex_real_init( pthread_mutex_t *mutex )
{
300
  CRITICAL_SECTION *critsect = HeapAlloc(GetProcessHeap(), 0, sizeof(CRITICAL_SECTION));
301
  InitializeCriticalSection(critsect);
302

303
  if (InterlockedCompareExchangePointer((void**)&(((wine_mutex)mutex)->critsect),critsect,NULL) != NULL) {
304 305
    /* too late, some other thread already did it */
    DeleteCriticalSection(critsect);
306
    HeapFree(GetProcessHeap(), 0, critsect);
307 308 309 310 311
  }
}

int __pthread_mutex_lock(pthread_mutex_t *mutex)
{
312
  if (!init_done) return 0;
313
  if (!((wine_mutex)mutex)->critsect)
314 315 316 317 318 319 320 321 322
    mutex_real_init( mutex );

  EnterCriticalSection(((wine_mutex)mutex)->critsect);
  return 0;
}
strong_alias(__pthread_mutex_lock, pthread_mutex_lock);

int __pthread_mutex_trylock(pthread_mutex_t *mutex)
{
323
  if (!init_done) return 0;
324
  if (!((wine_mutex)mutex)->critsect)
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
    mutex_real_init( mutex );

  if (!TryEnterCriticalSection(((wine_mutex)mutex)->critsect)) {
    errno = EBUSY;
    return -1;
  }
  return 0;
}
strong_alias(__pthread_mutex_trylock, pthread_mutex_trylock);

int __pthread_mutex_unlock(pthread_mutex_t *mutex)
{
  if (!((wine_mutex)mutex)->critsect) return 0;
  LeaveCriticalSection(((wine_mutex)mutex)->critsect);
  return 0;
}
strong_alias(__pthread_mutex_unlock, pthread_mutex_unlock);

int __pthread_mutex_destroy(pthread_mutex_t *mutex)
{
  if (!((wine_mutex)mutex)->critsect) return 0;
  if (((wine_mutex)mutex)->critsect->RecursionCount) {
#if 0 /* there seems to be a bug in libc6 that makes this a bad idea */
    return EBUSY;
#else
    while (((wine_mutex)mutex)->critsect->RecursionCount)
      LeaveCriticalSection(((wine_mutex)mutex)->critsect);
#endif
  }
  DeleteCriticalSection(((wine_mutex)mutex)->critsect);
355
  HeapFree(GetProcessHeap(), 0, ((wine_mutex)mutex)->critsect);
356 357 358 359
  return 0;
}
strong_alias(__pthread_mutex_destroy, pthread_mutex_destroy);

360 361 362

/***** MUTEX ATTRIBUTES *****/
/* just dummies, since critical sections are always recursive */
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401

int __pthread_mutexattr_init(pthread_mutexattr_t *attr)
{
  return 0;
}
strong_alias(__pthread_mutexattr_init, pthread_mutexattr_init);

int __pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
{
  return 0;
}
strong_alias(__pthread_mutexattr_destroy, pthread_mutexattr_destroy);

int __pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
{
  return 0;
}
strong_alias(__pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np);

int __pthread_mutexattr_getkind_np(pthread_mutexattr_t *attr, int *kind)
{
  *kind = PTHREAD_MUTEX_RECURSIVE_NP;
  return 0;
}
strong_alias(__pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np);

int __pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind)
{
  return 0;
}
strong_alias(__pthread_mutexattr_settype, pthread_mutexattr_settype);

int __pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *kind)
{
  *kind = PTHREAD_MUTEX_RECURSIVE_NP;
  return 0;
}
strong_alias(__pthread_mutexattr_gettype, pthread_mutexattr_gettype);

402 403 404

/***** THREAD-SPECIFIC VARIABLES (KEYS) *****/

405 406
int __pthread_key_create(pthread_key_t *key, void (*destr_function)(void *))
{
407 408
  static LONG keycnt = FIRST_KEY;
  *key = InterlockedExchangeAdd(&keycnt, 1);
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
  return 0;
}
strong_alias(__pthread_key_create, pthread_key_create);

int __pthread_key_delete(pthread_key_t key)
{
  return 0;
}
strong_alias(__pthread_key_delete, pthread_key_delete);

int __pthread_setspecific(pthread_key_t key, const void *pointer)
{
  TEB *teb = NtCurrentTeb();
  if (!teb->pthread_data) {
    teb->pthread_data = calloc(MAX_KEYS,sizeof(key_data));
  }
  ((key_data*)(teb->pthread_data))[key] = pointer;
  return 0;
}
strong_alias(__pthread_setspecific, pthread_setspecific);

void *__pthread_getspecific(pthread_key_t key)
{
  TEB *teb = NtCurrentTeb();
  if (!teb) return NULL;
  if (!teb->pthread_data) return NULL;
  return (void *)(((key_data*)(teb->pthread_data))[key]);
}
strong_alias(__pthread_getspecific, pthread_getspecific);

439 440 441 442

/***** "EXCEPTION" FRAMES *****/
/* not implemented right now */

443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463
void _pthread_cleanup_push(struct _pthread_cleanup_buffer *buffer, void (*routine)(void *), void *arg)
{
  ((wine_cleanup)buffer)->routine = routine;
  ((wine_cleanup)buffer)->arg = arg;
}

void _pthread_cleanup_pop(struct _pthread_cleanup_buffer *buffer, int execute)
{
  if (execute) (*(((wine_cleanup)buffer)->routine))(((wine_cleanup)buffer)->arg);
}

void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer *buffer, void (*routine)(void *), void *arg)
{
  _pthread_cleanup_push(buffer, routine, arg);
}

void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer *buffer, int execute)
{
  _pthread_cleanup_pop(buffer, execute);
}

464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516

/***** CONDITIONS *****/
/* not implemented right now */

int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr)
{
  P_OUTPUT("FIXME:pthread_cond_init\n");
  return 0;
}

int pthread_cond_destroy(pthread_cond_t *cond)
{
  P_OUTPUT("FIXME:pthread_cond_destroy\n");
  return 0;
}

int pthread_cond_signal(pthread_cond_t *cond)
{
  P_OUTPUT("FIXME:pthread_cond_signal\n");
  return 0;
}

int pthread_cond_broadcast(pthread_cond_t *cond)
{
  P_OUTPUT("FIXME:pthread_cond_broadcast\n");
  return 0;
}

int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
  P_OUTPUT("FIXME:pthread_cond_wait\n");
  return 0;
}

int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
{
  P_OUTPUT("FIXME:pthread_cond_timedwait\n");
  return 0;
}

/**** CONDITION ATTRIBUTES *****/
/* not implemented right now */

int pthread_condattr_init(pthread_condattr_t *attr)
{
  return 0;
}

int pthread_condattr_destroy(pthread_condattr_t *attr)
{
  return 0;
}

517 518
#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2)
/***** READ-WRITE LOCKS *****/
519 520 521 522 523 524 525 526 527 528 529 530

static void rwlock_real_init(pthread_rwlock_t *rwlock)
{
  RTL_RWLOCK *lock = HeapAlloc(GetProcessHeap(), 0, sizeof(RTL_RWLOCK));
  RtlInitializeResource(lock);

  if (InterlockedCompareExchangePointer((void**)&(((wine_rwlock)rwlock)->lock),lock,NULL) != NULL) {
    /* too late, some other thread already did it */
    RtlDeleteResource(lock);
    HeapFree(GetProcessHeap(), 0, lock);
  }
}
531 532 533

int __pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *rwlock_attr)
{
534
  ((wine_rwlock)rwlock)->lock = NULL;
535 536 537 538 539 540
  return 0;
}
strong_alias(__pthread_rwlock_init, pthread_rwlock_init);

int __pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
{
541 542 543
  if (!((wine_rwlock)rwlock)->lock) return 0;
  RtlDeleteResource(((wine_rwlock)rwlock)->lock);
  HeapFree(GetProcessHeap(), 0, ((wine_rwlock)rwlock)->lock);
544 545 546 547 548 549
  return 0;
}
strong_alias(__pthread_rwlock_destroy, pthread_rwlock_destroy);

int __pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
{
550 551 552 553 554 555 556
  if (!init_done) return 0;
  if (!((wine_rwlock)rwlock)->lock)
    rwlock_real_init( rwlock );

  while(TRUE)
    if (RtlAcquireResourceShared(((wine_rwlock)rwlock)->lock, TRUE))
      return 0;
557 558 559 560 561
}
strong_alias(__pthread_rwlock_rdlock, pthread_rwlock_rdlock);

int __pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
{
562 563 564 565 566 567 568 569
  if (!init_done) return 0;
  if (!((wine_rwlock)rwlock)->lock)
    rwlock_real_init( rwlock );

  if (!RtlAcquireResourceShared(((wine_rwlock)rwlock)->lock, FALSE)) {
    errno = EBUSY;
    return -1;
  }
570 571 572 573 574 575
  return 0;
}
strong_alias(__pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock);

int __pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
{
576 577 578 579 580 581 582
  if (!init_done) return 0;
  if (!((wine_rwlock)rwlock)->lock)
    rwlock_real_init( rwlock );

  while(TRUE)
    if (RtlAcquireResourceExclusive(((wine_rwlock)rwlock)->lock, TRUE))
      return 0;
583 584 585 586 587
}
strong_alias(__pthread_rwlock_wrlock, pthread_rwlock_wrlock);

int __pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
{
588 589 590 591 592 593 594 595
  if (!init_done) return 0;
  if (!((wine_rwlock)rwlock)->lock)
    rwlock_real_init( rwlock );

  if (!RtlAcquireResourceExclusive(((wine_rwlock)rwlock)->lock, FALSE)) {
    errno = EBUSY;
    return -1;
  }
596 597 598 599 600 601
  return 0;
}
strong_alias(__pthread_rwlock_trywrlock, pthread_rwlock_trywrlock);

int __pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
{
602 603
  if (!((wine_rwlock)rwlock)->lock) return 0;
  RtlReleaseResource( ((wine_rwlock)rwlock)->lock );
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633
  return 0;
}
strong_alias(__pthread_rwlock_unlock, pthread_rwlock_unlock);

/**** READ-WRITE LOCK ATTRIBUTES *****/
/* not implemented right now */

int pthread_rwlockattr_init(pthread_rwlockattr_t *attr)
{
  return 0;
}

int __pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
{
  return 0;
}
strong_alias(__pthread_rwlockattr_destroy, pthread_rwlockattr_destroy);

int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *attr, int *pref)
{
  *pref = 0;
  return 0;
}

int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *attr, int pref)
{
  return 0;
}
#endif /* glibc 2.2 */

634 635
/***** MISC *****/

636 637 638 639 640 641 642 643 644 645
pthread_t pthread_self(void)
{
  return (pthread_t)GetCurrentThreadId();
}

int pthread_equal(pthread_t thread1, pthread_t thread2)
{
  return (DWORD)thread1 == (DWORD)thread2;
}

646 647
void pthread_exit(void *retval)
{
Ove Kaaven's avatar
Ove Kaaven committed
648
  /* FIXME: pthread cleanup */
649 650 651
  ExitThread((DWORD)retval);
}

652 653 654 655 656 657
int pthread_setcanceltype(int type, int *oldtype)
{
  if (oldtype) *oldtype = PTHREAD_CANCEL_ASYNCHRONOUS;
  return 0;
}

658 659 660 661
/***** ANTI-OVERRIDES *****/
/* pthreads tries to override these, point them back to libc */

#ifdef jump_alias
Ove Kaaven's avatar
Ove Kaaven committed
662
jump_alias(LIBC_SIGACTION, sigaction);
663 664 665
#else
int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
{
Ove Kaaven's avatar
Ove Kaaven committed
666
  return LIBC_SIGACTION(signum, act, oldact);
667 668 669
}
#endif

670
#endif /* __GLIBC__ */