Jeff Trawick <traw...@gmail.com> wrote: > On Fri, Oct 16, 2015 at 7:45 PM, Rainer M. Canavan <a...@canavan.de> wrote: > > > William A Rowe Jr <wr...@rowe-clan.net> wrote: > > > Any chance you could review the man page of these functions on IRIX and > > > report back, specifically return value and error exceptions? MAX is a > > > valid value. They might be playing some game with endptr to signify > > errors. > > > > There's no hint to such a behaviour in the manpage (available > > online e.g. at > > http://irix.polarhome.com/service/man/?qf=strtoull&tf=2&of=IRIX&sf=3 ), > > and my experiments would indicate that the endptr just doesn't care > > about numeric overflows and happily points at the character following > > 100 or more '9's. > > > > It turns out that it is indeed pthread's fault, and errno behaves > > properly if one either #include <pthread.h> as well whenever <errno.h> > > is used, or alternatively, errno.h can be persuaded to use the thread-safe > > definition of errno by defining _SGI_MP_SOURCE, _POSIX_C_SOURCE >= 199506L > > or _XOPEN_SOURCE >= 500. I haven't tested any of those with apr yet, > > just with a small test program. > > > > rainer > > > > That's essentially like _REENTRANT on Solaris; I helped someone with their > hopeless socket API code years ago and saw that they had inserted checks > for all sorts of errno values they had seen in testing but it was never > enough. (They weren't accessing the errno value for the thread.) > > Look in build/apr_hints.m4 for the proper place for such settings, including > > *-irix*) > APR_ADDTO(CPPFLAGS, [-D_POSIX_THREAD_SAFE_FUNCTIONS])
_SGI_MP_SOURCE=1 seems to work: - APR_ADDTO(CPPFLAGS, [-D_POSIX_THREAD_SAFE_FUNCTIONS]) + APR_ADDTO(CPPFLAGS, [-D_POSIX_THREAD_SAFE_FUNCTIONS -D_SGI_MP_SOURCE=1]) The other two defines I listed above aren't useful for building apr. -D_POSIX_C_SOURCE=199506 causes a build failure because getpass() is undefined, and "A value of type "int" cannot be used to initialize an entity of type "char *" in apr_getpass.c Line 242. If I cause "function is declared implicitly" to cause compile errors, configure aborts while trying to determine the format for apr_ssize_t (because exit() is defined implicitly in those tests). Similarly, defining _XOPEN_SOURCE makes hstrerror() disappear. I would have expected autoreconf to be sufficient to pick up changes to apr_hints.m4, or ideally just running make to cause a complete re-build of all the auto* stuff, but I had to unpack the source, edit apr_hints.m4, run autoreconf, configure and build to get the desired changes to propagate. rainer