From 4699b4afbb8e0fd96957de6dd6f23ecbe2a1bdd0 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 29 Sep 2003 02:44:49 +0000 Subject: * eval.c (rb_thread_atfork): wrong format specifier. [ruby-dev:21428] * process.c (pst_inspect): better description. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 14 ++++++++++++++ eval.c | 2 +- ext/digest/digest.c | 2 +- ext/stringio/stringio.c | 2 +- intern.h | 1 + lib/mkmf.rb | 2 +- process.c | 44 +++++++++++++++++++++++++++++++++++++++++++- signal.c | 7 +++++++ 8 files changed, 69 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6dd6c77138..1f26d0666f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Sep 29 11:16:55 2003 Yukihiro Matsumoto + + * eval.c (rb_thread_atfork): wrong format specifier. + [ruby-dev:21428] + + * process.c (pst_inspect): better description. + Mon Sep 29 02:31:44 2003 GOTOU Yuuzou * lib/webrick/utils.rb (Utils::su): use setgid and setuid to @@ -11,6 +18,13 @@ Mon Sep 27 18:25:13 2003 NAKAMURA, Hiroshi * test/xsd/test_xsd.rb: add tests for above fix. +Sun Sep 28 11:14:19 2003 Koji Arai + + * ext/digest/digest.c (Init_digest): `copy_object' was deprecated. + `initialize_copy' should be defined. + + * ext/stringio/stringio.c (Init_stringio): ditto. + Mon Sep 27 15:58:50 2003 NAKAMURA, Hiroshi * lib/soap/rpc/cgistub.rb: make logging severity threshold higher. diff --git a/eval.c b/eval.c index 897ae7e602..3ee0b4d5da 100644 --- a/eval.c +++ b/eval.c @@ -9902,7 +9902,7 @@ rb_thread_atfork() if (rb_thread_alone()) return; FOREACH_THREAD(th) { if (th != curr_thread) { - rb_warn("fork terminates thread at %s:%s", th->node->nd_file, nd_line(th->node)); + rb_warn("fork terminates thread at %s:%d", th->node->nd_file, nd_line(th->node)); rb_thread_die(th); } } diff --git a/ext/digest/digest.c b/ext/digest/digest.c index a170678cf0..9bc9905d1f 100644 --- a/ext/digest/digest.c +++ b/ext/digest/digest.c @@ -303,7 +303,7 @@ Init_digest() rb_define_singleton_method(cDigest_Base, "hexdigest", rb_digest_base_s_hexdigest, 1); rb_define_method(cDigest_Base, "initialize", rb_digest_base_init, -1); - rb_define_method(cDigest_Base, "copy_object", rb_digest_base_copy, 1); + rb_define_method(cDigest_Base, "initialize_copy", rb_digest_base_copy, 1); rb_define_method(cDigest_Base, "update", rb_digest_base_update, 1); rb_define_method(cDigest_Base, "<<", rb_digest_base_update, 1); rb_define_method(cDigest_Base, "digest", rb_digest_base_digest, 0); diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 7dfd8e6bd5..5f824e3f58 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -903,7 +903,7 @@ Init_stringio() rb_define_alloc_func(StringIO, strio_s_allocate); rb_define_singleton_method(StringIO, "open", strio_s_open, -1); rb_define_method(StringIO, "initialize", strio_initialize, -1); - rb_define_method(StringIO, "copy_object", strio_copy, 1); + rb_define_method(StringIO, "initialize_copy", strio_copy, 1); rb_define_method(StringIO, "reopen", strio_reopen, -1); rb_define_method(StringIO, "string", strio_get_string, 0); diff --git a/intern.h b/intern.h index 3417acb08b..93e6bb8d11 100644 --- a/intern.h +++ b/intern.h @@ -374,6 +374,7 @@ void posix_signal _((int, RETSIGTYPE (*)(int))); #endif void rb_trap_exit _((void)); void rb_trap_exec _((void)); +char *ruby_signal_name _((int)); /* sprintf.c */ VALUE rb_f_sprintf _((int, VALUE*)); /* string.c */ diff --git a/lib/mkmf.rb b/lib/mkmf.rb index cadf81ee27..0ff6351d02 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -228,7 +228,7 @@ end def cpp_command(outfile, opt="") "$(CPP) #$INCFLAGS -I#{$hdrdir} " \ - "#$CPPFLAGS #$CFLAGS #{outfile} #{opt} #{CONFTEST_C}" + "#$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}" end def libpathflag(libpath=$LIBPATH) diff --git a/process.c b/process.c index 2cfed92a41..d1c9724094 100644 --- a/process.c +++ b/process.c @@ -144,6 +144,48 @@ pst_pid(st) return rb_iv_get(st, "pid"); } +static VALUE +pst_inspect(st) + VALUE st; +{ + VALUE pid; + int status; + VALUE str; + char buf[256]; + + pid = pst_pid(st); + status = NUM2INT(st); + + snprintf(buf, sizeof(buf), "#<%s: pid=%ld", rb_class2name(CLASS_OF(st)), NUM2LONG(pid)); + str = rb_str_new2(buf); + if (WIFSTOPPED(status)) { + snprintf(buf, sizeof(buf), ",stopped(%d)", WSTOPSIG(status)); + rb_str_cat2(str, buf); + } + if (WIFSIGNALED(status)) { + int termsig = WTERMSIG(status); + char *signame = ruby_signal_name(termsig); + if (signame) { + snprintf(buf, sizeof(buf), ",signaled(SIG%s=%d)", signame, termsig); + } + else { + snprintf(buf, sizeof(buf), ",signaled(%d)", termsig); + } + rb_str_cat2(str, buf); + } + if (WIFEXITED(status)) { + snprintf(buf, sizeof(buf), ",exited(%d)", WEXITSTATUS(status)); + rb_str_cat2(str, buf); + } +#ifdef WCOREDUMP + if (WCOREDUMP(status)) { + rb_str_cat2(str, ",coredumped"); + } +#endif + rb_str_cat2(str, ">"); + return str; +} + static VALUE pst_equal(st1, st2) VALUE st1, st2; @@ -2347,7 +2389,7 @@ Init_process() rb_define_method(rb_cProcStatus, "to_i", pst_to_i, 0); rb_define_method(rb_cProcStatus, "to_int", pst_to_i, 0); rb_define_method(rb_cProcStatus, "to_s", pst_to_s, 0); - rb_define_method(rb_cProcStatus, "inspect", pst_to_s, 0); + rb_define_method(rb_cProcStatus, "inspect", pst_inspect, 0); rb_define_method(rb_cProcStatus, "pid", pst_pid, 0); diff --git a/signal.c b/signal.c index d4bdb2320f..bcf7b1d96b 100644 --- a/signal.c +++ b/signal.c @@ -191,6 +191,13 @@ signo2signm(no) return 0; } +char * +ruby_signal_name(no) + int no; +{ + return signo2signm(no); +} + VALUE rb_f_kill(argc, argv) int argc; -- cgit v1.2.3