Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.os.linux.development.system > #387

Re: Calling libiptc API from a separate thread in a C program throws segmentati

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From Kaz Kylheku <kaz@kylheku.com>
Newsgroups comp.os.linux.development.system
Subject Re: Calling libiptc API from a separate thread in a C program throws segmentati
Date Tue, 17 Jan 2012 23:13:23 +0000 (UTC)
Organization A noiseless patient Spider
Lines 37
Message-ID <20120117145720.863@kylheku.com> (permalink)
References <bKSdndZeXcWVzYjS4p2dnAA@giganews.com> <20120117102310.171@kylheku.com> <slrnjhbpr9.1ls.grahn+nntp@frailea.sa.invalid> <20120117135234.277@kylheku.com> <87d3aif0ea.fsf@araminta.anjou.terraraq.org.uk> <20120117141633.815@kylheku.com> <8739bekkmy.fsf@araminta.anjou.terraraq.org.uk>
Injection-Date Tue, 17 Jan 2012 23:13:23 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="UCk3K/YilCUd19+i749f3A"; logging-data="18652"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tdjPPNViEpRJZblnX6WQlpzZMq9Cic8s="
User-Agent slrn/pre1.0.0-18 (Linux)
Cancel-Lock sha1:tI8QZOs1mAcOy7qynjJXw4kuUTI=
Xref x330-a1.tempe.blueboxinc.net comp.os.linux.development.system:387

Show key headers only | View raw


On 2012-01-17, Richard Kettlewell <rjk@greenend.org.uk> wrote:
> Kaz Kylheku <kaz@kylheku.com> writes:
>> Richard Kettlewell <rjk@greenend.org.uk> wrote:
>
>>> errno ends up indirected either way though (at least here).
>> "Either way" between which alternatives?
>
> $ cat t.c
> #include <errno.h>
>
> int main() { return errno; }
> $ gcc -E t.c|grep main
> int main() { return (*__errno_location ()); }
> $ gcc -pthread -E t.c|grep main
> int main() { return (*__errno_location ()); }
>
> I think you must have misread the condition in bits/errno.h.

Indeed I did. But what's shocking is how long ago that behavior changed, wow.

They have all the history back-ported into git.

It was in 1997 that checks for __USE_REENTRANT was dropped from there and other
numerous other places:

http://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/unix/sysv/linux/bits/errno.h;h=19361cb768c280e47f2ca69ed63e1d75f332e592

In the commit comment, Drepper declared a policy:

``Don't use __USE_REENTRENT.  All code must be prepared to be running in a
multi-threaded environment.'' 

So that's that. On glibc, -lpthread is basically enough. Everything is switched
to thread-safe by linkage to stub pthread routines that get overriden by the
real ones.

(I was just thinking that errno was still an exception.)

Back to comp.os.linux.development.system | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Calling libiptc API from a separate thread in a C program throws segmentati kkgarg78 <nospam_kamalkgarg@gmail.com.invalid> - 2012-01-17 04:40 -0600
  Re: Calling libiptc API from a separate thread in a C program throws segmentati Kaz Kylheku <kaz@kylheku.com> - 2012-01-17 18:48 +0000
    Re: Calling libiptc API from a separate thread in a C program throws segmentati Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-01-17 21:26 +0000
      Re: Calling libiptc API from a separate thread in a C program throws segmentati Kaz Kylheku <kaz@kylheku.com> - 2012-01-17 22:03 +0000
        Re: Calling libiptc API from a separate thread in a C program throws segmentati Richard Kettlewell <rjk@greenend.org.uk> - 2012-01-17 22:07 +0000
          Re: Calling libiptc API from a separate thread in a C program throws segmentati Kaz Kylheku <kaz@kylheku.com> - 2012-01-17 22:34 +0000
            Re: Calling libiptc API from a separate thread in a C program throws segmentati Richard Kettlewell <rjk@greenend.org.uk> - 2012-01-17 22:51 +0000
              Re: Calling libiptc API from a separate thread in a C program throws segmentati Kaz Kylheku <kaz@kylheku.com> - 2012-01-17 23:13 +0000
        Re: Calling libiptc API from a separate thread in a C program throws segmentati Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-01-17 22:56 +0000
  Re: Calling libiptc API from a separate thread in a C program throws segmentati Richard Kettlewell <rjk@greenend.org.uk> - 2012-01-21 11:29 +0000

csiph-web