Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / unix / sysv / linux / am33 / brk.c
blobf913fc6f88520f12ccdee092e0af523f7db9120c
1 /* brk system call for Linux/am33.
2 Copyright (C) 1995-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Alexandre Oliva <aoliva@redhat.com>.
5 Based on ../i386/brk.c.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with the GNU C Library. If not, see
19 <http://www.gnu.org/licenses/>. */
21 #include <errno.h>
22 #include <unistd.h>
23 #include <sysdep.h>
25 /* This must be initialized data because commons can't have aliases. */
26 void *__curbrk = 0;
28 int
29 __brk (void *addr)
31 void *newbrk;
33 newbrk = INLINE_SYSCALL (brk, 1, addr);
35 __curbrk = newbrk;
37 if (newbrk < addr)
39 __set_errno (ENOMEM);
40 return -1;
43 return 0;
45 weak_alias (__brk, brk)