|
|
1.1 root 1: /*
2: * Sbrk - grow memory in data segment by
3: * a specified increment.
4: */
5: #include <stdio.h>
6: #include <sys/types.h>
7: #include <sys/malloc.h>
8:
9: extern int errno;
10:
11: char *
12: sbrk(incr)
13: unsigned int incr;
14: {
15: extern char *brk();
16: register vaddr_t send,
17: rend;
18:
19: rend = (vaddr_t)brk(NULL);
20: if (incr == 0)
21: return (rend);
22: send = rend + incr;
23: if (send < rend)
24: return (BADSBRK);
25: errno = 0;
26: brk(send);
27: if (errno)
28: return (BADSBRK);
29: return (rend);
30: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.