CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); /* XXX */
VSL(SLT_TTL, sp->fd, "%u VCL %.0f %u", sp->obj->xid, a, sp->t_req);
- sp->obj->ttl = sp->t_req + a;
+ if (a < 0)
+ a = 0;
+ sp->obj->ttl = sp->t_req + (int)a;
if (sp->obj->heap_idx != 0)
EXP_TTLchange(sp->obj);
}
uintmax_t l;
unsigned bs;
char suff[2];
- int i;
+ int i, expl;
off_t o;
struct statfs fsst;
struct stat st;
i = sscanf(size, "%ju%1s", &l, suff); /* can return -1, 0, 1 or 2 */
+ expl = i;
if (i == 0) {
fprintf(stderr,
"Error: (-sfile) size \"%s\" not understood\n", size);
/* round down to of filesystem blocksize or pagesize */
l -= (l % bs);
- if (l < MINPAGES * sc->pagesize) {
+ if (l < MINPAGES * (uintmax_t)sc->pagesize) {
fprintf(stderr,
"Error: size too small, at least %ju needed\n",
(uintmax_t)MINPAGES * sc->pagesize);
exit (2);
}
+ if (expl < 0 && sizeof(void *) == 4 && l > (1ULL << 31)) {
+ fprintf(stderr,
+ "NB: Limiting size to 2GB on 32 bit architecture to"
+ " prevent running out of\naddress space."
+ " Specifiy explicit size to override.\n"
+ );
+ l = 1ULL << 31;
+ }
+
printf("file %s size %ju bytes (%ju fs-blocks, %ju pages)\n",
sc->filename, l, l / fsst.f_bsize, l / sc->pagesize);
(uintmax_t)sum, sc->filesize);
/* XXX */
- if (sum < MINPAGES * getpagesize())
+ if (sum < MINPAGES * (uintmax_t)getpagesize())
exit (2);
AZ(pthread_mutex_init(&sc->mtx, NULL));
}