kern_prot.c (101173) | kern_prot.c (109623) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1990, 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. --- 23 unchanged lines hidden (view full) --- 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)kern_prot.c 8.6 (Berkeley) 1/21/94 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1990, 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. --- 23 unchanged lines hidden (view full) --- 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)kern_prot.c 8.6 (Berkeley) 1/21/94 |
40 * $FreeBSD: head/sys/kern/kern_prot.c 101173 2002-08-01 17:47:56Z rwatson $ | 40 * $FreeBSD: head/sys/kern/kern_prot.c 109623 2003-01-21 08:56:16Z alfred $ |
41 */ 42 43/* 44 * System calls related to processes and protection 45 */ 46 47#include "opt_compat.h" 48#include "opt_mac.h" --- 291 unchanged lines hidden (view full) --- 340 int error; 341 struct proc *p = td->td_proc; 342 struct pgrp *newpgrp; 343 struct session *newsess; 344 345 error = 0; 346 pgrp = NULL; 347 | 41 */ 42 43/* 44 * System calls related to processes and protection 45 */ 46 47#include "opt_compat.h" 48#include "opt_mac.h" --- 291 unchanged lines hidden (view full) --- 340 int error; 341 struct proc *p = td->td_proc; 342 struct pgrp *newpgrp; 343 struct session *newsess; 344 345 error = 0; 346 pgrp = NULL; 347 |
348 MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); 349 MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO); | 348 MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_ZERO); 349 MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_ZERO); |
350 351 sx_xlock(&proctree_lock); 352 353 if (p->p_pgid == p->p_pid || (pgrp = pgfind(p->p_pid)) != NULL) { 354 if (pgrp != NULL) 355 PGRP_UNLOCK(pgrp); 356 error = EPERM; 357 } else { --- 45 unchanged lines hidden (view full) --- 403 int error; 404 struct pgrp *newpgrp; 405 406 if (uap->pgid < 0) 407 return (EINVAL); 408 409 error = 0; 410 | 350 351 sx_xlock(&proctree_lock); 352 353 if (p->p_pgid == p->p_pid || (pgrp = pgfind(p->p_pid)) != NULL) { 354 if (pgrp != NULL) 355 PGRP_UNLOCK(pgrp); 356 error = EPERM; 357 } else { --- 45 unchanged lines hidden (view full) --- 403 int error; 404 struct pgrp *newpgrp; 405 406 if (uap->pgid < 0) 407 return (EINVAL); 408 409 error = 0; 410 |
411 MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); | 411 MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_ZERO); |
412 413 sx_xlock(&proctree_lock); 414 if (uap->pid != 0 && uap->pid != curp->p_pid) { 415 if ((targp = pfind(uap->pid)) == NULL) { 416 if (targp) 417 PROC_UNLOCK(targp); 418 error = ESRCH; 419 goto done; --- 1262 unchanged lines hidden (view full) --- 1682/* 1683 * Allocate a zeroed cred structure. 1684 */ 1685struct ucred * 1686crget(void) 1687{ 1688 register struct ucred *cr; 1689 | 412 413 sx_xlock(&proctree_lock); 414 if (uap->pid != 0 && uap->pid != curp->p_pid) { 415 if ((targp = pfind(uap->pid)) == NULL) { 416 if (targp) 417 PROC_UNLOCK(targp); 418 error = ESRCH; 419 goto done; --- 1262 unchanged lines hidden (view full) --- 1682/* 1683 * Allocate a zeroed cred structure. 1684 */ 1685struct ucred * 1686crget(void) 1687{ 1688 register struct ucred *cr; 1689 |
1690 MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK | M_ZERO); | 1690 MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_ZERO); |
1691 cr->cr_ref = 1; 1692 cr->cr_mtxp = mtx_pool_find(cr); 1693#ifdef MAC 1694 mac_init_cred(cr); 1695#endif 1696 return (cr); 1697} 1698 --- 310 unchanged lines hidden --- | 1691 cr->cr_ref = 1; 1692 cr->cr_mtxp = mtx_pool_find(cr); 1693#ifdef MAC 1694 mac_init_cred(cr); 1695#endif 1696 return (cr); 1697} 1698 --- 310 unchanged lines hidden --- |