Deleted Added
full compact
kern_resource.c (184217) kern_resource.c (194766)
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.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
35 */
36
37#include <sys/cdefs.h>
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.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/kern_resource.c 184217 2008-10-24 01:09:24Z davidxu $");
38__FBSDID("$FreeBSD: head/sys/kern/kern_resource.c 194766 2009-06-23 20:45:22Z kib $");
39
40#include "opt_compat.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/sysproto.h>
45#include <sys/file.h>
46#include <sys/kernel.h>

--- 1161 unchanged lines hidden (view full) ---

1208 */
1209 if ((old_uip = uilookup(uid)) != NULL) {
1210 /* Someone else beat us to it. */
1211 free(uip, M_UIDINFO);
1212 uip = old_uip;
1213 } else {
1214 refcount_init(&uip->ui_ref, 0);
1215 uip->ui_uid = uid;
39
40#include "opt_compat.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/sysproto.h>
45#include <sys/file.h>
46#include <sys/kernel.h>

--- 1161 unchanged lines hidden (view full) ---

1208 */
1209 if ((old_uip = uilookup(uid)) != NULL) {
1210 /* Someone else beat us to it. */
1211 free(uip, M_UIDINFO);
1212 uip = old_uip;
1213 } else {
1214 refcount_init(&uip->ui_ref, 0);
1215 uip->ui_uid = uid;
1216 mtx_init(&uip->ui_vmsize_mtx, "ui_vmsize", NULL,
1217 MTX_DEF);
1216 LIST_INSERT_HEAD(UIHASH(uid), uip, ui_hash);
1217 }
1218 }
1219 uihold(uip);
1220 rw_unlock(&uihashtbl_lock);
1221 return (uip);
1222}
1223

--- 40 unchanged lines hidden (view full) ---

1264 LIST_REMOVE(uip, ui_hash);
1265 rw_wunlock(&uihashtbl_lock);
1266 if (uip->ui_sbsize != 0)
1267 printf("freeing uidinfo: uid = %d, sbsize = %ld\n",
1268 uip->ui_uid, uip->ui_sbsize);
1269 if (uip->ui_proccnt != 0)
1270 printf("freeing uidinfo: uid = %d, proccnt = %ld\n",
1271 uip->ui_uid, uip->ui_proccnt);
1218 LIST_INSERT_HEAD(UIHASH(uid), uip, ui_hash);
1219 }
1220 }
1221 uihold(uip);
1222 rw_unlock(&uihashtbl_lock);
1223 return (uip);
1224}
1225

--- 40 unchanged lines hidden (view full) ---

1266 LIST_REMOVE(uip, ui_hash);
1267 rw_wunlock(&uihashtbl_lock);
1268 if (uip->ui_sbsize != 0)
1269 printf("freeing uidinfo: uid = %d, sbsize = %ld\n",
1270 uip->ui_uid, uip->ui_sbsize);
1271 if (uip->ui_proccnt != 0)
1272 printf("freeing uidinfo: uid = %d, proccnt = %ld\n",
1273 uip->ui_uid, uip->ui_proccnt);
1274 if (uip->ui_vmsize != 0)
1275 printf("freeing uidinfo: uid = %d, swapuse = %lld\n",
1276 uip->ui_uid, (unsigned long long)uip->ui_vmsize);
1277 mtx_destroy(&uip->ui_vmsize_mtx);
1272 free(uip, M_UIDINFO);
1273 return;
1274 }
1275 /*
1276 * Someone added a reference between atomic_cmpset_int() and
1277 * rw_wlock(&uihashtbl_lock).
1278 */
1279 rw_wunlock(&uihashtbl_lock);

--- 78 unchanged lines hidden ---
1278 free(uip, M_UIDINFO);
1279 return;
1280 }
1281 /*
1282 * Someone added a reference between atomic_cmpset_int() and
1283 * rw_wlock(&uihashtbl_lock).
1284 */
1285 rw_wunlock(&uihashtbl_lock);

--- 78 unchanged lines hidden ---