diff options
author | nn35248 <none@none> | 2006-09-11 22:51:59 -0700 |
---|---|---|
committer | nn35248 <none@none> | 2006-09-11 22:51:59 -0700 |
commit | 9acbbeaf2a1ffe5c14b244867d427714fab43c5c (patch) | |
tree | d1ecd54896325c19a463220e9cbc50864874fc82 /usr/src/uts/common/os/pid.c | |
parent | da51466dc253d7c98dda4956059042bd0c476328 (diff) | |
download | illumos-joyent-9acbbeaf2a1ffe5c14b244867d427714fab43c5c.tar.gz |
PSARC/2005/471 BrandZ: Support for non-native zones
6374606 ::nm -D without an object may not work on processes in zones
6409350 BrandZ project integration into Solaris
6455289 pthread_setschedparam() should return EPERM rather than panic libc
6455591 setpriority(3C) gets errno wrong for deficient privileges failure
6458178 fifofs doesn't support lofs mounts of fifos
6460380 Attempted open() of a symlink with the O_NOFOLLOW flag set returns EINVAL, not ELOOP
6463857 renice(1) errors erroneously
--HG--
rename : usr/src/lib/libzonecfg/zones/SUNWblank.xml => usr/src/lib/brand/native/zone/SUNWblank.xml
rename : usr/src/lib/libzonecfg/zones/SUNWdefault.xml => usr/src/lib/brand/native/zone/SUNWdefault.xml
Diffstat (limited to 'usr/src/uts/common/os/pid.c')
-rw-r--r-- | usr/src/uts/common/os/pid.c | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/usr/src/uts/common/os/pid.c b/usr/src/uts/common/os/pid.c index 66cfed74b4..88b0258afe 100644 --- a/usr/src/uts/common/os/pid.c +++ b/usr/src/uts/common/os/pid.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -115,6 +114,18 @@ pid_lookup(pid_t pid) return (pidp); } +struct pid * +pid_find(pid_t pid) +{ + struct pid *pidp; + + mutex_enter(&pidlinklock); + pidp = pid_lookup(pid); + mutex_exit(&pidlinklock); + + return (pidp); +} + void pid_setmin(void) { @@ -154,14 +165,13 @@ pid_getlockslot(int prslot) } /* - * This function assigns a pid for use in a fork request. It allocates - * a pid structure, tries to find an empty slot in the proc table, - * and selects the process id. + * This function allocates a pid structure, a free pid, and optionally a + * slot in the proc table for it. * - * pid_assign() returns the new pid on success, -1 on failure. + * pid_allocate() returns the new pid on success, -1 on failure. */ pid_t -pid_assign(proc_t *prp) +pid_allocate(proc_t *prp, int flags) { struct pid *pidp; union procent *pep; @@ -170,7 +180,7 @@ pid_assign(proc_t *prp) pidp = kmem_zalloc(sizeof (struct pid), KM_SLEEP); mutex_enter(&pidlinklock); - if ((pep = procentfree) == NULL) { + if ((flags & PID_ALLOC_PROC) && (pep = procentfree) == NULL) { /* * ran out of /proc directory entries */ @@ -190,10 +200,6 @@ pid_assign(proc_t *prp) goto failed; } - procentfree = pep->pe_next; - pep->pe_proc = prp; - prp->p_pidp = pidp; - /* * Put pid into the pid hash table. */ @@ -201,8 +207,17 @@ pid_assign(proc_t *prp) HASHPID(newpid) = pidp; pidp->pid_ref = 1; pidp->pid_id = newpid; - pidp->pid_prslot = pep - procdir; - prp->p_lockp = &proc_lock[pid_getlockslot(pidp->pid_prslot)]; + + if (flags & PID_ALLOC_PROC) { + procentfree = pep->pe_next; + pidp->pid_prslot = pep - procdir; + pep->pe_proc = prp; + prp->p_pidp = pidp; + prp->p_lockp = &proc_lock[pid_getlockslot(pidp->pid_prslot)]; + } else { + pidp->pid_prslot = 0; + } + mutex_exit(&pidlinklock); return (newpid); @@ -264,7 +279,7 @@ pid_exit(proc_t *prp) if (prp->p_pgidp != NULL) pgexit(prp); - SESS_RELE(prp->p_sessp); + sess_rele(prp->p_sessp, B_TRUE); pidp = prp->p_pidp; |