thr_init.c (160662) | thr_init.c (161068) |
---|---|
1/* 2 * Copyright (c) 2003 Daniel M. Eischen <deischen@freebsd.org> 3 * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 2003 Daniel M. Eischen <deischen@freebsd.org> 3 * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/lib/libthr/thread/thr_init.c 160662 2006-07-25 12:50:05Z davidxu $ | 33 * $FreeBSD: head/lib/libthr/thread/thr_init.c 161068 2006-08-08 04:42:41Z davidxu $ |
34 */ 35 36#include "namespace.h" 37#include <sys/types.h> 38#include <sys/signalvar.h> 39#include <sys/ioctl.h> 40#include <sys/sysctl.h> 41#include <sys/ttycom.h> --- 52 unchanged lines hidden (view full) --- 94 95/* Default condition variable attributes: */ 96struct pthread_cond_attr _pthread_condattr_default = { 97 .c_pshared = PTHREAD_PROCESS_PRIVATE, 98 .c_clockid = CLOCK_REALTIME 99}; 100 101pid_t _thr_pid; | 34 */ 35 36#include "namespace.h" 37#include <sys/types.h> 38#include <sys/signalvar.h> 39#include <sys/ioctl.h> 40#include <sys/sysctl.h> 41#include <sys/ttycom.h> --- 52 unchanged lines hidden (view full) --- 94 95/* Default condition variable attributes: */ 96struct pthread_cond_attr _pthread_condattr_default = { 97 .c_pshared = PTHREAD_PROCESS_PRIVATE, 98 .c_clockid = CLOCK_REALTIME 99}; 100 101pid_t _thr_pid; |
102int _thr_smp_cpus = 1; |
|
102size_t _thr_guard_default; 103size_t _thr_stack_default = THR_STACK_DEFAULT; 104size_t _thr_stack_initial = THR_STACK_INITIAL; 105int _thr_page_size; 106int _gc_count; 107umtx_t _mutex_static_lock; 108umtx_t _cond_static_lock; 109umtx_t _rwlock_static_lock; --- 328 unchanged lines hidden (view full) --- 438 */ 439 if (init_once == 0) { 440 /* Find the stack top */ 441 mib[0] = CTL_KERN; 442 mib[1] = KERN_USRSTACK; 443 len = sizeof (_usrstack); 444 if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1) 445 PANIC("Cannot get kern.usrstack from sysctl"); | 103size_t _thr_guard_default; 104size_t _thr_stack_default = THR_STACK_DEFAULT; 105size_t _thr_stack_initial = THR_STACK_INITIAL; 106int _thr_page_size; 107int _gc_count; 108umtx_t _mutex_static_lock; 109umtx_t _cond_static_lock; 110umtx_t _rwlock_static_lock; --- 328 unchanged lines hidden (view full) --- 439 */ 440 if (init_once == 0) { 441 /* Find the stack top */ 442 mib[0] = CTL_KERN; 443 mib[1] = KERN_USRSTACK; 444 len = sizeof (_usrstack); 445 if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1) 446 PANIC("Cannot get kern.usrstack from sysctl"); |
447 len = sizeof(_thr_smp_cpus); 448 sysctlbyname("kern.smp.cpus", &_thr_smp_cpus, &len, NULL, 0); |
|
446 _thr_page_size = getpagesize(); 447 _thr_guard_default = _thr_page_size; 448 _pthread_attr_default.guardsize_attr = _thr_guard_default; 449 _pthread_attr_default.stacksize_attr = _thr_stack_default; 450 451 TAILQ_INIT(&_thr_atfork_list); 452#ifdef SYSTEM_SCOPE_ONLY 453 _thr_scope_system = 1; 454#else 455 if (getenv("LIBPTHREAD_SYSTEM_SCOPE") != NULL) 456 _thr_scope_system = 1; 457 else if (getenv("LIBPTHREAD_PROCESS_SCOPE") != NULL) 458 _thr_scope_system = -1; 459#endif 460 } 461 init_once = 1; 462} | 449 _thr_page_size = getpagesize(); 450 _thr_guard_default = _thr_page_size; 451 _pthread_attr_default.guardsize_attr = _thr_guard_default; 452 _pthread_attr_default.stacksize_attr = _thr_stack_default; 453 454 TAILQ_INIT(&_thr_atfork_list); 455#ifdef SYSTEM_SCOPE_ONLY 456 _thr_scope_system = 1; 457#else 458 if (getenv("LIBPTHREAD_SYSTEM_SCOPE") != NULL) 459 _thr_scope_system = 1; 460 else if (getenv("LIBPTHREAD_PROCESS_SCOPE") != NULL) 461 _thr_scope_system = -1; 462#endif 463 } 464 init_once = 1; 465} |