Steven Stewart-Gallus | 29 Aug 01:46 2014

What is GLibc's policy on what is safe to use after a fork from a multithreaded program?


POSIX conformance constrains one to only use async-signal-safe
functions after a fork from a mulithreaded program.  More practically,
fork fucks with state such as the PID, pending signals, timers,
outstanding asynchronous I/O operations and locks that threads are
holding onto.  I need to fork from a multithreaded program and do
complicated things such as sandboxing a process with non
async-signal-safe functions such as mount, syscall, unshare, umount2
and setgroups (I can't exec a helper process because that drops
capabilities automatically).  I can always check the GLibc source and
verify if problems will happen but that becomes really painful when
checking all the system calls I use.  As well, in the future GLibc can
always change functions to be not safe after a fork from a
multithreaded program.  What is GLibc's policy on what is safe to use
after a fork from a multithreaded program?  There doesn't seem to be
any documentation about this.

Thank you,
Steven Stewart-Gallus

Mark Boorer | 28 Aug 17:54 2014

dlopen, RTLD_LOCAL and identically named libraries


I have a question regarding dlopen with RTLD_LOCAL and libraries with
identical names

I have two versions of a library with the same filename in separate
directories, and I have two separate "plugins", each linking to one
version of the library. -> library1/ -> library2/

The path to is baked into the RPATH of each plugin, so when
ran independently, they each call the correct functions. However, when
I load both plugins one after the other (with RTLD_NOW | RTLD_LOCAL) ,
only the first version of is used.

The behaviour is the same if the two versions of share an
soname as well. It seems as though the basename of the library (or the
soname) is checked at a global level.
I would expect that behaviour if was already linked in the
global scope, but in my case it is not.

Is this the intended behaviour? I would have thought that RTLD_LOCAL
would start the library search afresh.

I have a small example C application that demonstrates the issue if required.

Any help/advice would be greatly appreciated :)

(Continue reading)

frank ernest | 22 Aug 05:30 2014

Re: Regex: Will re_nsub be zero if REG_NOSUB was passed to regcomp?

>> Regex: Will re_nsub be zero if REG_NOSUB was passed to regcomp?
> From a programming portability perspective, the value of re_nsub in this
> case could be either zero or the number of subexpressions, or anything
> in between; you've told regcomp you don't care about anything but
> pass/fail. You should not be checking this value and expecting a
> consistent or portable result.
> Is there a context in which having this be determinate is of value?

Yes, if I gave the user the ability to choose to get infomation out of the regex match or to save memory by not
recording the information then I could check the value of re_nsub to determine which option was selected.
If there is no information I thought that re_nsub might not ever be set, but I don't know. Currently, I'm
using an ifdef, but it's not what I would call ideal. I could find this out and offer the option globally
through a global variable, but I wanted to check about this, I'm curious.

Thanks, David

Suhas Chakravarty | 12 Aug 06:03 2014

Re: ftstc implementation

I am actually trying to create a semihosting enabled version of uboot
so that I can bring it up on my custom ARM simulator, which doesn't
have a UART in it right now. Therefore function definitions (printf,
tstc etc) in console.c (one of the uboot sources), which rely on the
target UART driver, need to be commented out and their definitions in
newlib applied. It is in this context that I was searching for a
newlib implementation of tstc/ftstc.


On Mon, Aug 11, 2014 at 12:09 PM, Carlos O'Donell
<carlos@...> wrote:
> On Mon, Aug 11, 2014 at 7:44 AM, Suhas Chakravarty
> <suhas.chakravarty@...> wrote:
>> Hi Carlos
>> Sorry about replying late. Yes, I am attempting port a stripped down
>> version of uboot to the GNU compiler toolchain. The comments in uboot
>> code imply that tstc() and ftstc() are used to test for the presence
>> of a character in stdin or a file, without actually reading it. For
>> now I have thought of implementing it as a getc() followed by
>> ungetc(). Do you think that's a good enough implementation?
> U-Boot [1], last I checked 2 years ago, was compilable by gcc, and had
> been so for all the years I worked in embedded Linux development.
> Are you certain it needs porting or the use of tstc and ftstc?
> Yes, I do believe that implementing them using glibc's primitives is
> as good a solution as you're going to get for your a first cut of your
(Continue reading)

Guoqiuping | 11 Aug 13:56 2014

there is a problem when debug glibc compiled by myself with gdb

I compiled glibc with -g, but when I run test program with the glibc, segmentation fault happened.
Would anyone can help me? How can I run programs with the glibc I compiled by myself?

The environment is as below:
uname -a:
Linux linux156 #1 SMP 2012-07-13 15:50:56 +0200 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/SuSE-release:
SUSE Linux Enterprise Server 11 (x86_64)

rpm -aq glibc :

rpm -aq gcc :

and I compiled glibc-2.11.1.tar.bz2 with "-O1 -g" options by myself using below commands
tar xvf glibc-2.11.1.tar.bz2
mkdir glibc2111
cd glibc2111
../glibc-2.11.1/configure --prefix=3D/home/hksee/glibc2111 CFLAGS "-O1 -g" = CPPFLAGS "-O1 -g"
make install

and then ran my test program in gdb as below, but Segmentation fault happened:
gdb elf/
(gdb) set exec-wrapper env LD_LIBRARY_PATH=3D~/glibc2111:~/glibc2111/elf
(Continue reading)

Joël Krähemann | 10 Aug 07:32 2014

fast additive copy method

Hi, I'm doing a soft synth and I'm looking for fast additive copy
methods. Does glibc provide such functions?

best regards

frank ernest | 8 Aug 18:33 2014

Fw: Will strerror messages be automatically translated...

Will strerror messages be automatically translated or do I have to call gettext on them?
In other words:
err_str = strerror(errno);
fprintf(stderr, err_str );
err_str = strerror(errno);
fprintf(stderr, gettext(err_str) );

frank ernest | 8 Aug 18:30 2014

Regex: Will re_nsub be zero if REG_NOSUB was passed to regcomp?

Regex: Will re_nsub be zero if REG_NOSUB was passed to regcomp?

Suhas Chakravarty | 6 Aug 14:26 2014

ftstc implementation

Is ftstc()'s implementation provided as part of libc? It tests for the
presence of a char in stdin/file.

Joël Krähemann | 2 Aug 20:02 2014

Multiplexing by time in userspace required by every application

Could someone approve the frequencies of Advanced Gtk+ Sequencer. While 
playing accoustics I do the following or something else:

   if((AGS_AUDIO_LOOP_PLAY_RECALL & (audio_loop->flags)) == 0 &&
      (AGS_AUDIO_LOOP_PLAY_CHANNEL & (audio_loop->flags)) == 0 &&
      (AGS_AUDIO_LOOP_PLAY_AUDIO & (audio_loop->flags)) == 0){
     struct timespec delay = {

     nanosleep(&delay, NULL);
     struct timespec delay = {

     nanosleep(&delay, NULL);

I really believe it should be reverse case

kind regards

David Livshin | 29 Jul 06:40 2014

Thread safety of functions generated when using -ffinite-math-only gcc command option


gcc ( when called with -ffinite-math-only option ) generates calls to 
"__<name>_finite" functions ( e.g. __exp_finite ) - which of these 
functions are thread safe?
May it be assumed that  "__<name>_finite" function is thread safe iff 
"<name>" is thread safe?

Thank you in advance,

David Livshin