a user would want to change this value, unless a core developer suggests to
change it for a very specific reason.
-tune.bufsize <number>
+tune.bufsize <size>
Sets the buffer size to this size (in bytes). Lower values allow more
streams to coexist in the same amount of RAM, and higher values allow some
applications with very large cookies to work. The default value is 16384 and
int options; /* various tuning options */
int runqueue_depth;/* max number of tasks to run at once */
uint recv_enough; /* how many input bytes at once are "enough" */
- int bufsize; /* buffer size in bytes, defaults to BUFSIZE */
+ uint bufsize; /* buffer size in bytes, defaults to BUFSIZE */
int bufsize_small; /* small buffer size in bytes */
int maxrewrite; /* buffer max rewrite size in bytes, defaults to MAXREWRITE */
int reserved_bufs; /* how many buffers can only be allocated for response */
memprintf(err, "'%s' expects an integer argument", args[0]);
return -1;
}
- global.tune.bufsize = atol(args[1]);
+ res = parse_size_err(args[1], &global.tune.bufsize);
+ if (res != NULL)
+ goto size_err;
+
+ if (global.tune.bufsize > INT_MAX - (int)(2 * sizeof(void *))) {
+ memprintf(err, "'%s' expects a size in bytes from 0 to %d.",
+ args[0], INT_MAX - (int)(2 * sizeof(void *)));
+ return -1;
+ }
+
/* round it up to support a two-pointer alignment at the end */
global.tune.bufsize = (global.tune.bufsize + 2 * sizeof(void *) - 1) & -(2 * sizeof(void *));
if (global.tune.bufsize <= 0) {