summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_pipe.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-03-10 21:28:43 +0000
committerjhb <jhb@FreeBSD.org>2009-03-10 21:28:43 +0000
commit50289fd1c1ed015d3451ec8e6956fdee7141e3ea (patch)
tree4a06c8d38dd969f6196f185753061d262cd2b958 /sys/kern/sys_pipe.c
parentc8dd604fc285becb2d24a1dde02258f37a6844ff (diff)
downloadFreeBSD-src-50289fd1c1ed015d3451ec8e6956fdee7141e3ea.zip
FreeBSD-src-50289fd1c1ed015d3451ec8e6956fdee7141e3ea.tar.gz
- Make maxpipekva a signed long rather than an unsigned long as overflow
is more likely to be noticed with signed types. - Make amountpipekva a long as well to match maxpipekva. Discussed with: bde
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r--sys/kern/sys_pipe.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 65f03ca..fb6b35d 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -178,15 +178,15 @@ static struct filterops pipe_wfiltops =
#define MINPIPESIZE (PIPE_SIZE/3)
#define MAXPIPESIZE (2*PIPE_SIZE/3)
-static int amountpipekva;
+static long amountpipekva;
static int pipefragretry;
static int pipeallocfail;
static int piperesizefail;
static int piperesizeallowed = 1;
-SYSCTL_ULONG(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN,
+SYSCTL_LONG(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN,
&maxpipekva, 0, "Pipe KVA limit");
-SYSCTL_INT(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD,
+SYSCTL_LONG(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD,
&amountpipekva, 0, "Pipe KVA usage");
SYSCTL_INT(_kern_ipc, OID_AUTO, pipefragretry, CTLFLAG_RD,
&pipefragretry, 0, "Pipe allocation retries due to fragmentation");
@@ -463,7 +463,7 @@ retry:
cpipe->pipe_buffer.in = cnt;
cpipe->pipe_buffer.out = 0;
cpipe->pipe_buffer.cnt = cnt;
- atomic_add_int(&amountpipekva, cpipe->pipe_buffer.size);
+ atomic_add_long(&amountpipekva, cpipe->pipe_buffer.size);
return (0);
}
@@ -1457,7 +1457,7 @@ pipe_free_kmem(cpipe)
("pipe_free_kmem: pipe mutex locked"));
if (cpipe->pipe_buffer.buffer != NULL) {
- atomic_subtract_int(&amountpipekva, cpipe->pipe_buffer.size);
+ atomic_subtract_long(&amountpipekva, cpipe->pipe_buffer.size);
vm_map_remove(pipe_map,
(vm_offset_t)cpipe->pipe_buffer.buffer,
(vm_offset_t)cpipe->pipe_buffer.buffer + cpipe->pipe_buffer.size);
OpenPOWER on IntegriCloud