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

[PATCH] Adds perl_clone_host under IMPLICIT SYS

Thread Next
From:
Artur Bergman
Date:
June 26, 2001 06:33
Subject:
[PATCH] Adds perl_clone_host under IMPLICIT SYS
Message ID:
B75E5BA5.1A7C%artur@contiller.se

The following patch (attached if any line problems) adds perl_clone_host in
win32/perllib.c, it also adds a flag CLONEf_CLONE_HOST to perl_clone for
cloning the host aswell. PerlProcFork in perlhost.h should be changed to use
this in the future.

IMHO CPerlHost should have a C API aswell!

Patch tested on win32 and linux, no new test failings. Needed for
threads-0.01 to be released. (threads-0.01 will be cpaned when 5.7.2 is)

Artur


--- sv.c.old    Mon Jun 25 10:33:02 2001
+++ sv.c    Tue Jun 26 14:05:32 2001
@@ -8957,7 +8957,7 @@
     }
     HvPMROOT((HV*)dstr)    = HvPMROOT((HV*)sstr);        /* XXX */
     HvNAME((HV*)dstr)    = SAVEPV(HvNAME((HV*)sstr));
-    /* Record stashes for possible cloning in Perl_clone_using(). */
+    /* Record stashes for possible cloning in Perl_clone(). */
     if(HvNAME((HV*)dstr))
         av_push(param->stashes, dstr);
     break;
@@ -9451,7 +9451,14 @@
 #endif
 
 #ifdef PERL_IMPLICIT_SYS
-    return perl_clone_using(proto_perl, flags,
+
+   /* perlhost.h so we need to call into it
+   to clone the host, CPerlHost should have a c interface, sky */
+
+   if (flags & CLONEf_CLONE_HOST) {
+       return perl_clone_host(proto_perl,flags);
+   }
+   return perl_clone_using(proto_perl, flags,
                 proto_perl->IMem,
                 proto_perl->IMemShared,
                 proto_perl->IMemParse,
--- win32/perllib.c.old    Mon Jun 25 10:32:59 2001
+++ win32/perllib.c    Tue Jun 26 13:25:10 2001
@@ -396,3 +396,26 @@
     }
     return TRUE;
 }
+
+#ifdef USE_ITHREADS
+EXTERN_C PerlInterpreter *
+perl_clone_host(PerlInterpreter* proto_perl, UV flags) {
+    dTHXo;
+    CPerlHost *h;
+    h = new CPerlHost(*(CPerlHost*)PL_sys_intern.internal_host);
+    proto_perl = perl_clone_using(proto_perl, flags,
+                        h->m_pHostperlMem,
+                        h->m_pHostperlMemShared,
+                        h->m_pHostperlMemParse,
+                        h->m_pHostperlEnv,
+                        h->m_pHostperlStdIO,
+                        h->m_pHostperlLIO,
+                        h->m_pHostperlDir,
+                        h->m_pHostperlSock,
+                        h->m_pHostperlProc
+    );
+    proto_perl->Isys_intern.internal_host = h;
+    return proto_perl;
+    
+}
+#endif
--- makedef.pl.old    Mon Jun 25 10:33:01 2001
+++ makedef.pl    Tue Jun 26 14:15:21 2001
@@ -148,6 +148,7 @@
     if ($define{PERL_IMPLICIT_SYS}) {
     output_symbol("perl_get_host_info");
     output_symbol("perl_alloc_override");
+    output_symbol("perl_clone_host");
     }
 }
 elsif ($PLATFORM eq 'os2') {
@@ -185,6 +186,7 @@
     if ($define{PERL_IMPLICIT_SYS}) {
     output_symbol("perl_get_host_info");
     output_symbol("perl_alloc_override");
+    output_symbol("perl_clone_host");
     }
 }
 
--- sv.h.old    Mon Jun 25 10:33:02 2001
+++ sv.h    Tue Jun 26 11:43:15 2001
@@ -1215,6 +1215,7 @@
 
 #define CLONEf_COPY_STACKS 1
 #define CLONEf_KEEP_PTR_TABLE 2
+#define CLONEf_CLONE_HOST 4
 
 typedef struct {
   AV* stashes;


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