This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: __curbrk (and &_end)
- From: Roland McGrath <roland at redhat dot com>
- To: Robert Millan <zeratul2 at wanadoo dot es>
- Cc: libc-alpha at sources dot redhat dot com, glibc-bsd-hackers at nongnu dot org
- Date: Mon, 23 Feb 2004 13:23:09 -0800
- Subject: Re: __curbrk (and &_end)
> The resulting code is pretty generic, and I think it could be added to
> sysdeps/generic/brk.c. Would you like me to send a patch for that? It'd
> roughly look like:
>
> int
> __brk (void *addr)
> {
> #ifdef SYS_break
> if (__curbrk == NULL)
> __curbrk = &_end;
> ...
> if (syscall (SYS_break, addr) == -1)
> ...
> #else
> __set_errno (ENOSYS)
> return -1;
> #endif
> }
No other implementation will look like this, unless you replace syscall
with something like the linux INLINE_SYSCALL_* macros.