kern_resource.c (104964) | kern_resource.c (109623) |
---|---|
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 104964 2002-10-12 05:32:24Z jeff $ | 39 * $FreeBSD: head/sys/kern/kern_resource.c 109623 2003-01-21 08:56:16Z alfred $ |
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> --- 786 unchanged lines hidden (view full) --- 834 */ 835struct plimit * 836limcopy(lim) 837 struct plimit *lim; 838{ 839 register struct plimit *copy; 840 841 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> --- 786 unchanged lines hidden (view full) --- 834 */ 835struct plimit * 836limcopy(lim) 837 struct plimit *lim; 838{ 839 register struct plimit *copy; 840 841 MALLOC(copy, struct plimit *, sizeof(struct plimit), |
842 M_SUBPROC, M_WAITOK); | 842 M_SUBPROC, 0); |
843 bcopy(lim->pl_rlimit, copy->pl_rlimit, sizeof(struct plimit)); 844 copy->p_lflags = 0; 845 copy->p_refcnt = 1; 846 return (copy); 847} 848 849/* 850 * Find the uidinfo structure for a uid. This structure is used to --- 40 unchanged lines hidden (view full) --- 891 struct uidinfo *uip; 892 893 mtx_lock(&uihashtbl_mtx); 894 uip = uilookup(uid); 895 if (uip == NULL) { 896 struct uidinfo *old_uip; 897 898 mtx_unlock(&uihashtbl_mtx); | 843 bcopy(lim->pl_rlimit, copy->pl_rlimit, sizeof(struct plimit)); 844 copy->p_lflags = 0; 845 copy->p_refcnt = 1; 846 return (copy); 847} 848 849/* 850 * Find the uidinfo structure for a uid. This structure is used to --- 40 unchanged lines hidden (view full) --- 891 struct uidinfo *uip; 892 893 mtx_lock(&uihashtbl_mtx); 894 uip = uilookup(uid); 895 if (uip == NULL) { 896 struct uidinfo *old_uip; 897 898 mtx_unlock(&uihashtbl_mtx); |
899 uip = malloc(sizeof(*uip), M_UIDINFO, M_WAITOK | M_ZERO); | 899 uip = malloc(sizeof(*uip), M_UIDINFO, M_ZERO); |
900 mtx_lock(&uihashtbl_mtx); 901 /* 902 * There's a chance someone created our uidinfo while we 903 * were in malloc and not holding the lock, so we have to 904 * make sure we don't insert a duplicate uidinfo 905 */ 906 if ((old_uip = uilookup(uid)) != NULL) { 907 /* someone else beat us to it */ --- 139 unchanged lines hidden --- | 900 mtx_lock(&uihashtbl_mtx); 901 /* 902 * There's a chance someone created our uidinfo while we 903 * were in malloc and not holding the lock, so we have to 904 * make sure we don't insert a duplicate uidinfo 905 */ 906 if ((old_uip = uilookup(uid)) != NULL) { 907 /* someone else beat us to it */ --- 139 unchanged lines hidden --- |