|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 700 (0x2bc) Types: TextFile Notes: UNIX file Names: »sbrk.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code └─⟦f4b8d8c84⟧ UNIX Filesystem └─⟦this⟧ »libc/sys/sbrk.c«
/* * Sbrk - grow memory in data segment by * a specified increment. * Special version that does Commodore Large model Z8001 */ #include <stdio.h> #include <types.h> extern int errno; extern vaddr_t __end; char * sbrk(incr) unsigned int incr; { extern char *brk(); register vaddr_t send, rend; #if 1 /* On the z8001 (at least) reduce the waste */ rend = __end; #else rend = brk(NULL); #endif if (incr == 0) return (rend); #if Z8001 if (((unsigned)rend+incr) < (unsigned)rend) rend = rend - (unsigned)rend +0x01000000L; send = rend + incr; #else send = rend + incr; if (send < rend) return (NULL); #endif errno = 0; brk(send); if (errno) return (NULL); return (rend); }