/* Linuxthreads - a simple clone()-based implementation of Posix */
/* threads for Linux. */
/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */
/* */
/* This program is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU Library General Public License */
/* as published by the Free Software Foundation; either version 2 */
/* of the License, or (at your option) any later version. */
/* */
/* This program 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 Library General Public License for more details. */
/* Thread creation, initialization, and basic low-level routines */
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <shlib-compat.h>
#include "pthread.h"
#include "internals.h"
#include "spinlock.h"
#include "restart.h"
#include "smp.h"
#include <ldsodefs.h>
#include <tls.h>
#include <locale.h> /* for __uselocale */
#include <version.h>
/* Sanity check. */
#if __ASSUME_REALTIME_SIGNALS && !defined __SIGRTMIN
# error "This must not happen; new kernel assumed but old headers"
#endif
#if !(USE_TLS && HAVE___THREAD)
/* These variables are used by the setup code. */
extern int _errno;
extern int _h_errno;
/* We need the global/static resolver state here. */
# include <resolv.h>
# undef _res
extern struct __res_state _res;
#endif
#ifdef USE_TLS
/* We need only a few variables. */
static pthread_descr manager_thread;
#else
/* Descriptor of the initial thread */
struct _pthread_descr_struct __pthread_initial_thread = {
{
{
.self = &__pthread_initial_thread /* pthread_descr self */
}
},
&__pthread_initial_thread, /* pthread_descr p_nextlive */
&__pthread_initial_thread, /* pthread_descr p_prevlive */
NULL, /* pthread_descr p_nextwaiting */
NULL, /* pthread_descr p_nextlock */
PTHREAD_THREADS_MAX, /* pthread_t p_tid */
0, /* int p_pid */
0, /* int p_priority */
&__pthread_handles[0].h_lock, /* struct _pthread_fastlock * p_lock */
0, /* int p_signal */
NULL, /* sigjmp_buf * p_signal_buf */
NULL, /* sigjmp_buf * p_cancel_buf */
0, /* char p_terminated */
0, /* char p_detached */
0, /* char p_exited */
NULL, /* void * p_retval */
0, /* int p_retval */
NULL, /* pthread_descr p_joining */
NULL, /* struct _pthread_cleanup_buffer * p_cleanup */
0, /* char p_cancelstate */
0, /* char p_canceltype */
0, /* char p_canceled */
NULL, /* char * p_in_sighandler */
0, /* char p_sigwaiting */
PTHREAD_START_ARGS_INITIALIZER(NULL),
/* struct pthread_start_args p_start_args */
{NULL}, /* void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE] */
{NULL}, /* void * p_libc_specific[_LIBC_TSD_KEY_N] */
&_errno, /* int *p_errnop */
0, /* int p_errno */
&_h_errno, /* int *p_h_errnop */
0, /* int p_h_errno */
&_res, /* struct __res_state *p_resp */
{}, /* struct __res_state p_res */
1, /* int p_userstack */
NULL, /* void * p_guardaddr */
0, /* size_t p_guardsize */
0, /* Always index 0 */
0, /* int p_report_events */
{{{0, }}, 0, NULL}, /* td_eventbuf_t p_eventbuf */
__ATOMIC_INITIALIZER, /* struct pthread_atomic p_resume_count */
0, /* char p_woken_by_cancel */
0, /* char p_condvar_avail */
0, /* char p_sem_avail */
NULL, /* struct pthread_extricate_if *p_extricate */
NULL, /* pthread_readlock_info *p_readlock_list; */
NULL, /* pthread_readlock_info *p_readlock_free; */
0 /* int p_untracked_readlock_count; */
};
/* Descriptor of the manager thread; none of this is used but the error
variables, the p_pid and p_priority fields,
and the address for identification. */
#define manager_thread (&__pthread_manager_thread)
struct _pthread_descr_struct __pthread_manager_thread = {
{
{
.self = &__pthread_manager_thread /* pthread_descr self */
}
},
NULL, /* pthread_descr p_nextlive */
NULL, /* pthread_descr p_prevlive */
NULL, /* pthread_descr p_nextwaiting */
NULL, /* pthread_descr p_nextlock */
0, /* int p_tid */
0, /* int p_pid */
0, /* int p_priority */
&__pthread_handles[1].h_lock, /* struct _pthread_fastlock * p_lock */
0, /* int p_signal */
NULL, /* sigjmp_buf * p_signal_buf */
NULL, /* sigjmp_buf * p_cancel_buf */
0, /* char p_terminated */
0, /* char p_detached */
0, /* char p_exited */
NULL, /* void * p_retval */
0, /* int p_retval */
NULL, /* pthread_descr p_joining */
NULL, /* struct _pthread_cleanup_buffer * p_cleanup */
0, /* char p_cancelstate */
0, /* char p_canceltype */
0, /* char p_canceled */
NULL, /* char * p_in_sighandler */
0, /* char p_sigwaiting */
PTHREAD_START_ARGS_INITIALIZER(__pthread_manager),
/* struct pthread_start_args p_start_args */
{NULL}, /* void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE] */
{NULL}, /* void * p_libc_specific[_LIBC_TSD_KEY_N] */
&__pthread_manager_thread.p_errno, /* int *p_errnop */
0, /* int p_errno */
NULL, /* int *p_h_errnop */
0, /* int p_h_errno */
NULL, /* struct __res_state *p_resp */
{}, /* struct __res_state p_res */
0, /* int p_userstack */
NULL, /* void * p_guardaddr */
0, /* size_t p_guardsize */
1, /* Always index 1 */
0, /* int p_report_events */
{{{0, }}, 0, NULL}, /* td_eventbuf_t p_eventbuf */
__ATOMIC_INITIALIZER, /* struct pthread_atomic p_resume_count */
0, /* char p_woken_by_cancel */
0, /* char p_condvar_avail */
0, /* char p_sem_avail */
NULL, /* struct pthread_extricate_if *p_extricate */
NULL, /* pthread_readlock_info *p_readlock_list; */
NULL, /* pthread_readlock_info *p_readlock_free; */
0 /* int p_untracked_readloc
没有合适的资源?快使用搜索试试~ 我知道了~
glibc-linuxthreads-2.3.tar.gz
需积分: 1 0 下载量 55 浏览量
2024-03-04
14:42:31
上传
评论
收藏 238KB GZ 举报
温馨提示
共226个文件
c:127个
h:44个
man:21个
gnu安装包
资源推荐
资源详情
资源评论
收起资源包目录
glibc-linuxthreads-2.3.tar.gz (226个子文件)
README.Xfree3.2 9KB
Banner 51B
Banner 34B
pthread.c 43KB
manager.c 35KB
spinlock.c 21KB
rwlock.c 16KB
timer_routines.c 16KB
mutex.c 10KB
attr.c 9KB
condvar.c 8KB
semaphore.c 8KB
specific.c 7KB
oldsemaphore.c 7KB
cancel.c 7KB
join.c 7KB
wrapsyscall.c 7KB
signals.c 6KB
td_ta_thr_iter.c 5KB
weaks.c 5KB
td_ta_new.c 5KB
timer_create.c 5KB
ex3.c 4KB
td_ta_event_getmsg.c 4KB
tst-cancel.c 4KB
pt-initfini.c 4KB
ecmutex.c 4KB
timer_settime.c 4KB
ptfork.c 4KB
ex11.c 4KB
pt-initfini.c 3KB
pt-initfini.c 3KB
pt-initfini.c 3KB
barrier.c 3KB
pt-initfini.c 3KB
ex13.c 3KB
pt-initfini.c 3KB
pspinlock.c 3KB
ex4.c 3KB
pt-initfini.c 3KB
tst-timer.c 3KB
pspinlock.c 3KB
pspinlock.c 3KB
ex2.c 3KB
ex14.c 3KB
td_thr_tsd.c 3KB
td_ta_map_lwp2thr.c 3KB
td_thr_get_info.c 3KB
ex10.c 3KB
pspinlock.c 3KB
sighandler.c 3KB
ex9.c 3KB
pspinlock.c 3KB
pspinlock.c 3KB
pspinlock.c 3KB
lockfile.c 2KB
ex17.c 2KB
td_ta_map_id2thr.c 2KB
ex5.c 2KB
ptlongjmp.c 2KB
td_thr_validate.c 2KB
pspinlock.c 2KB
pspinlock.c 2KB
td_thr_tls_get_addr.c 2KB
ex8.c 2KB
timer_delete.c 2KB
td_symbol_list.c 2KB
td_thr_event_getmsg.c 2KB
pspinlock.c 2KB
pspinlock.c 2KB
pspinlock.c 2KB
ex18.c 2KB
tst-context.c 2KB
pspinlock.c 2KB
pspinlock.c 2KB
td_thr_set_event.c 2KB
td_thr_clear_event.c 2KB
pspinlock.c 2KB
td_ta_tsd_iter.c 2KB
timer_gettime.c 2KB
td_thr_getgregs.c 2KB
tst-signal.c 2KB
tststack.c 2KB
td_ta_event_addr.c 2KB
td_thr_getfpregs.c 2KB
td_ta_clear_event.c 2KB
td_ta_set_event.c 2KB
td_thr_event_enable.c 2KB
td_ta_delete.c 2KB
no-tsd.c 2KB
td_thr_setfpregs.c 2KB
td_thr_setgregs.c 2KB
errno.c 2KB
ptclock_gettime.c 1KB
td_ta_get_nthreads.c 1KB
timer_getoverr.c 1KB
getcpuclockid.c 1KB
unload.c 1KB
td_ta_setconcurrency.c 1KB
td_ta_enable_stats.c 1KB
共 226 条
- 1
- 2
- 3
资源评论
程序员Chino的日记
- 粉丝: 2807
- 资源: 3万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功