develooper Front page | perl.perl5.porters | Postings from January 2001

JPL hack

Thread Next
From:
cd
Date:
January 31, 2001 12:47
Subject:
JPL hack
Message ID:
200101312037.MAA16748@carios2.ca.boeing.com
There have been persistent JPL failures/cores with jdk1.2/1.3. 
Some brute force debugging on Solaris 2.7 revealed that Java
is apparently no longer tolerant of native code diddling the
environment. I don't know Java well but someone suggested Java's 
heavier internal threading may have become a problem.  

Here's a quick hack that gets JPL working with an environment
dup. I've verified that this works on Solaris 2.7 with both 
5.6.0 and 5.005_03. (By works, I mean doesn't get a segv/
problematic thread core dump with the Sample program in 
the JPL distribution.) 

JPL is a key tool for several projects here. Any chance of 
some fluent variant of this getting implemented? Other 
workarounds?
 

Rgds,
--
Charles DeRykus 


*** perl.c	Tue Jan 30 18:06:05 2001
--- perl.c.orig	Fri Mar 17 14:35:15 2000
***************
*** 11,22 ****
   * "A ship then new they built for him/of mithril and of elven glass" --Bilbo
   */
  
- /* dup environment if JPL */
- #ifdef JPL
- char **my_env_base, **env_base, **my_env;  
- int my_env_count = 0;
- #endif
- 
  #include "EXTERN.h"
  #define PERL_IN_PERL_C
  #include "perl.h"
--- 11,16 ----
***************
*** 3204,3239 ****
  	    env = environ;
  	if (env != environ)
  	    environ[0] = Nullch;
- #ifdef JPL
-         env_base = env;
-         for (; *env; env++) 
-             my_env_count++;
-         my_env = (char **) safemalloc( sizeof(char *) * (my_env_count+1) );
-         my_env_base = my_env;
-         env = env_base;
-         for (; *env; env++, my_env++) {
-            *my_env = (char *) safemalloc( sizeof(char) * (strlen(*env)+1) );
-            strcpy( *my_env, *env );
-         }
-         *my_env = '\0';
-         my_env = my_env_base;
-         for (; *my_env; my_env++) {
-             if ( !(s = strchr(*my_env,'=')))
-                 continue;
-             *s++ = '\0';
- #if defined(MSDOS)
-             (void)strupr(*my_env);
- #endif
-             sv = newSVpv(s--,0);
-             (void)hv_store(hv, *my_env, s - *my_env, sv, 0);
-             *s = '=';
- #if defined(__BORLANDC__) && defined(USE_WIN32_RTL_ENV)
-             /* Sins of the RTL. See note in my_setenv(). */
-             (void)PerlEnv_putenv(savepv(*my_env));
- #endif
-         }
-              /*  non-JPL */
- #else
  	for (; *env; env++) {
  	    if (!(s = strchr(*env,'=')))
  		continue;
--- 3198,3203 ----
***************
*** 3250,3256 ****
  #endif
  	}
  #endif
- #endif
  #ifdef DYNAMIC_ENV_FETCH
  	HvNAME(hv) = savepv(ENV_HV_NAME);
  #endif
--- 3214,3219 ----

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About