]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/sh/brk.c
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / sh / brk.c
1 /* From libc-5.3.12 */
2 /*
3  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
4  *
5  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6  */
7
8 #include <errno.h>
9 #include <unistd.h>
10 #include <sys/syscall.h>
11
12 extern void * __curbrk attribute_hidden;
13 extern int __init_brk (void) attribute_hidden;
14 extern void *_brk(void *ptr) attribute_hidden;
15
16 int brk(void * end_data_seg)
17 {
18     if (__init_brk () == 0)
19     {
20                 __curbrk = _brk(end_data_seg);
21                 if (__curbrk == end_data_seg)
22                         return 0;
23                 __set_errno(ENOMEM);
24     }
25     return -1;
26 }
27 libc_hidden_def(brk)