]>
Commit | Line | Data |
---|---|---|
349e85df | 1 | /* |
2 | * $Source$ | |
3 | * $Author$ | |
4 | * $Header$ | |
5 | * | |
6 | * Copyright (C) 1987 by the Massachusetts Institute of Technology | |
c801de4c | 7 | * For copying and distribution information, please see the file |
8 | * <mit-copyright.h>. | |
349e85df | 9 | */ |
10 | ||
11 | #ifndef lint | |
12 | static char *rcsid_sms_sbrk_c = "$Header$"; | |
13 | #endif lint | |
14 | ||
c801de4c | 15 | #include <mit-copyright.h> |
16 | ||
349e85df | 17 | /* |
18 | * The following routine is a kludge around a deficiency in the Ingres | |
19 | * memory allocator; it likes to call sbrk(0) a lot to check on the | |
20 | * amount of memory allocated. | |
21 | */ | |
22 | #include <sys/types.h> | |
23 | ||
24 | #ifdef vax | |
25 | extern char end; | |
26 | asm(" .data"); | |
27 | asm(" .globl curbrk"); | |
28 | asm(" .globl minbrk"); | |
29 | asm("_curbrk:"); | |
30 | asm("curbrk: .long _end"); | |
31 | asm("_minbrk:"); | |
32 | asm("minbrk: .long _end"); | |
33 | ||
34 | extern caddr_t curbrk; | |
35 | extern caddr_t minbrk; | |
36 | ||
37 | caddr_t sbrk(incr) | |
38 | register int incr; | |
39 | { | |
40 | register caddr_t oldbrk = curbrk; | |
41 | if (incr) { | |
42 | if (brk(oldbrk + incr) < 0) | |
43 | return (caddr_t)-1; | |
44 | curbrk += incr; | |
45 | } | |
46 | return oldbrk; | |
47 | } | |
48 | #endif vax | |
49 | ||
50 | /* | |
51 | * Local Variables: | |
52 | * mode: c | |
53 | * c-indent-level: 4 | |
54 | * c-continued-statement-offset: 4 | |
55 | * c-brace-offset: -4 | |
56 | * c-argdecl-indent: 4 | |
57 | * c-label-offset: -4 | |
58 | * End: | |
59 | */ |