vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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). Does anyone have any suggestion how to replace strerror() with some code that is thread safe? Having a mutex around it sounds like the last option because it would be hard to share the same mutex in all different shared libraries that my product consists of. Thanks, Vlad |
| |||
| 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, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. |
| |||
| 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, |
| ||||
| Vlada wrote: > 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. > > I would really appreciate if someone sends me the copy of strerror_r > AIX man page. There doesn't appear to be a man page (i.e. it's not documented in the 5.2 pubs). Someone should complain about that. The first arg is the error number, the 2nd a pointer to a buffer, the third the length of said buffer. Max size appears to be NL_TEXTMAX. If the error number is invalid, you get EINVAL as the return value; if the buffer is too small to hold the message, you get ERANGE as the return value. Some invalid arguments might get you a -1 return value. You get a zero on success. -- Gary R. Hook __________________________________________________ ______________________ Vocatus atque non vocatus deus aderit |