From: Katsuyuki Komatsu Date: 1999-06-03T10:13:27+09:00 Subject: [ruby-dev:7071] [PATCH] AIX mod_ruby support 小松です。 Perl5-Porters Mailing List、 http://www.perl.org/maillist.html#p5p のArchive、 http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/ を眺めていたところ、 [DynaLoader does not work properly if perl is not the main program (AIX)] http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1999-05/msg02107.html というのがありました。 これによるとrubyの方のdln.cで、 main_module = aix_findmain(); loadbind(0, main_module, (void*)init_fct); としている所は、 loadbind(0, (void*)dln_load, (void*)init_fct); で十分で、以前追加してもらったaix_findmain()は不要というかmod_ruby サポートのためには有害であるということです。 # せっかく追加してもらったのに…… ということでパッチ。 rubyの方の動作は確認済みですが、mod_rubyの動作確認はちょっと…… Makefile.RBに修正が必要なことは分かっていますが。 Index: dln.c =================================================================== RCS file: /home/cvs/ruby/dln.c,v retrieving revision 1.1.1.3.2.11 diff -u -p -r1.1.1.3.2.11 dln.c --- dln.c 1999/05/31 09:13:03 1.1.1.3.2.11 +++ dln.c 1999/06/03 01:06:18 @@ -1158,35 +1158,6 @@ dln_strerror() #if defined(_AIX) -static void * -aix_findmain() -{ - struct ld_info *lp; - char *buf; - int size = 4 * 1024; - int rc; - void *ret; - - if ((buf = xmalloc(size)) == NULL) { - return NULL; - } - while ((rc = loadquery(L_GETINFO, buf, size)) == -1 && errno == ENOMEM) { - free(buf); - size += 4 * 1024; - if ((buf = xmalloc(size)) == NULL) { - return NULL; - } - } - if (rc == -1) { - free(buf); - return NULL; - } - lp = (struct ld_info *)buf; - ret = lp->ldinfo_dataorg; - free(buf); - return ret; -} - static void aix_loaderror(const char *pathname) { @@ -1342,19 +1313,13 @@ dln_load(file) #if defined(_AIX) #define DLN_DEFINED { - static void *main_module = NULL; void (*init_fct)(); - if (main_module == NULL) { - if ((main_module = aix_findmain()) == NULL) { - aix_loaderror(file); - } - } init_fct = (void(*)())load((char*)file, 1, 0); if (init_fct == NULL) { aix_loaderror(file); } - if (loadbind(0, main_module, (void*)init_fct) == -1) { + if (loadbind(0, (void*)dln_load, (void*)init_fct) == -1) { aix_loaderror(file); } (*init_fct)(); -- 小松克行 / Katsuyuki Komatsu