/* Linuxthreads - a simple clone()-based implementation of Posix */
/* threads for Linux. */
/* Copyright (C) 1996 Xavier Leroy ([email protected]) */
/* */
/* 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/sysctl.h>
#include <shlib-compat.h>
#include "pthread.h"
#include "internals.h"
#include "spinlock.h"
#include "restart.h"
/* We need the global/static resolver state here. */
#include <resolv.h>
#undef _res
extern struct __res_state _res;
/* Sanity check. */
#if __ASSUME_REALTIME_SIGNALS && !defined __SIGRTMIN
# error "This must not happen; new kernel assumed but old headers"
#endif
/* These variables are used by the setup code. */
extern int _errno;
extern int _h_errno;
/* Descriptor of the initial thread */
struct _pthread_descr_struct __pthread_initial_thread = {
{
{
&__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 */
&_errno, /* int *p_errnop */
0, /* int p_errno */
&_h_errno, /* int *p_h_errnop */
0, /* int p_h_errno */
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] */
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. */
struct _pthread_descr_struct __pthread_manager_thread = {
{
{
&__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 */
&__pthread_manager_thread.p_errno, /* int *p_errnop */
0, /* int p_errno */
NULL, /* int *p_h_errnop */
0, /* int p_h_errno */
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] */
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_readlock_count; */
};
/* Pointer to the main thread (the father of the thread manager thread) */
/* Originally, this is the initial thread, but this changes after fork() */
pthread_descr __pthread_main_thread = &__pthread_initial_thread;
/* Limit between the stack of the initial thread (above) and the
stacks of other threads (below). Aligned on a STACK_SIZE boundary. */
char *__pthread_initial_thread_bos;
/* File descriptor for sending requests to the thread manager. */
/* Initially -1, meaning that the th
没有合适的资源?快使用搜索试试~ 我知道了~
glibc-linuxthreads-2.2.3.tar.gz
需积分: 1 0 下载量 44 浏览量
2024-03-04
13:07:59
上传
评论
收藏 210KB GZ 举报
温馨提示
共198个文件
c:112个
h:37个
man:20个
gnu安装包
资源推荐
资源详情
资源评论
收起资源包目录
glibc-linuxthreads-2.2.3.tar.gz (198个子文件)
README.Xfree3.2 9KB
Banner 51B
Banner 33B
pthread.c 37KB
manager.c 31KB
spinlock.c 21KB
rwlock.c 16KB
timer_routines.c 15KB
mutex.c 10KB
semaphore.c 9KB
attr.c 9KB
condvar.c 8KB
signals.c 7KB
oldsemaphore.c 7KB
join.c 7KB
cancel.c 7KB
wrapsyscall.c 6KB
specific.c 6KB
weaks.c 5KB
timer_create.c 5KB
td_ta_thr_iter.c 4KB
td_ta_new.c 4KB
ex3.c 4KB
td_ta_event_getmsg.c 4KB
tst-cancel.c 4KB
pt-initfini.c 4KB
ecmutex.c 4KB
ptfork.c 4KB
timer_settime.c 4KB
ex11.c 4KB
pt-initfini.c 3KB
pt-initfini.c 3KB
pt-initfini.c 3KB
barrier.c 3KB
ex13.c 3KB
pspinlock.c 3KB
ex4.c 3KB
pt-initfini.c 3KB
tst-timer.c 3KB
pspinlock.c 3KB
ex2.c 3KB
ex14.c 3KB
pspinlock.c 3KB
td_thr_tsd.c 3KB
pspinlock.c 3KB
ex10.c 3KB
td_thr_get_info.c 3KB
pspinlock.c 3KB
pspinlock.c 3KB
pspinlock.c 3KB
td_ta_map_lwp2thr.c 2KB
ex9.c 2KB
ptlongjmp.c 2KB
ex5.c 2KB
pspinlock.c 2KB
lockfile.c 2KB
ex8.c 2KB
td_ta_map_id2thr.c 2KB
timer_delete.c 2KB
pspinlock.c 2KB
pspinlock.c 2KB
pspinlock.c 2KB
ex17.c 2KB
pspinlock.c 2KB
pspinlock.c 2KB
td_symbol_list.c 2KB
td_thr_event_getmsg.c 2KB
pspinlock.c 2KB
td_thr_validate.c 2KB
td_thr_clear_event.c 2KB
td_ta_tsd_iter.c 2KB
td_thr_set_event.c 2KB
timer_gettime.c 2KB
td_ta_event_addr.c 2KB
tststack.c 2KB
td_ta_clear_event.c 2KB
td_ta_set_event.c 2KB
td_ta_delete.c 2KB
td_thr_getfpregs.c 2KB
td_thr_getgregs.c 2KB
td_thr_setfpregs.c 2KB
td_thr_setgregs.c 2KB
no-tsd.c 2KB
ptclock_gettime.c 1KB
errno.c 1KB
td_ta_get_nthreads.c 1KB
timer_getoverr.c 1KB
td_thr_event_enable.c 1KB
getcpuclockid.c 1KB
unload.c 1KB
td_ta_setconcurrency.c 1KB
td_ta_enable_stats.c 1KB
td_log.c 1KB
td_ta_get_stats.c 1KB
td_ta_reset_stats.c 1KB
td_ta_get_ph.c 1KB
td_thr_setsigpending.c 1KB
td_thr_getxregsize.c 1KB
ptclock_settime.c 1KB
td_thr_setxregs.c 1KB
共 198 条
- 1
- 2
资源评论
程序员Chino的日记
- 粉丝: 2874
- 资源: 4万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功