View Single Post

   
  #3 (permalink)  
Old 01-05-2008, 03:23 AM
Vlada
 
Posts: n/a
Default Re: strerror thread safe version

man strerror_r is the first command that I tried, but this man page
does not exist on any of my 5 different AIX boxes. My search on the
net failed, too.

Anyway, strerror_r function is defined in libc_r and strings.h defines
function as:

# ifdef _THREAD_SAFE
extern int strerror_r(int, char *, int);
# endif /* _THREAD_SAFE */

I guess the first arg is errno, second is caller's buffer and the
third is the max buffer size.
I'm not sure what does the function returns.

I would really appreciate if someone sends me the copy of strerror_r
AIX man page.
Thanks a lot,
Vlad


Paul Pluzhnikov <ppluzhnikov-nsp@charter.net> wrote in message news:<m3ekkk5zs8.fsf@salmon.parasoft.com>...
> vlada1703@yahoo.com (Vlada) writes:
>
> > I paid a big price debugging core dumps to figure out that AIX
> > strerror is not thread safe (as it is on Solaris and HPUX).

>
> IBM's documentation page for strerror() says at the beginning:
>
> Attention: Do not use the strerror subroutine in a multithreaded
> environment.
>
> > Does anyone have any suggestion how to replace strerror() with some
> > code that is thread safe?

>
> Sure, "man strerror_r"
>
> Cheers,

Reply With Quote