Deleted Added
sdiff udiff text old ( 54138 ) new ( 55194 )
full compact
1/*
2 * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $FreeBSD: head/lib/libkse/thread/thr_fork.c 54138 1999-12-04 22:55:59Z deischen $
33 */
34#include <errno.h>
35#include <string.h>
36#include <unistd.h>
37#include <fcntl.h>
38#ifdef _THREAD_SAFE
39#include <pthread.h>
40#include "pthread_private.h"
41
42pid_t
43fork(void)

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

125
126 /* Make sure this isn't the running thread: */
127 if (pthread_save != _thread_run) {
128 /* Remove this thread from the list: */
129 TAILQ_REMOVE(&_thread_list,
130 pthread_save, tle);
131
132 if (pthread_save->attr.stackaddr_attr ==
133 NULL && pthread_save->stack != NULL)
134 if (pthread_save->attr.stacksize_attr
135 == PTHREAD_STACK_DEFAULT) {
136 /*
137 * Default-size stack. Cache
138 * it:
139 */
140 struct stack *spare_stack;
141
142 spare_stack
143 = (pthread_save->stack
144 + PTHREAD_STACK_DEFAULT
145 - sizeof(struct stack));
146 SLIST_INSERT_HEAD(
147 &_stackq,
148 spare_stack,
149 qe);
150 } else
151 /*
152 * Free the stack of
153 * the dead thread:
154 */
155 free(pthread_save->stack);
156
157 if (pthread_save->specific_data != NULL)
158 free(pthread_save->specific_data);
159
160 if (pthread_save->poll_data.fds != NULL)
161 free(pthread_save->poll_data.fds);
162
163 free(pthread_save);

--- 60 unchanged lines hidden ---