[Gc] Re: Defining USE_LIBC_PRIVATES on all glibc systems

Ludovic Courtès ludo at gnu.org
Tue May 21 15:19:48 PDT 2013


Hello,

Any comments on this patch?

TIA,
Ludo’.

ludo at gnu.org (Ludovic Courtès) skribis:

> Currently ‘USE_LIBC_PRIVATES’ is disabled by default, and only checked
> on GNU/Linux.  The default on GNU/Linux is to get info from /proc.
>
> What about using it unconditionally on glibc systems?
>
> On GNU/Linux, that would work even in situations where /proc is
> unavailable (such as during early boot), and would be more efficient.
>
> It would also simplify things for GNU/kFreeBSD and GNU/Hurd, and allow
> (for instance) calls to ‘GC_INIT’ from a secondary thread (as in
> tests/initsecondarythread.c) on these platforms.
>
> Here’s a tentative patch:
>
> diff --git a/os_dep.c b/os_dep.c
> index cb3ef43..ac5c282 100644
> --- a/os_dep.c
> +++ b/os_dep.c
> @@ -1005,7 +1005,12 @@ GC_INNER word GC_page_size = 0;
>  
>  #endif /* HPUX_STACK_BOTTOM */
>  
> -#ifdef LINUX_STACKBOTTOM
> +#ifdef __GLIBC__
> +/* Use glibc's stack-end marker.  */
> +# define USE_LIBC_PRIVATES
> +#endif
> +
> +#if defined LINUX_STACKBOTTOM || defined __GLIBC__
>  
>  # include <sys/types.h>
>  # include <sys/stat.h>
> diff --git a/tests/initsecondarythread.c b/tests/initsecondarythread.c
> index 4a13ca9..1973b8a 100644
> --- a/tests/initsecondarythread.c
> +++ b/tests/initsecondarythread.c
> @@ -69,6 +69,7 @@ int main(void)
>         || (defined(DARWIN) && !defined(NO_PTHREAD_GET_STACKADDR_NP)) \
>         || (defined(LINUX) && !defined(NACL)) \
>         || (defined(GC_SOLARIS_THREADS) && !defined(_STRICT_STDC)) \
> +       || (defined(__GLIBC__)					  \
>         || (!defined(STACKBOTTOM) && (defined(HEURISTIC1) \
>            || (!defined(LINUX_STACKBOTTOM) && !defined(FREEBSD_STACKBOTTOM)))))
>      /* GC_INIT() must be called from main thread only. */
>
> Thanks,
> Ludo’.
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/



More information about the Gc mailing list