strtok_r() HP-UX,

Kevin Steves stevesk at sweden.hp.com
Tue Sep 26 19:14:56 EST 2000


On Tue, 26 Sep 2000, Damien Miller wrote:
: > Until I can determine what the issue and background is, you'll need to
: > define _REENTRANT in the latest snapshot so the strtok_r() function
: > prototype is pulled in from <string.h>.  This is for HP-UX 11.0; I'm not
: > sure about 10.20.
:  
: Any objections to setting this unconditionally? IIRC there was some other
: platform (Irix?) where you needed to do the same.

For HP-UX, this is what I found in pthread(3):

      Note: When explicitly specifying ANSI compilation (via "-Aa"),
      defining the POSIX revision level restricts the program to using
      interfaces within the POSIX namespaces.  If interfaces in the larger
      X/Open namespace are to be called, either of the compiler options,
      -D_XOPEN_SOURCE_EXTENDED or -D_HPUX_SOURCE, must be specified in
      addition to -D_POSIX_C_SOURCE=199506L.  Alternatively, compiling with
      -Ae (or not specifying "-A") will implicitly specify -D_HPUX_SOURCE.

      Note: Some documentation will recommend the use of -D_REENTRANT for
      compilation.  While this also functions properly, it is considered an
      obsolescent form.

There's also this in string(3):

      Users of strtok_r() should also note that the prototype of this
      function will change in the next release for conformance with the new
      POSIX Threads standard.

Though it's been there for years (at least since 10.20).

Looking at Solaris 2.7 string.h:

#if     defined(__EXTENSIONS__) || defined(_REENTRANT) || \
            (_POSIX_C_SOURCE - 0 >= 199506L)
extern char *strtok_r(char *, const char *, char **);
#endif  /* defined(__EXTENSIONS__) || defined(_REENTRANT) .. */

So if it's needed on a bunch of platform, perhaps defining either
_REENTRANT or _POSIX_C_SOURCE=199506L unconditionally is the way to go.

This is what I did for HP-UX:

*** openssh/configure.in	Sat Sep 23 05:12:25 2000
--- openssh-ks/configure.in	Mon Sep 25 16:46:25 2000
***************
*** 68,74 ****
  	;;
  *-*-hpux10*)
  	if test -z "$GCC"; then
! 		CFLAGS="$CFLAGS -Ae"
  	fi
  	CFLAGS="$CFLAGS -D_HPUX_SOURCE"
  	IPADDR_IN_DISPLAY=yes
--- 68,74 ----
  	;;
  *-*-hpux10*)
  	if test -z "$GCC"; then
! 		CFLAGS="$CFLAGS -Ae -D_REENTRANT"
  	fi
  	CFLAGS="$CFLAGS -D_HPUX_SOURCE"
  	IPADDR_IN_DISPLAY=yes
***************
*** 80,86 ****
  	mansubdir=cat
  	;;
  *-*-hpux11*)
! 	CFLAGS="$CFLAGS -D_HPUX_SOURCE"
  	IPADDR_IN_DISPLAY=yes
  	AC_DEFINE(USE_PIPES)
  	AC_DEFINE(DISABLE_SHADOW)
--- 80,86 ----
  	mansubdir=cat
  	;;
  *-*-hpux11*)
! 	CFLAGS="$CFLAGS -D_HPUX_SOURCE -D_REENTRANT"
  	IPADDR_IN_DISPLAY=yes
  	AC_DEFINE(USE_PIPES)
  	AC_DEFINE(DISABLE_SHADOW)






More information about the openssh-unix-dev mailing list