1 /* 2 * Copyright (C) 2004-2007 Atmel Corporation 3 * 4 * This file is subject to the terms and conditions of the GNU Lesser General 5 * Public License. See the file "COPYING.LIB" in the main directory of this 6 * archive for more details. 7 */ 8 #include <errno.h> 9 #include <unistd.h> 10 #include <sys/syscall.h> 11 12 13 void *__curbrk attribute_hidden = 0; 14 brk(void * addr)15int brk (void *addr) 16 { 17 void *newbrk; 18 19 newbrk = (void *)INLINE_SYSCALL(brk, 1, addr); 20 21 __curbrk = newbrk; 22 23 if (newbrk < addr) { 24 __set_errno (ENOMEM); 25 return -1; 26 } 27 28 return 0; 29 } 30 libc_hidden_def(brk) 31