kern_resource.c (111024) | kern_resource.c (111119) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 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. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 | 1/*- 2 * Copyright (c) 1982, 1986, 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. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 |
39 * $FreeBSD: head/sys/kern/kern_resource.c 111024 2003-02-17 02:19:58Z jeff $ | 39 * $FreeBSD: head/sys/kern/kern_resource.c 111119 2003-02-19 05:47:46Z imp $ |
40 */ 41 42#include "opt_compat.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/sysproto.h> 47#include <sys/file.h> --- 773 unchanged lines hidden (view full) --- 821 */ 822struct plimit * 823limcopy(lim) 824 struct plimit *lim; 825{ 826 register struct plimit *copy; 827 828 MALLOC(copy, struct plimit *, sizeof(struct plimit), | 40 */ 41 42#include "opt_compat.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/sysproto.h> 47#include <sys/file.h> --- 773 unchanged lines hidden (view full) --- 821 */ 822struct plimit * 823limcopy(lim) 824 struct plimit *lim; 825{ 826 register struct plimit *copy; 827 828 MALLOC(copy, struct plimit *, sizeof(struct plimit), |
829 M_SUBPROC, 0); | 829 M_SUBPROC, M_WAITOK); |
830 bcopy(lim->pl_rlimit, copy->pl_rlimit, sizeof(struct plimit)); 831 copy->p_lflags = 0; 832 copy->p_refcnt = 1; 833 return (copy); 834} 835 836/* 837 * Find the uidinfo structure for a uid. This structure is used to --- 40 unchanged lines hidden (view full) --- 878 struct uidinfo *uip; 879 880 mtx_lock(&uihashtbl_mtx); 881 uip = uilookup(uid); 882 if (uip == NULL) { 883 struct uidinfo *old_uip; 884 885 mtx_unlock(&uihashtbl_mtx); | 830 bcopy(lim->pl_rlimit, copy->pl_rlimit, sizeof(struct plimit)); 831 copy->p_lflags = 0; 832 copy->p_refcnt = 1; 833 return (copy); 834} 835 836/* 837 * Find the uidinfo structure for a uid. This structure is used to --- 40 unchanged lines hidden (view full) --- 878 struct uidinfo *uip; 879 880 mtx_lock(&uihashtbl_mtx); 881 uip = uilookup(uid); 882 if (uip == NULL) { 883 struct uidinfo *old_uip; 884 885 mtx_unlock(&uihashtbl_mtx); |
886 uip = malloc(sizeof(*uip), M_UIDINFO, M_ZERO); | 886 uip = malloc(sizeof(*uip), M_UIDINFO, M_WAITOK | M_ZERO); |
887 mtx_lock(&uihashtbl_mtx); 888 /* 889 * There's a chance someone created our uidinfo while we 890 * were in malloc and not holding the lock, so we have to 891 * make sure we don't insert a duplicate uidinfo 892 */ 893 if ((old_uip = uilookup(uid)) != NULL) { 894 /* someone else beat us to it */ --- 139 unchanged lines hidden --- | 887 mtx_lock(&uihashtbl_mtx); 888 /* 889 * There's a chance someone created our uidinfo while we 890 * were in malloc and not holding the lock, so we have to 891 * make sure we don't insert a duplicate uidinfo 892 */ 893 if ((old_uip = uilookup(uid)) != NULL) { 894 /* someone else beat us to it */ --- 139 unchanged lines hidden --- |