kern_thr.c (170404) | kern_thr.c (171859) |
---|---|
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 170404 2007-06-07 19:45:19Z jhb $"); | 28__FBSDID("$FreeBSD: head/sys/kern/kern_thr.c 171859 2007-08-16 05:26:42Z davidxu $"); |
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> --- 11 unchanged lines hidden (view full) --- 48#include <sys/ucontext.h> 49#include <sys/thr.h> 50#include <sys/rtprio.h> 51#include <sys/umtx.h> 52#include <sys/limits.h> 53 54#include <machine/frame.h> 55 | 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> --- 11 unchanged lines hidden (view full) --- 48#include <sys/ucontext.h> 49#include <sys/thr.h> 50#include <sys/rtprio.h> 51#include <sys/umtx.h> 52#include <sys/limits.h> 53 54#include <machine/frame.h> 55 |
56#include <security/audit/audit.h> 57 |
|
56#ifdef COMPAT_IA32 57 58extern struct sysentvec ia32_freebsd_sysvec; 59 60static inline int 61suword_lwpid(void *addr, lwpid_t lwpid) 62{ 63 int error; --- 268 unchanged lines hidden (view full) --- 332 else 333 tdsignal(p, ttd, uap->sig, NULL); 334 } 335 PROC_UNLOCK(p); 336 return (error); 337} 338 339int | 58#ifdef COMPAT_IA32 59 60extern struct sysentvec ia32_freebsd_sysvec; 61 62static inline int 63suword_lwpid(void *addr, lwpid_t lwpid) 64{ 65 int error; --- 268 unchanged lines hidden (view full) --- 334 else 335 tdsignal(p, ttd, uap->sig, NULL); 336 } 337 PROC_UNLOCK(p); 338 return (error); 339} 340 341int |
342thr_kill2(struct thread *td, struct thr_kill2_args *uap) 343 /* pid_t pid, long id, int sig */ 344{ 345 struct thread *ttd; 346 struct proc *p; 347 int error; 348 349 AUDIT_ARG(signum, uap->sig); 350 351 if (uap->pid == td->td_proc->p_pid) { 352 p = td->td_proc; 353 PROC_LOCK(p); 354 } else if ((p = pfind(uap->pid)) == NULL) { 355 return (ESRCH); 356 } 357 AUDIT_ARG(process, p); 358 359 error = p_cansignal(td, p, uap->sig); 360 if (error == 0) { 361 if (uap->id == -1) { 362 if (uap->sig != 0 && !_SIG_VALID(uap->sig)) { 363 error = EINVAL; 364 } else { 365 error = ESRCH; 366 FOREACH_THREAD_IN_PROC(p, ttd) { 367 if (ttd != td) { 368 error = 0; 369 if (uap->sig == 0) 370 break; 371 tdsignal(p, ttd, uap->sig, NULL); 372 } 373 } 374 } 375 } else { 376 if (uap->id != td->td_tid) 377 ttd = thread_find(p, uap->id); 378 else 379 ttd = td; 380 if (ttd == NULL) 381 error = ESRCH; 382 else if (uap->sig == 0) 383 ; 384 else if (!_SIG_VALID(uap->sig)) 385 error = EINVAL; 386 else 387 tdsignal(p, ttd, uap->sig, NULL); 388 } 389 } 390 PROC_UNLOCK(p); 391 return (error); 392} 393 394int |
|
340thr_suspend(struct thread *td, struct thr_suspend_args *uap) 341 /* const struct timespec *timeout */ 342{ 343 struct timespec ts, *tsp; 344 int error; 345 346 error = 0; 347 tsp = NULL; --- 107 unchanged lines hidden --- | 395thr_suspend(struct thread *td, struct thr_suspend_args *uap) 396 /* const struct timespec *timeout */ 397{ 398 struct timespec ts, *tsp; 399 int error; 400 401 error = 0; 402 tsp = NULL; --- 107 unchanged lines hidden --- |