if (nswbuf == 0) { nswbuf = (nbuf / 2) &~ 1;   if (nswbuf > 256) nswbuf = 256;	   }
allocsys(v)	register caddr_t v;{#define	valloc(name, type, num) \	    v = (caddr_t)(((name) = (type *)v) + (num))#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;		else			bufpages = (btoc(2 * 1024 * 1024) + physmem) *			    BUFCACHEPERCENT / 100;	}	if (nbuf == 0) {		nbuf = bufpages;		if (nbuf < 16)			nbuf = 16;	}	/* Restrict to at most 70% filled kvm */	if (nbuf >	    (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / MAXBSIZE * 7 / 10) 		nbuf = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /		    MAXBSIZE * 7 / 10;	/* More buffer pages than fits into the buffers is senseless.  */	if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE)		bufpages = nbuf * MAXBSIZE / PAGE_SIZE;	if (nswbuf == 0) {		nswbuf = (nbuf / 2) &~ 1;  /* force even */		if (nswbuf > 256)			nswbuf = 256;	  /* sanity */	}	valloc(buf, struct buf, nbuf);	return v;}