kern_exit.c (edf6699ae624a4f38c6fada19397372caadfa9e5) kern_exit.c (5215b1872feaad7ecf7cb1234749ecf04071deef)
1/*
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

142 p = td->td_proc;
143 if (p == initproc) {
144 printf("init died (signal %d, exit %d)\n",
145 WTERMSIG(rv), WEXITSTATUS(rv));
146 panic("Going nowhere without my init!");
147 }
148
149 /*
1/*
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

142 p = td->td_proc;
143 if (p == initproc) {
144 printf("init died (signal %d, exit %d)\n",
145 WTERMSIG(rv), WEXITSTATUS(rv));
146 panic("Going nowhere without my init!");
147 }
148
149 /*
150 * XXXXKSE: MUST abort all other threads before proceeding past here.
150 * XXXKSE: MUST abort all other threads before proceeding past here.
151 */
152 PROC_LOCK(p);
153 if (p->p_flag & P_KSES) {
154 /*
155 * First check if some other thread got here before us..
156 * if so, act apropriatly, (exit or suspend);
157 */
158 thread_suspend_check(0);
151 */
152 PROC_LOCK(p);
153 if (p->p_flag & P_KSES) {
154 /*
155 * First check if some other thread got here before us..
156 * if so, act apropriatly, (exit or suspend);
157 */
158 thread_suspend_check(0);
159 /*
160 * Here is a trick..
161 * We need to free up our KSE to process other threads
162 * so that we can safely set the UNBOUND flag
163 * (whether or not we have a mailbox) as we are NEVER
164 * going to return to the user.
165 * The flag will not be set yet if we are exiting
166 * because of a signal, pagefault, or similar
167 * (or even an exit(2) from the UTS).
168 */
169 td->td_flags |= TDF_UNBOUND;
170
171 /*
172 * Kill off the other threads. This requires
173 * Some co-operation from other parts of the kernel
174 * so it may not be instant.
175 * With this state set:
176 * Any thread entering the kernel from userspace will
177 * thread_exit() in trap(). Any thread attempting to

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

187 }
188 /*
189 * All other activity in this process is now stopped.
190 * Remove excess KSEs and KSEGRPS. XXXKSE (when we have them)
191 * ...
192 * Turn off threading support.
193 */
194 p->p_flag &= ~P_KSES;
159
160 /*
161 * Kill off the other threads. This requires
162 * Some co-operation from other parts of the kernel
163 * so it may not be instant.
164 * With this state set:
165 * Any thread entering the kernel from userspace will
166 * thread_exit() in trap(). Any thread attempting to

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

176 }
177 /*
178 * All other activity in this process is now stopped.
179 * Remove excess KSEs and KSEGRPS. XXXKSE (when we have them)
180 * ...
181 * Turn off threading support.
182 */
183 p->p_flag &= ~P_KSES;
195 td->td_flags &= ~TDF_UNBOUND;
196 thread_single_end(); /* Don't need this any more. */
197 }
198 /*
199 * With this state set:
200 * Any thread entering the kernel from userspace will thread_exit()
201 * in trap(). Any thread attempting to sleep will return immediatly
202 * with EINTR or EWOULDBLOCK, which will hopefully force them
203 * to back out to userland, freeing resources as they go, and

--- 676 unchanged lines hidden ---
184 thread_single_end(); /* Don't need this any more. */
185 }
186 /*
187 * With this state set:
188 * Any thread entering the kernel from userspace will thread_exit()
189 * in trap(). Any thread attempting to sleep will return immediatly
190 * with EINTR or EWOULDBLOCK, which will hopefully force them
191 * to back out to userland, freeing resources as they go, and

--- 676 unchanged lines hidden ---