This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Java PATCH] Fix libjava bootstrap issues on HP-UX 11.00


> I never remember whether _REENTRANT is defined on all the
> posix-threads-using platforms.  That's why I've been (half-heartedly)
> pushing for a solution which is transparently HPUX-only... it is just
> simpler to review :-)

_REENTRANT is defined when --enable-threads=posix is used under hpux11,
or when --enable-threads=yes|dce is used under hpux10 and -mt or -pthread
is present on the command line.  However, it's not defined with the
default --enable-threads=none.

> If _REENTRANT is defined everywhere, then a patch like this one
> is fine by me.  Otherwise I think it need to be handled some other
> way, e.g., by changing the configure checks to realize that the
> functions in question are not actually available.

The functions getpwuid_r, readdir_r and localtime_r are only declared
by the system headers when _REENTRANT is defined.  The functions are
present in libc under both hpux10 and hpux11.  However, the _PTHREADS_DRAFT4
hpux10 functions are not the same as POSIX hpux11 functions.  For
example,

#    ifdef _REENTRANT
#     ifdef _PTHREADS_DRAFT4
       extern int getpwuid_r(uid_t, struct passwd *, char *, int);
#     else
       extern int getpwuid_r(uid_t, struct passwd *, char *, __size_t, struct passwd **);
#     endif /* _PTHREADS_DRAFT4 */
#    endif

The _PTHREADS_DRAFT4 guard is not present in hpux10.  The hpux10 reentrant
functions aren't compatible with the POSIX ones expected by libjava.  DCE
threads also aren't usable.  So, I believe configure either has to force
threads to "none" when building libjava and boehm-gc, or the the toplevel
configure has to disable building these libraries when threads are enabled.

The libjava configure script always defines _REENTRANT when posix threads
are used.  Given that the interfaces have changed for some of these functions,
it would appear that configure needs to be enhanced to check for posix
compatible declarations of these functions.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]