. pci driver now returns devices, even when they have been pci_reserve()d
[minix3.git] / lib / other / _brk.c
blob5ce5e0f638629bcbf8f169d9d594eb843d96bfcd
1 #include <lib.h>
2 #define brk _brk
3 #define sbrk _sbrk
4 #include <unistd.h>
6 extern char *_brksize;
8 /* Both OSF/1 and SYSVR4 man pages specify that brk(2) returns int.
9 * However, BSD4.3 specifies that brk() returns char*. POSIX omits
10 * brk() on the grounds that it imposes a memory model on an architecture.
11 * For this reason, brk() and sbrk() are not in the lib/posix directory.
12 * On the other hand, they are so crucial to correct operation of so many
13 * parts of the system, that we have chosen to hide the name brk using _brk,
14 * as with system calls. In this way, if a user inadvertently defines a
15 * procedure brk, MINIX may continue to work because the true call is _brk.
17 PUBLIC int brk(addr)
18 char *addr;
20 message m;
22 if (addr != _brksize) {
23 m.m1_p1 = addr;
24 if (_syscall(MM, BRK, &m) < 0) return(-1);
25 _brksize = m.m2_p1;
27 return(0);