23.1 cinit (8234)

This procedure, which is called once by “main” (1613), links the set of character buffers into the free list, “cfreelist”, and counts the number of character device types.

8239:

“ccp” is the address of the first word in the array “cfree” (8146);

8240:

Round “ccp” up to the next highest multiple of eight, and mark out “cblock” sized pieces, taking care not to exceed the boundary of “cfree”.

Note. In general there will be “NCLIST – 1” (rather than “NCLIST”) blocks so defined;

8241:

Set the first word of the “cblock” to point to the current head of the free list.

Note that “c_next” is defined on line 8141, and that the initial value of “cfreelist” is “NULL”.

8242:

Update “cfreelist” to point to the new head of the list;

8244:

Count the number of character device types. Upon reference to “cdevsw” on Sheet 46, it will be seen that “nchrdev” will be set to 16, whereas a more appropriate value would be 10.