repo.or.cz
/
minix3.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
retire BIOS_SEG and umap_bios
[minix3.git]
/
lib
/
libc
/
sys-minix
/
sbrk.c
blob
a940c4bcc7561d1f44aeb69bbcb629f28e143536
1
#include <sys/cdefs.h>
2
#include
"namespace.h"
3
#include <lib.h>
4
5
#include <unistd.h>
6
7
#ifdef __weak_alias
8
__weak_alias
(
sbrk
,
_sbrk
)
9
#endif
10
11
extern
char
*
_brksize
;
12
13
void
*
sbrk
(
incr
)
14
intptr_t
incr
;
15
{
16
char
*
newsize
, *
oldsize
;
17
18
oldsize
=
_brksize
;
19
newsize
=
_brksize
+
incr
;
20
if
((
incr
>
0
&&
newsize
<
oldsize
) || (
incr
<
0
&&
newsize
>
oldsize
))
21
return
( (
char
*) -
1
);
22
if
(
brk
(
newsize
) ==
0
)
23
return
(
oldsize
);
24
else
25
return
( (
char
*) -
1
);
26
}