Blame sysdeps/unix/sysv/linux/i386/brk.c

Packit Service 82fcde
/* brk system call for Linux/i386.
Packit Service 82fcde
   Copyright (C) 1995-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#if BUILD_PIE_DEFAULT
Packit Service 82fcde
/* Can't use "call *%gs:SYSINFO_OFFSET" during statup in static PIE.  */
Packit Service 82fcde
# define I386_USE_SYSENTER 0
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#include <errno.h>
Packit Service 82fcde
#include <unistd.h>
Packit Service 82fcde
#include <sysdep.h>
Packit Service 82fcde
Packit Service 82fcde
/* This must be initialized data because commons can't have aliases.  */
Packit Service 82fcde
void *__curbrk = 0;
Packit Service 82fcde
Packit Service 82fcde
/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
Packit Service 82fcde
   to work around different old braindamage in the old Linux ELF dynamic
Packit Service 82fcde
   linker.  */
Packit Service 82fcde
weak_alias (__curbrk, ___brk_addr)
Packit Service 82fcde
Packit Service 82fcde
int
Packit Service 82fcde
__brk (void *addr)
Packit Service 82fcde
{
Packit Service 82fcde
  INTERNAL_SYSCALL_DECL (err);
Packit Service 82fcde
  void *newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
Packit Service 82fcde
  __curbrk = newbrk;
Packit Service 82fcde
  if (newbrk < addr)
Packit Service 82fcde
    return INLINE_SYSCALL_ERROR_RETURN_VALUE (ENOMEM);
Packit Service 82fcde
  return 0;
Packit Service 82fcde
}
Packit Service 82fcde
weak_alias (__brk, brk)