4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-15 19:09:58 +08:00
Jeff Johnston ad5527663e 2002-08-17 Jeff Johnston <jjohnstn@redhat.com>
*  Makefile.am: Move cmath stuff into libc/sys/linux.
        *  Makefile.in: Regenerated.
        *  configure.host: Default -DMB_CAPABLE for x86-linux.
        *  libc/include/reent.h: Define _sbrk to take signed int argument.
        *  libc/include/sys/unistd.h: Ditto for _sbrk_r and sbrk.
        *  libc/locale/locale.c[MB_CAPABLE]: Add LC_MESSAGES support and
        make locale name checking more efficient.  Also allow "C-ISO-8859-1"
        locale for LC_CTYPE and LC_MESSAGES.
        *  libc/reent/sbrkr.c: Change prototype to take ptrdiff_t.
        *  libc/sys/linux/brk.c: Change sbrk prototype.
        *  libc/sys/linux/include/time.h: Remove Cygwin stuff and
        include <sys/features.h>.
        (CLOCK_THREAD_CPUTIME): Renamed to CLOCK_THREAD_CPUTIME_ID.
        (CLOCK_PROCESS_CPUTIME): Renamed to CLOCK_PROCESS_CPUTIME_ID.
        *  libc/sys/linux/sys/cdefs.h: Replace with glibc sys/cdefs.h
        with a few local additions.
        *  libc/sys/linux/sys/features.h: New file.
        *  libc/sys/linux/sys/unistd.h: Change _sbrk_r and sbrk prototypes
        to take signed argument.
        *  libc/syscalls/syssbrk.c: Change sbrk, _sbrk_r, and _sbrk
        prototypes to take signed size argument.
2002-08-17 05:19:18 +00:00

66 lines
1.3 KiB
C

/* Reentrant version of sbrk system call. */
#include <reent.h>
#include <unistd.h>
#include <_syslist.h>
/* Some targets provides their own versions of these functions. Those
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */
#ifdef _REENT_ONLY
#ifndef REENTRANT_SYSCALLS_PROVIDED
#define REENTRANT_SYSCALLS_PROVIDED
#endif
#endif
/* If MALLOC_PROVIDED is defined, we don't need this function. */
#if defined (REENTRANT_SYSCALLS_PROVIDED) || defined (MALLOC_PROVIDED)
int _dummy_sbrk_syscalls = 1;
#else
/* We use the errno variable used by the system dependent layer. */
#undef errno
extern int errno;
/*
FUNCTION
<<_sbrk_r>>---Reentrant version of sbrk
INDEX
_sbrk_r
ANSI_SYNOPSIS
#include <reent.h>
void *_sbrk_r(struct _reent *<[ptr]>, ptrdiff_t <[incr]>);
TRAD_SYNOPSIS
#include <reent.h>
void *_sbrk_r(<[ptr]>, <[incr]>)
struct _reent *<[ptr]>;
ptrdiff_t <[incr]>;
DESCRIPTION
This is a reentrant version of <<sbrk>>. It
takes a pointer to the global data block, which holds
<<errno>>.
*/
void *
_sbrk_r (ptr, incr)
struct _reent *ptr;
ptrdiff_t incr;
{
char *ret;
void *_sbrk(ptrdiff_t);
errno = 0;
if ((ret = (char *)(_sbrk (incr))) == (void *) -1 && errno != 0)
ptr->_errno = errno;
return ret;
}
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */