if (bufpages * MAXBSIZE * 7 / 10 > (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS)) bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / MAXBSIZE * 7 / 10;
allocsys(v)	register caddr_t v;{#define	valloc(name, type, num) \	    v = (caddr_t)(((name) = (type *)v) + (num))#ifdef REAL_CLISTS	valloc(cfree, struct cblock, nclist);#endif	valloc(callout, struct callout, ncallout);	valloc(swapmap, struct map, nswapmap = maxproc * 2);#ifdef SYSVSHM	valloc(shmsegs, struct shmid_ds, shminfo.shmmni);#endif#ifdef SYSVSEM	valloc(sema, struct semid_ds, seminfo.semmni);	valloc(sem, struct sem, seminfo.semmns);	/* This is pretty disgusting! */	valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));#endif#ifdef SYSVMSG	valloc(msgpool, char, msginfo.msgmax);	valloc(msgmaps, struct msgmap, msginfo.msgseg);	valloc(msghdrs, struct msg, msginfo.msgtql);	valloc(msqids, struct msqid_ds, msginfo.msgmni);#endif#ifndef BUFCACHEPERCENT#define BUFCACHEPERCENT 5#endif	/*	 * Determine how many buffers to allocate.  We use 10% of the	 * first 2MB of memory, and 5% of the rest, with a minimum of 16	 * buffers.  We allocate 1/2 as many swap buffer headers as file	 * i/o buffers.	 */	if (bufpages == 0)		if (physmem < btoc(2 * 1024 * 1024))			bufpages = physmem / (10 * CLSIZE);		else			bufpages = (btoc(2 * 1024 * 1024) + physmem) /			    ((100/BUFCACHEPERCENT) * CLSIZE);	if (nbuf == 0) {		nbuf = bufpages;		if (nbuf < 16)			nbuf = 16;	}	if (nswbuf == 0) {		nswbuf = (nbuf / 2) &~ 1;	/* force even */		if (nswbuf > 256)			nswbuf = 256;		/* sanity */	}	valloc(swbuf, struct buf, nswbuf);	valloc(buf, struct buf, nbuf);	return v;}