Deleted Added
full compact
thr_init.c (116977) thr_init.c (117706)
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/libkse/thread/thr_init.c 116977 2003-06-28 09:55:02Z davidxu $
33 * $FreeBSD: head/lib/libkse/thread/thr_init.c 117706 2003-07-17 23:02:30Z davidxu $
34 */
35
36/* Allocate space for global thread variables here: */
37#define GLOBAL_PTHREAD_PRIVATE
38
39#include "namespace.h"
40#include <sys/param.h>
41#include <sys/types.h>

--- 212 unchanged lines hidden (view full) ---

254 PANIC("Can't set controlling terminal");
255 }
256
257 /* Initialize pthread private data. */
258 init_private();
259 _kse_init();
260
261 /* Initialize the initial kse and kseg. */
34 */
35
36/* Allocate space for global thread variables here: */
37#define GLOBAL_PTHREAD_PRIVATE
38
39#include "namespace.h"
40#include <sys/param.h>
41#include <sys/types.h>

--- 212 unchanged lines hidden (view full) ---

254 PANIC("Can't set controlling terminal");
255 }
256
257 /* Initialize pthread private data. */
258 init_private();
259 _kse_init();
260
261 /* Initialize the initial kse and kseg. */
262 _kse_initial = _kse_alloc(NULL);
262#ifdef SYSTEM_SCOPE_ONLY
263 _kse_initial = _kse_alloc(NULL, 1);
264#else
265 _kse_initial = _kse_alloc(NULL, 0);
266#endif
263 if (_kse_initial == NULL)
264 PANIC("Can't allocate initial kse.");
265 _kse_initial->k_kseg = _kseg_alloc(NULL);
266 if (_kse_initial->k_kseg == NULL)
267 PANIC("Can't allocate initial kseg.");
267 if (_kse_initial == NULL)
268 PANIC("Can't allocate initial kse.");
269 _kse_initial->k_kseg = _kseg_alloc(NULL);
270 if (_kse_initial->k_kseg == NULL)
271 PANIC("Can't allocate initial kseg.");
272#ifdef SYSTEM_SCOPE_ONLY
273 _kse_initial->k_kseg->kg_flags |= KGF_SINGLE_THREAD;
274#endif
268 _kse_initial->k_schedq = &_kse_initial->k_kseg->kg_schedq;
269
270 TAILQ_INSERT_TAIL(&_kse_initial->k_kseg->kg_kseq, _kse_initial, k_kgqe);
271 _kse_initial->k_kseg->kg_ksecount = 1;
272
273 /* Set the initial thread. */
274 if (curthread == NULL) {
275 /* Create and initialize the initial thread. */

--- 45 unchanged lines hidden (view full) ---

321
322 /* Zero the initial thread structure. */
323 p = thread->alloc_addr;
324 memset(thread, 0, sizeof(struct pthread));
325 thread->alloc_addr = p;
326
327 /* Setup the thread attributes. */
328 thread->attr = _pthread_attr_default;
275 _kse_initial->k_schedq = &_kse_initial->k_kseg->kg_schedq;
276
277 TAILQ_INSERT_TAIL(&_kse_initial->k_kseg->kg_kseq, _kse_initial, k_kgqe);
278 _kse_initial->k_kseg->kg_ksecount = 1;
279
280 /* Set the initial thread. */
281 if (curthread == NULL) {
282 /* Create and initialize the initial thread. */

--- 45 unchanged lines hidden (view full) ---

328
329 /* Zero the initial thread structure. */
330 p = thread->alloc_addr;
331 memset(thread, 0, sizeof(struct pthread));
332 thread->alloc_addr = p;
333
334 /* Setup the thread attributes. */
335 thread->attr = _pthread_attr_default;
329
336#ifdef SYSTEM_SCOPE_ONLY
337 thread->attr.flags |= PTHREAD_SCOPE_SYSTEM;
338#endif
330 /*
331 * Set up the thread stack.
332 *
333 * Create a red zone below the main stack. All other stacks
334 * are constrained to a maximum size by the parameters
335 * passed to mmap(), but this stack is only limited by
336 * resource limits, so this stack needs an explicitly mapped
337 * red zone to protect the thread stack that is just beyond.

--- 120 unchanged lines hidden (view full) ---

458 _lock_destroy(&_rwlock_static_lock);
459 _lock_destroy(&_keytable_lock);
460 }
461
462 /* Initialize everything else. */
463 TAILQ_INIT(&_thread_list);
464 TAILQ_INIT(&_thread_gc_list);
465
339 /*
340 * Set up the thread stack.
341 *
342 * Create a red zone below the main stack. All other stacks
343 * are constrained to a maximum size by the parameters
344 * passed to mmap(), but this stack is only limited by
345 * resource limits, so this stack needs an explicitly mapped
346 * red zone to protect the thread stack that is just beyond.

--- 120 unchanged lines hidden (view full) ---

467 _lock_destroy(&_rwlock_static_lock);
468 _lock_destroy(&_keytable_lock);
469 }
470
471 /* Initialize everything else. */
472 TAILQ_INIT(&_thread_list);
473 TAILQ_INIT(&_thread_gc_list);
474
466 /* Initialize the SIG_DFL dummy handler count. */
467 bzero(_thread_dfl_count, sizeof(_thread_dfl_count));
468
469 /*
470 * Initialize the lock for temporary installation of signal
471 * handlers (to support sigwait() semantics) and for the
472 * process signal mask and pending signal sets.
473 */
474 if (_lock_init(&_thread_signal_lock, LCK_ADAPTIVE,
475 _kse_lock_wait, _kse_lock_wakeup) != 0)
476 PANIC("Cannot initialize _thread_signal_lock");

--- 19 unchanged lines hidden ---
475 /*
476 * Initialize the lock for temporary installation of signal
477 * handlers (to support sigwait() semantics) and for the
478 * process signal mask and pending signal sets.
479 */
480 if (_lock_init(&_thread_signal_lock, LCK_ADAPTIVE,
481 _kse_lock_wait, _kse_lock_wakeup) != 0)
482 PANIC("Cannot initialize _thread_signal_lock");

--- 19 unchanged lines hidden ---