]> git.ipfire.org Git - thirdparty/glibc.git/blame - ports/sysdeps/unix/sysv/linux/am33/brk.c
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / ports / sysdeps / unix / sysv / linux / am33 / brk.c
CommitLineData
d115c0d8 1/* brk system call for Linux/am33.
d4697bc9 2 Copyright (C) 1995-2014 Free Software Foundation, Inc.
d115c0d8
AO
3 This file is part of the GNU C Library.
4 Contributed by Alexandre Oliva <aoliva@redhat.com>.
5 Based on ../i386/brk.c.
6
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.
11
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.
16
17 You should have received a copy of the GNU Library General Public
ab84e3ff
PE
18 License along with the GNU C Library. If not, see
19 <http://www.gnu.org/licenses/>. */
d115c0d8
AO
20
21#include <errno.h>
22#include <unistd.h>
23#include <sysdep.h>
24
25/* This must be initialized data because commons can't have aliases. */
26void *__curbrk = 0;
27
28int
29__brk (void *addr)
30{
31 void *newbrk;
32
70d9946a 33 newbrk = INLINE_SYSCALL (brk, 1, addr);
d115c0d8
AO
34
35 __curbrk = newbrk;
36
37 if (newbrk < addr)
38 {
39 __set_errno (ENOMEM);
40 return -1;
41 }
42
43 return 0;
44}
45weak_alias (__brk, brk)