Deleted Added
full compact
kern_thr.c (220222) kern_thr.c (223825)
1/*-
2 * Copyright (c) 2003, Jeffrey Roberson <jeff@freebsd.org>
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

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003, Jeffrey Roberson <jeff@freebsd.org>
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

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/kern/kern_thr.c 220222 2011-03-31 19:22:11Z trasz $");
28__FBSDID("$FreeBSD: head/sys/kern/kern_thr.c 223825 2011-07-06 20:06:44Z trasz $");
29
30#include "opt_compat.h"
31#include "opt_posix.h"
32#include <sys/param.h>
33#include <sys/kernel.h>
34#include <sys/lock.h>
35#include <sys/mutex.h>
36#include <sys/priv.h>

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

180 case RTP_PRIO_NORMAL:
181 rtp->prio = 0;
182 break;
183 default:
184 return (EINVAL);
185 }
186 }
187
29
30#include "opt_compat.h"
31#include "opt_posix.h"
32#include <sys/param.h>
33#include <sys/kernel.h>
34#include <sys/lock.h>
35#include <sys/mutex.h>
36#include <sys/priv.h>

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

180 case RTP_PRIO_NORMAL:
181 rtp->prio = 0;
182 break;
183 default:
184 return (EINVAL);
185 }
186 }
187
188#ifdef RACCT
188 PROC_LOCK(td->td_proc);
189 error = racct_add(p, RACCT_NTHR, 1);
190 PROC_UNLOCK(td->td_proc);
191 if (error != 0)
192 return (EPROCLIM);
189 PROC_LOCK(td->td_proc);
190 error = racct_add(p, RACCT_NTHR, 1);
191 PROC_UNLOCK(td->td_proc);
192 if (error != 0)
193 return (EPROCLIM);
194#endif
193
194 /* Initialize our td */
195 newtd = thread_alloc(0);
196 if (newtd == NULL) {
197 error = ENOMEM;
198 goto fail;
199 }
200

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

272 }
273 TD_SET_CAN_RUN(newtd);
274 sched_add(newtd, SRQ_BORING);
275 thread_unlock(newtd);
276
277 return (0);
278
279fail:
195
196 /* Initialize our td */
197 newtd = thread_alloc(0);
198 if (newtd == NULL) {
199 error = ENOMEM;
200 goto fail;
201 }
202

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

274 }
275 TD_SET_CAN_RUN(newtd);
276 sched_add(newtd, SRQ_BORING);
277 thread_unlock(newtd);
278
279 return (0);
280
281fail:
282#ifdef RACCT
280 PROC_LOCK(p);
281 racct_sub(p, RACCT_NTHR, 1);
282 PROC_UNLOCK(p);
283 PROC_LOCK(p);
284 racct_sub(p, RACCT_NTHR, 1);
285 PROC_UNLOCK(p);
286#endif
283 return (error);
284}
285
286int
287thr_self(struct thread *td, struct thr_self_args *uap)
288 /* long *id */
289{
290 int error;

--- 261 unchanged lines hidden ---
287 return (error);
288}
289
290int
291thr_self(struct thread *td, struct thr_self_args *uap)
292 /* long *id */
293{
294 int error;

--- 261 unchanged lines hidden ---