Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] json-c fix, question about -D_REENTRANT
Date: Mon, 27 Aug 2012 01:50:41 +0200	[thread overview]
Message-ID: <503AB651.3010806@mind.be> (raw)
In-Reply-To: <1345903992-27961-1-git-send-email-thomas.petazzoni@free-electrons.com>

On 08/25/12 16:13, Thomas Petazzoni wrote:
> The attached patch fixes the build of json-c when thread support is
> not available. This library does not require thread support: it was
> compatible with -D_REENTRANT in all cases, which is only possible when
> thread support is available.
>
> However, I didn't commit this directly, because I am not sure what the
> right fix is. My fix is to just get rid of -D_REENTRANT.
>
> However, according to
> http://pauillac.inria.fr/~xleroy/linuxthreads/faq.html#H, all code
> used in a multithreaded application should be built with -D_REENTRANT,
> even if this code itself is not creating/manipulating threads.

  Note that that FAQ is pretty old.

>
> So, technically, removing -D_REENTRANT seems like an incorrect: it
> should be kept if the toolchain supports thread.

  I looked at the source of uClibc 0.32 and 0.33, and it looks like they
automatically select the reentrant versions of errno and getc if
HAS_THREADS is defined.  As to the _r reentrant functions, they're
always there (except, for some reason, getlogin_r) - but for those you'd
anyway get a compile or link error.

  I expect glibc will always build the reentrant versions.

  So I guess you can remove the -D_REENTRANT.


  Regards,
  Arnout

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

      parent reply	other threads:[~2012-08-26 23:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-25 14:13 [Buildroot] json-c fix, question about -D_REENTRANT Thomas Petazzoni
2012-08-25 14:13 ` [Buildroot] [PATCH] json-c: fix build when no thread support is available Thomas Petazzoni
2012-09-06 21:32   ` Peter Korsgaard
2012-08-26 23:50 ` Arnout Vandecappelle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=503AB651.3010806@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox