Annotation of coherent/b/lib/libc/sys/i8086/sbrk.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * libc/sys/i8086/sbrk.c
                      3:  * sbrk()
                      4:  * Grow memory in data segment by a specified increment.
                      5:  */
                      6: 
                      7: #include <stdio.h>
                      8: #include <sys/types.h>
                      9: #include <sys/malloc.h>
                     10: 
                     11: extern char    *brk();
                     12: extern int     errno;
                     13: 
                     14: char *
                     15: sbrk(incr) unsigned int incr;
                     16: {
                     17:        register vaddr_t send, rend;
                     18:        register int oerrno;
                     19:        
                     20:        rend = (vaddr_t)brk(NULL);
                     21:        if (incr == 0)
                     22:                return rend;
                     23:        send = rend + incr;
                     24:        if (send < rend)
                     25:                return BADSBRK;
                     26:        oerrno = errno;
                     27:        errno = 0;
                     28:        brk(send);
                     29:        if (errno)
                     30:                return BADSBRK;
                     31:        errno = oerrno;
                     32:        return rend;
                     33: }
                     34: 
                     35: /* end of libc/sys/i8086/sbrk.c */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.