summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2010-07-03 03:04:55 +0000
committertedu <tedu@openbsd.org>2010-07-03 03:04:55 +0000
commitc21a182b7e1e047eddfa58a31dd2d4cc04770ade (patch)
tree5cc91404768413620f89c1a18f63dd3521e6ed9b
parentthe sedtest regress test requires 200-ish file descriptors, so set a (diff)
downloadwireguard-openbsd-c21a182b7e1e047eddfa58a31dd2d4cc04770ade.tar.xz
wireguard-openbsd-c21a182b7e1e047eddfa58a31dd2d4cc04770ade.zip
explicitly specify flags to malloc and pool_get instead of relying on 0.
This is more clear, and as thib pointed out, the default in softraid was wrong. ok thib.
-rw-r--r--sys/dev/softraid.c15
-rw-r--r--sys/kern/subr_extent.c5
-rw-r--r--sys/kern/subr_pool.c5
-rw-r--r--sys/kern/sysv_shm.c5
-rw-r--r--sys/uvm/uvm_amap.c5
5 files changed, 20 insertions, 15 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index f169b88e69a..70a73a15403 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.209 2010/07/02 09:26:05 jsing Exp $ */
+/* $OpenBSD: softraid.c,v 1.210 2010/07/03 03:04:55 tedu Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -219,7 +219,7 @@ sr_meta_attach(struct sr_discipline *sd, int chunk_no, int force)
DNPRINTF(SR_D_META, "%s: sr_meta_attach(%d)\n", DEVNAME(sc));
/* in memory copy of metadata */
- sd->sd_meta = malloc(SR_META_SIZE * 512, M_DEVBUF, M_ZERO);
+ sd->sd_meta = malloc(SR_META_SIZE * 512, M_DEVBUF, M_ZERO | M_NOWAIT);
if (!sd->sd_meta) {
printf("%s: could not allocate memory for metadata\n",
DEVNAME(sc));
@@ -229,7 +229,7 @@ sr_meta_attach(struct sr_discipline *sd, int chunk_no, int force)
if (sd->sd_meta_type != SR_META_F_NATIVE) {
/* in memory copy of foreign metadata */
sd->sd_meta_foreign = malloc(smd[sd->sd_meta_type].smd_size,
- M_DEVBUF, M_ZERO);
+ M_DEVBUF, M_ZERO | M_NOWAIT);
if (!sd->sd_meta_foreign) {
/* unwind frees sd_meta */
printf("%s: could not allocate memory for foreign "
@@ -606,7 +606,7 @@ sr_meta_save(struct sr_discipline *sd, u_int32_t flags)
/* meta scratchpad */
s = &smd[sd->sd_meta_type];
- m = malloc(SR_META_SIZE * 512, M_DEVBUF, M_ZERO);
+ m = malloc(SR_META_SIZE * 512, M_DEVBUF, M_ZERO | M_NOWAIT);
if (!m) {
printf("%s: could not allocate metadata scratch area\n",
DEVNAME(sc));
@@ -934,7 +934,7 @@ sr_meta_native_bootprobe(struct sr_softc *sc, struct device *dv,
}
vput(vn);
- md = malloc(SR_META_SIZE * 512, M_DEVBUF, M_ZERO);
+ md = malloc(SR_META_SIZE * 512, M_DEVBUF, M_ZERO | M_NOWAIT);
if (md == NULL) {
printf("%s: not enough memory for metadata buffer\n",
DEVNAME(sc));
@@ -942,7 +942,8 @@ sr_meta_native_bootprobe(struct sr_softc *sc, struct device *dv,
}
/* create fake sd to use utility functions */
- fake_sd = malloc(sizeof(struct sr_discipline), M_DEVBUF, M_ZERO);
+ fake_sd = malloc(sizeof(struct sr_discipline), M_DEVBUF,
+ M_ZERO | M_NOWAIT);
if (fake_sd == NULL) {
printf("%s: not enough memory for fake discipline\n",
DEVNAME(sc));
@@ -1390,7 +1391,7 @@ sr_meta_native_attach(struct sr_discipline *sd, int force)
DNPRINTF(SR_D_META, "%s: sr_meta_native_attach\n", DEVNAME(sc));
- md = malloc(SR_META_SIZE * 512, M_DEVBUF, M_ZERO);
+ md = malloc(SR_META_SIZE * 512, M_DEVBUF, M_ZERO | M_NOWAIT);
if (md == NULL) {
printf("%s: not enough memory for metadata buffer\n",
DEVNAME(sc));
diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c
index 234355dd121..1c0101962f2 100644
--- a/sys/kern/subr_extent.c
+++ b/sys/kern/subr_extent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_extent.c,v 1.43 2010/06/20 17:57:09 phessler Exp $ */
+/* $OpenBSD: subr_extent.c,v 1.44 2010/07/03 03:04:55 tedu Exp $ */
/* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */
/*-
@@ -1102,7 +1102,8 @@ extent_alloc_region_descriptor(struct extent *ex, int flags)
}
alloc:
- rp = pool_get(&ex_region_pl, (flags & EX_WAITOK) ? PR_WAITOK : 0);
+ rp = pool_get(&ex_region_pl, (flags & EX_WAITOK) ? PR_WAITOK :
+ PR_NOWAIT);
if (rp != NULL)
rp->er_flags = ER_ALLOC;
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c
index cd856ea8e68..4516c2c1bc9 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.95 2010/07/02 01:25:05 art Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.96 2010/07/03 03:04:55 tedu Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -439,7 +439,8 @@ pool_alloc_item_header(struct pool *pp, caddr_t storage, int flags)
if ((pp->pr_roflags & PR_PHINPAGE) != 0)
ph = (struct pool_item_header *)(storage + pp->pr_phoffset);
else
- ph = pool_get(&phpool, flags & ~(PR_WAITOK | PR_ZERO));
+ ph = pool_get(&phpool, (flags & ~(PR_WAITOK | PR_ZERO)) |
+ PR_NOWAIT);
return (ph);
}
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index 5496b7908be..50f03b9e41c 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_shm.c,v 1.50 2009/06/02 12:11:16 guenther Exp $ */
+/* $OpenBSD: sysv_shm.c,v 1.51 2010/07/03 03:04:55 tedu Exp $ */
/* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */
/*
@@ -411,7 +411,8 @@ shmget_allocate_segment(struct proc *p,
* the key we want in the meantime. Yes, this is ugly.
*/
key = SCARG(uap, key);
- shmseg = pool_get(&shm_pool, key == IPC_PRIVATE ? PR_WAITOK : 0);
+ shmseg = pool_get(&shm_pool, key == IPC_PRIVATE ? PR_WAITOK :
+ PR_NOWAIT);
if (shmseg == NULL) {
shmseg = pool_get(&shm_pool, PR_WAITOK);
if (shm_find_segment_by_key(key) != -1) {
diff --git a/sys/uvm/uvm_amap.c b/sys/uvm/uvm_amap.c
index e2645412a3c..2ba81cd27b8 100644
--- a/sys/uvm/uvm_amap.c
+++ b/sys/uvm/uvm_amap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_amap.c,v 1.44 2009/03/25 20:00:18 oga Exp $ */
+/* $OpenBSD: uvm_amap.c,v 1.45 2010/07/03 03:04:55 tedu Exp $ */
/* $NetBSD: uvm_amap.c,v 1.27 2000/11/25 06:27:59 chs Exp $ */
/*
@@ -185,7 +185,8 @@ amap_alloc1(int slots, int padslots, int waitf)
struct vm_amap *amap;
int totalslots;
- amap = pool_get(&uvm_amap_pool, (waitf == M_WAITOK) ? PR_WAITOK : 0);
+ amap = pool_get(&uvm_amap_pool, (waitf == M_WAITOK) ? PR_WAITOK
+ : PR_NOWAIT);
if (amap == NULL)
return(NULL);