From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id BF7761F54E for ; Sun, 4 Sep 2022 07:01:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1662274866; bh=2BVOmOvI2e7NQfpUifMlO0qEcpneenwJoMEDmX7UAC0=; h=Date:From:To:Subject:References:In-Reply-To:From; b=GMPGDsGNlEIFGHAD+AGIABzPLArovSJ+jzYrz0OMDY9aJZAzBFUccLNziqwOPJahJ 8WRcEfZqjyObcUEsagUvCbk9GnV4ej0R5jbQUQBrh9EeEAJS9TxosuSAh5LTxT4c/J MYVUrVqIRm2Mk9mshbD5fRdxJXXoAxqEoJLP/B9I= Date: Sun, 4 Sep 2022 07:01:55 +0000 From: Eric Wong To: Eric Wong Subject: Re: [PATCH 2/4] cleanup some FreeBSD-related workarounds Message-ID: <20220904070155.M530408@dcvr> References: <20220903111828.2316808-1-mwrap-perl@80x24.org> <20220903111828.2316808-3-mwrap-perl@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220903111828.2316808-3-mwrap-perl@80x24.org> List-Id: Eric Wong wrote: > diff --git a/Mwrap.xs b/Mwrap.xs > index e888a1c..3392fee 100644 > --- a/Mwrap.xs > +++ b/Mwrap.xs > @@ -124,19 +130,20 @@ __attribute__((constructor)) static void resolve_malloc(void) > /* initialize mutexes used by urcu-bp */ > rcu_read_lock(); > rcu_read_unlock(); > +#ifndef __FreeBSD__ > + } else { > + if (!real_malloc) { > + resolving_malloc = 1; > + real_malloc = dlsym(RTLD_NEXT, "malloc"); > + } > + real_free = dlsym(RTLD_NEXT, "free"); > + if (!real_malloc || !real_free) { > + fprintf(stderr, "missing malloc/aligned_alloc/free\n" > + "\t%p %p\n", real_malloc, real_free); > + _exit(1); > + } > } > -#else /* !FreeBSD (tested on GNU/Linux) */ > - if (!real_malloc) { > - resolving_malloc = 1; > - real_malloc = dlsym(RTLD_NEXT, "malloc"); > - } > - real_free = dlsym(RTLD_NEXT, "free"); > - if (!real_malloc || !real_free) { > - fprintf(stderr, "missing malloc/aligned_alloc/free\n" > - "\t%p %p\n", real_malloc, real_free); > - _exit(1); > - } > -#endif /* !FreeBSD */ > +#endif /* !__FreeBSD__ */ > err = pthread_atfork(call_rcu_before_fork, > call_rcu_after_fork_parent, > call_rcu_after_fork_child); Will squash this in so that it actually compiles :x diff --git a/Mwrap.xs b/Mwrap.xs index 3392fee..bec4664 100644 --- a/Mwrap.xs +++ b/Mwrap.xs @@ -142,8 +142,8 @@ __attribute__((constructor)) static void resolve_malloc(void) "\t%p %p\n", real_malloc, real_free); _exit(1); } - } #endif /* !__FreeBSD__ */ + } err = pthread_atfork(call_rcu_before_fork, call_rcu_after_fork_parent, call_rcu_after_fork_child);