bufpages = (physmem / 10) / CLSIZE;
bufpages = physmem / (10 * CLSIZE);
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(timeouts, struct timeout, ntimeout);#if 0	valloc(swapmap, struct map, nswapmap = maxproc * 2);#endif #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	/*	 * Determine how many buffers to allocate (enough to	 * hold 5% of total physical memory, but at least 16).	 * 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 = (physmem / 20) / 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 */	}#if !defined(UVM)	valloc(swbuf, struct buf, nswbuf);#endif	valloc(buf, struct buf, nbuf);#if 1 /*XXX_FUTURE*/	/*	 * Arbitrarily limit the number of devices mapping	 * the IO space at a given time to NIOPMAP (= 32, default).	 */	valloc(iomap, struct map, niomap = NIOPMAP);#endif	return v;}