|
|
1.1 ! root 1: head 1.2; ! 2: access ; ! 3: symbols ; ! 4: locks bin:1.2; ! 5: comment @ * @; ! 6: ! 7: ! 8: 1.2 ! 9: date 92.02.14.21.13.32; author bin; state Exp; ! 10: branches ; ! 11: next 1.1; ! 12: ! 13: 1.1 ! 14: date 92.02.14.21.11.12; author bin; state Exp; ! 15: branches ; ! 16: next ; ! 17: ! 18: ! 19: desc ! 20: @steve 2/14/92 ! 21: Initial MWC RCS revision. ! 22: @ ! 23: ! 24: ! 25: 1.2 ! 26: log ! 27: @Preserve errno on success. ! 28: @ ! 29: text ! 30: @/* ! 31: * libc/sys/i8086/sbrk.c ! 32: * sbrk() ! 33: * Grow memory in data segment by a specified increment. ! 34: */ ! 35: ! 36: #include <stdio.h> ! 37: #include <sys/types.h> ! 38: #include <sys/malloc.h> ! 39: ! 40: extern char *brk(); ! 41: extern int errno; ! 42: ! 43: char * ! 44: sbrk(incr) unsigned int incr; ! 45: { ! 46: register vaddr_t send, rend; ! 47: register int oerrno; ! 48: ! 49: rend = (vaddr_t)brk(NULL); ! 50: if (incr == 0) ! 51: return rend; ! 52: send = rend + incr; ! 53: if (send < rend) ! 54: return BADSBRK; ! 55: oerrno = errno; ! 56: errno = 0; ! 57: brk(send); ! 58: if (errno) ! 59: return BADSBRK; ! 60: errno = oerrno; ! 61: return rend; ! 62: } ! 63: ! 64: /* end of libc/sys/i8086/sbrk.c */ ! 65: @ ! 66: ! 67: ! 68: 1.1 ! 69: log ! 70: @Initial revision ! 71: @ ! 72: text ! 73: @d2 3 ! 74: a4 2 ! 75: * Sbrk - grow memory in data segment by ! 76: * a specified increment. ! 77: d6 1 ! 78: d11 1 ! 79: d15 1 ! 80: a15 2 ! 81: sbrk(incr) ! 82: unsigned int incr; ! 83: d17 3 ! 84: a19 4 ! 85: extern char *brk(); ! 86: register vaddr_t send, ! 87: rend; ! 88: ! 89: d22 1 ! 90: a22 1 ! 91: return (rend); ! 92: d25 2 ! 93: a26 1 ! 94: return (BADSBRK); ! 95: d30 3 ! 96: a32 2 ! 97: return (BADSBRK); ! 98: return (rend); ! 99: d34 2 ! 100: @
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.