Fork $BIT2DG=$J4D6-$G$N(B test_argv0_noarg

e$B%o%J%Y$H?=$7$^$9!#e(B

fork() e$B$N$J$$4D6-$G$Oe(B exec e$B7OE}$N%a%=%C%I$Oe(B redirect_fds
e$B$rL5;k$9$k$?$ae(B
test_process.rb e$B$Ne(B test_argv0_noarg
e$B$G%F%9%H$,?J$^$J$/$J$j$^$9!#e(B
e$B$3$N$h$&$J4D6-$G$O%F%9%H$r%9%-%C%W$7$?J}$,$h$$$N$G$O$J$$$+$H;W$$$^$9!#e(B

e$B$b$A$m$s!"%j%@%$%l%/%H$G$-$k$J$i$=$l$,0lHV$$$$$N$G$9$,!#e(B

Index: test/ruby/test_process.rb

— test/ruby/test_process.rb (revision 16344)
+++ test/ruby/test_process.rb (working copy)
@@ -800,6 +800,7 @@
end

def test_argv0_noarg

  • return unless respond?(:fork)
    with_tmpchdir {|d|
    open(“t”, “w”) {|f| f.print “exit true” }
    open(“f”, “w”) {|f| f.print “exit false” }

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:34647] fork e$BIT2DG=$J4D6-$G$Ne(B
test_argv0_noarg”
on Sun, 11 May 2008 15:13:11 +0900, wanabe [email protected]
writes:

|fork() e$B$N$J$$4D6-$G$Oe(B exec e$B7OE}$N%a%=%C%I$Oe(B redirect_fds e$B$rL5;k$9$k$?$ae(B
|test_process.rb e$B$Ne(B test_argv0_noarg e$B$G%F%9%H$,?J$^$J$/$J$j$^$9!#e(B
|e$B$3$N$h$&$J4D6-$G$O%F%9%H$r%9%-%C%W$7$?J}$,$h$$$N$G$O$J$$$+$H;W$$$^$9!#e(B
|
|# e$B$b$A$m$s!"%j%@%$%l%/%H$G$-$k$J$i$=$l$,0lHV$$$$$N$G$9$,!#e(B

e$B$^$“!”$=$&$J$s$G$9$,!#$=$N%A%'%C%/$Oe(Brespond?(:fork)e$B$G$O$h$/e(B
e$B$J$$$s$G$O$J$$$G$7$g$&$+!#e(Bforke$B$O$$$D$bDj5A$5$l$F$$$k$h$&$K;We(B
e$B$$$^$9!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:34667] Re: fork e$BIT2DG=$J4D6-$G$Ne(B
test_argv0_noarg”
on May.13,2008 09:58:07, [email protected] wrote:

|fork() e$B$N$J$$4D6-$G$Oe(B exec e$B7OE}$N%a%=%C%I$Oe(B redirect_fds e$B$rL5;k$9$k$?$ae(B
|test_process.rb e$B$Ne(B test_argv0_noarg e$B$G%F%9%H$,?J$^$J$/$J$j$^$9!#e(B
|e$B$3$N$h$&$J4D6-$G$O%F%9%H$r%9%-%C%W$7$?J}$,$h$$$N$G$O$J$$$+$H;W$$$^$9!#e(B
|
|# e$B$b$A$m$s!"%j%@%$%l%/%H$G$-$k$J$i$=$l$,0lHV$$$$$N$G$9$,!#e(B

e$B$^$“!”$=$&$J$s$G$9$,!#$=$N%A%'%C%/$Oe(Brespond?(:fork)e$B$G$O$h$/e(B
e$B$J$$$s$G$O$J$$$G$7$g$&$+!#e(Bforke$B$O$$$D$bDj5A$5$l$F$$$k$h$&$K;We(B
e$B$$$^$9!#e(B

e$B%F%9%H$b85!9$NLdBj$b4{$K2r7h:Q$_e(B(e$B$?$V$se(B)e$B$J$N$G$=$l$O$$$$$s$Ge(B
e$B$9$,!"e(Bforke$B$,e(Brespond_to?e$B$GH=CG$G$-$J$$$N$OITJX$J$N$G!"e(B1.9e$B$G$Oe(B
forke$B$,e(BNotImplementedErrore$B$K$J$k%W%i%C%H%U%)!<%$G$Oe(Bforke$B<+BN$re(B e$B>C$=$&$+$H;W$&$s$G$9$,!"$I$&$G$7$g$&$+e(B? (e$BB>$NN;w$N%a%=%C%I$bF1MMe(B)

e$B$=$l$G$O!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:34684] Re: fork e$BIT2DG=$J4D6-$G$Ne(B
test_argv0_noarg”
on Wed, 14 May 2008 12:37:01 +0900, “U.Nakamura”
[email protected] writes:

|e$B%F%9%H$b85!9$NLdBj$b4{$K2r7h:Q$_e(B(e$B$?$V$se(B)e$B$J$N$G$=$l$O$$$$$s$Ge(B
|e$B$9$,!"e(Bforke$B$,e(Brespond_to?e$B$GH=CG$G$-$J$$$N$OITJX$J$N$G!"e(B1.9e$B$G$Oe(B
|forke$B$,e(BNotImplementedErrore$B$K$J$k%W%i%C%H%U%)!<%$G$Oe(Bforke$B<+BN$re(B |e$B>C$=$&$+$H;W$&$s$G$9$,!"$I$&$G$7$g$&$+e(B? |(e$BB>$NN;w$N%a%=%C%I$bF1MMe(B)

NotImplementedErrore$B$O$J$/$7$F!“%a%=%C%I$r:o$m$&$H$$$&J}?K$G$9e(B
e$B$+!)e(B
e$B$^$”!“e(Brespond_to?e$B$GH=CG$G$-$k$N$OL@$i$+$J%a%j%C%H$J$N$G!“e(B
e$B$$2$KH?BP$O$7$^$;$s$,!#I8=$N%a%=%C%I$,%W%i%C%H%U%)!<%$4$He(B e$B$K$"$C$?$j$J$+$C$?$j$9$k$N$K$b<c43Dq93$,$"$k$N$G$9$,!#$^$"!"e(B e$B$b$H$b$HDs6!$7$F$$$J$$e(B(e$B$G$-$J$$e(B)e$B%W%i%C%H%U%)!<%$,$”$k5!G=$,e(B
e$BI8=`$K$”$k$H$$$&;~E@$G$7$g$&$,$J$$$s$G$7$g$&$,!#e(B

In article [email protected],
Yukihiro M. [email protected] writes:

NotImplementedErrore$B$O$J$/$7$F!“%a%=%C%I$r:o$m$&$H$$$&J}?K$G$9e(B
e$B$+!)e(B e$B$^$”!“e(Brespond_to?e$B$GH=CG$G$-$k$N$OL@$i$+$J%a%j%C%H$J$N$G!“e(B
e$B$$2$KH?BP$O$7$^$;$s$,!#I8=$N%a%=%C%I$,%W%i%C%H%U%)!<%$4$He(B e$B$K$"$C$?$j$J$+$C$?$j$9$k$N$K$b<c43Dq93$,$"$k$N$G$9$,!#$^$"!"e(B e$B$b$H$b$HDs6!$7$F$$$J$$e(B(e$B$G$-$J$$e(B)e$B%W%i%C%H%U%)!<%$,$”$k5!G=$,e(B
e$BI8=`$K$”$k$H$$$&;~E@$G$7$g$&$,$J$$$s$G$7$g$&$,!#e(B

e$B<B9T$9$k$He(B NotImplementedError e$B$K$J$j!"e(Brespond_to?
e$B$GD4$Y$ke(B
e$B$H56$K$J$kFC<l$J%a%=%C%I$rF3F~$9$k$N$O$I$&$G$9$+$M!#e(B

undef e$B$_$?$$$J$+$s$8$G!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:34694] Re: fork e$BIT2DG=$J4D6-$G$Ne(B
test_argv0_noarg”
on May.14,2008 18:33:22, [email protected] wrote:

|e$B%F%9%H$b85!9$NLdBj$b4{$K2r7h:Q$_e(B(e$B$?$V$se(B)e$B$J$N$G$=$l$O$$$$$s$Ge(B
|e$B$9$,!"e(Bforke$B$,e(Brespond_to?e$B$GH=CG$G$-$J$$$N$OITJX$J$N$G!"e(B1.9e$B$G$Oe(B
|forke$B$,e(BNotImplementedErrore$B$K$J$k%W%i%C%H%U%)!<%$G$Oe(Bforke$B<+BN$re(B |e$B>C$=$&$+$H;W$&$s$G$9$,!"$I$&$G$7$g$&$+e(B? |(e$BB>$NN;w$N%a%=%C%I$bF1MMe(B)

NotImplementedErrore$B$O$J$/$7$F!"%a%=%C%I$r:o$m$&$H$$$&J}?K$G$9e(B
e$B$+!)e(B

e$BJ}?K$H$7$F$O!“e(Brubye$B$N%3%s%Q%$%k;~$KH=CG$G$-$k$b$N$K$D$$$F$O%ae(B
e$B%=%C%I<+BN$r:o=|!”<B9T;~$K$7$+H=CG$G$-$J$$$b$N$O=>Mh$I$*$j$Ke(B
NotImplementedErrore$B$H$$$&0BD>$JJ}8~$r9M$($F$$$^$9!#e(B

 e$B$^$"!"e(Brespond_to?e$B$GH=CG$G$-$k$N$OL@$i$+$J%a%j%C%H$J$N$G!"e(B

e$B$$2$KH?BP$O$7$^$;$s$,!#I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B9T$7$Fe(B
e$B$$$$F$_$k$N$O?4M}EDq93$,Bg$-$$$H;W$$$^$9!#e(B
e$B$=$N7k2L$H$7$Fe(BRUBY_PLATFORMe$B$J$I$GH=CG$7$A$c$&$H$$$&7y$J%3!<%Ie(B
e$B$,$O$S$3$C$F$$$^$9$7!”$=$NJU$r$J$s$H$+$7$?$$$H$$$&;W$$$,$”$je(B
e$B$^$9!#e(B

respond_to?e$B$GH=CG$9$k$h$j$b!“e(Bforkable?e$B$_$?$$$J%a%=%C%I$,$”$C$?J}$,e(B
e$B8+1I$($,NI$/$F;d$O9%$-$G$9!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:34698] Re: fork e$BIT2DG=$J4D6-$G$Ne(B
test_argv0_noarg”
on May.14,2008 18:54:24, [email protected] wrote:

e$B8+1I$($,NI$/$F;d$O9%$-$G$9!#e(B
forke$B0J30$O$3$&$G$9$+e(B?

Dir.tellable?
Dir.seekable?
Dir.chrootable?
File.lchmodable?
File.lchownable?
File.linkable?
File.symlinkable?
File.readlinkable?
File.truncatable?
IO.fsyncable?
IO.close_on_execable?
IO.ioctlable?
IO.fcntlable?
syscallable?
IO.pipable?
forkable?
Process.getpgrpable?
Process.setpgrpable?
Process.getpgidable?
Process.setpgidable?
Process.setsidable?
Process.getprioritiable?
Process.setprioritiable?
Process.getrlimitable?
Process.setrlimitable?
Process.setuidable?
Process.setruidable?
Process.seteuidable?
Process.setreuidable?
Process.setresuidable?
Process::UID.change_privilegable?
Process::Sys.setgidable?
Process::Sys.setrgidable?
Process::Sys.setegidable?
Process::Sys.setregidable?
Process::Sys.setresgidable?
Process::Sys.issetugidable?
Process.setgidable?
Process.getgroupsable?
Process.setgroupsable?
Process.initgroupsable?
Process.daemonable?
Process::GID.change_privilegable?
Process.setegidable?
Process::UID.re_exchangable?
Process::GID.re_exchangable?
Process.timesable?

e$B$b$A$m$s$3$l$O>iCL$G$9$1$I!“$”$j$($M!<$H;W$$$^$9!#e(B

e$B$=$l$G$O!#e(B

In article [email protected],
Tanaka A. [email protected] writes:

e$B<B9T$9$k$He(B NotImplementedError e$B$K$J$j!"e(Brespond_to? e$B$GD4$Y$ke(B
e$B$H56$K$J$kFC<l$J%a%=%C%I$rF3F~$9$k$N$O$I$&$G$9$+$M!#e(B

undef e$B$_$?$$$J$+$s$8$G!#e(B

e$B<BAu$9$k$H$3$s$J46$8$G$7$g$&$+!#e(B

e$B8D!9$N%a%=%C%I$K$D$$$F$O$H$j$“$($:e(B fork e$B$He(B File.lchmod
e$B$@$1e(B
e$BBP=h$7$F$”$j$^$9!#e(B

GNU/Linux e$B$K$Oe(B lchmod e$B$,$J$$$N$G!"e(BFile.respond_to?(:lchmod)
e$B$Oe(B false e$B$K$J$j!"e(BFile.lchmod e$B$r8F$S=P$9$He(B
NotImplementedError e$B$K$J$j$^$9!#e(B

% ./ruby -ve ’
p File.respond_to?(:lchmod)
File.lchmod(“foo”, 0777)’
ruby 1.9.0 (2008-05-14 revision 16419) [i686-linux]
false
-e:3:in lchmod': lchmod() function is unimplemented on this machine (NotImplementedError) from -e:3:in

Index: include/ruby/intern.h

— include/ruby/intern.h (revision 16419)
+++ include/ruby/intern.h (working copy)
@@ -252,6 +252,7 @@ int rb_method_boundp(VALUE, ID, int);
VALUE rb_eval_cmd(VALUE, VALUE, int);
int rb_obj_respond_to(VALUE, ID, int);
int rb_respond_to(VALUE, ID);
+void rb_define_notimplement_method_id(VALUE mod, ID id, int noex);
void rb_interrupt(void);
VALUE rb_apply(VALUE, ID, VALUE);
void rb_backtrace(void);
Index: include/ruby/node.h

— include/ruby/node.h (revision 16419)
+++ include/ruby/node.h (working copy)
@@ -498,6 +498,8 @@ NODE rb_node_newnode(enum node_type,VAL
NODE
rb_method_node(VALUE klass, ID id);
int rb_node_arity(NODE* node);

+int rb_notimplement_body_p(NODE*);
+
struct global_entry *rb_global_entry(ID);
VALUE rb_gvar_get(struct global_entry *);
VALUE rb_gvar_set(struct global_entry *, VALUE);
Index: proc.c

— proc.c (revision 16419)
+++ proc.c (working copy)
@@ -935,6 +935,15 @@ method_owner(VALUE obj)
return data->oclass;
}

+static VALUE
+method_notimplemented_p(VALUE obj)
+{

  • struct METHOD *data;
  • Data_Get_Struct(obj, struct METHOD, data);
  • return rb_notimplement_body_p(data->body) ? Qtrue : Qfalse;
    +}

/*

  • call-seq:
  • obj.method(sym)    => method
    

@@ -1763,6 +1772,7 @@ Init_Proc(void)
rb_define_method(rb_cMethod, “name”, method_name, 0);
rb_define_method(rb_cMethod, “owner”, method_owner, 0);
rb_define_method(rb_cMethod, “unbind”, method_unbind, 0);

  • rb_define_method(rb_cMethod, “notimplemented?”,
    method_notimplemented_p, 0);
    rb_define_method(rb_mKernel, “method”, rb_obj_method, 1);
    rb_define_method(rb_mKernel, “public_method”, rb_obj_public_method,
    1);

@@ -1780,6 +1790,7 @@ Init_Proc(void)
rb_define_method(rb_cUnboundMethod, “name”, method_name, 0);
rb_define_method(rb_cUnboundMethod, “owner”, method_owner, 0);
rb_define_method(rb_cUnboundMethod, “bind”, umethod_bind, 1);

  • rb_define_method(rb_cUnboundMethod, “notimplemented?”,
    method_notimplemented_p, 0);

    /* Module#*_method */
    rb_define_method(rb_cModule, “instance_method”,
    rb_mod_instance_method, 1);
    Index: class.c
    ===================================================================
    — class.c (revision 16419)
    +++ class.c (working copy)
    @@ -759,25 +759,40 @@ rb_obj_singleton_methods(int argc, VALUE
    void
    rb_define_method_id(VALUE klass, ID name, VALUE (*func)(ANYARGS), int
    argc)
    {

  • rb_add_method(klass, name, NEW_CFUNC(func,argc), NOEX_PUBLIC);
  • if (func)
  •    rb_add_method(klass, name, NEW_CFUNC(func,argc), NOEX_PUBLIC);
    
  • else
  •    rb_define_notimplement_method_id(klass, name, NOEX_PUBLIC);
    

}

void
rb_define_method(VALUE klass, const char *name, VALUE (*func)(ANYARGS),
int argc)
{

  • rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc),
    NOEX_PUBLIC);
  • ID id = rb_intern(name);
  • if (func)
  •    rb_add_method(klass, id, NEW_CFUNC(func, argc), NOEX_PUBLIC);
    
  • else
  •    rb_define_notimplement_method_id(klass, id, NOEX_PUBLIC);
    

}

void
rb_define_protected_method(VALUE klass, const char *name, VALUE
(*func)(ANYARGS), int argc)
{

  • rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc),
    NOEX_PROTECTED);
  • ID id = rb_intern(name);
  • if (func)
  •    rb_add_method(klass, id, NEW_CFUNC(func, argc), 
    

NOEX_PROTECTED);

  • else
  •    rb_define_notimplement_method_id(klass, id, NOEX_PROTECTED);
    

}

void
rb_define_private_method(VALUE klass, const char *name, VALUE
(*func)(ANYARGS), int argc)
{

  • rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc),
    NOEX_PRIVATE);
  • ID id = rb_intern(name);
  • if (func)
  •    rb_add_method(klass, id, NEW_CFUNC(func, argc), NOEX_PRIVATE);
    
  • else
  •    rb_define_notimplement_method_id(klass, id, NOEX_PRIVATE);
    

}

void
Index: process.c

— process.c (revision 16419)
+++ process.c (working copy)
@@ -2394,10 +2394,10 @@ rb_fork(int *status, int (chfunc)(void

  • fork doesn’t copy other threads.
    */

+#if defined(HAVE_FORK) && !defined(NetBSD)
static VALUE
rb_f_fork(VALUE obj)
{
-#if defined(HAVE_FORK) && !defined(NetBSD)
rb_pid_t pid;

 rb_secure(2);

@@ -2423,11 +2423,10 @@ rb_f_fork(VALUE obj)
default:
return PIDT2NUM(pid);
}
+}
#else

  • rb_notimplement();
    +#define rb_f_fork 0
    #endif
    -}

/*

  • call-seq:
    Index: eval_method.c
    ===================================================================
    — eval_method.c (revision 16419)
    +++ eval_method.c (working copy)
    @@ -18,6 +18,8 @@ struct cache_entry { /* method hash tab
    static struct cache_entry cache[CACHE_SIZE];
    static int ruby_running = 0;

+static NODE *notimplement_body = 0;
+
void
rb_clear_cache(void)
{
@@ -403,6 +405,12 @@ rb_export_method(VALUE klass, ID name, I
}

int
+rb_notimplement_body_p(NODE *method)
+{

  • return method == notimplement_body ? Qtrue : Qfalse;
    +}

+int
rb_method_boundp(VALUE klass, ID id, int ex)
{
NODE *method;
@@ -411,6 +419,8 @@ rb_method_boundp(VALUE klass, ID id, int
if (ex && (method->nd_noex & NOEX_PRIVATE)) {
return Qfalse;
}

  •    if (rb_notimplement_body_p(method->nd_body))
    
  •  return Qfalse;
    
    return Qtrue;
    }
    return Qfalse;
    @@ -645,10 +655,49 @@ rb_mod_alias_method(VALUE mod, VALUE new
    return mod;
    }

+static VALUE
+notimplement_cfunc(VALUE obj)
+{

  • rb_notimplement();
    +}

+void
+rb_define_notimplement_method_id(VALUE mod, ID id, int noex)
+{

  • rb_add_method(mod, id, notimplement_body, noex);
    +}

+static VALUE
+rb_mod_notimplemented_method(int argc, VALUE *argv, VALUE mod)
+{

  • int i;
  • if (ruby_cbase() == rb_cObject && mod == rb_cObject) {
  •    rb_secure(4);
    
  • }
  • for (i = 0; i < argc; i++) {
  •    ID id = rb_to_id(argv[i]);
    
  •    if (rb_safe_level() >= 4 && !OBJ_TAINTED(mod)) {
    
  •        rb_raise(rb_eSecurityError, "Insecure: can't undef `%s'",
    
  •                 rb_id2name(id));
    
  •    }
    
  •    rb_frozen_class_p(mod);
    
  •    if (id == object_id || id == __send__ || id == init) {
    
  •        rb_warn("notimplementing `%s' may cause serious problem", 
    

rb_id2name(id));

  •    }
    
  • rb_define_notimplement_method_id(mod, id, NOEX_PUBLIC);
  • }
  • return mod;
    +}

static void
Init_eval_method(void)
{
rb_define_private_method(rb_cModule, “remove_method”,
rb_mod_remove_method, -1);
rb_define_private_method(rb_cModule, “undef_method”,
rb_mod_undef_method, -1);
rb_define_private_method(rb_cModule, “alias_method”,
rb_mod_alias_method, 2);

  • rb_global_variable(&notimplement_body);
  • notimplement_body = NEW_CFUNC(notimplement_cfunc, -1);
  • rb_define_private_method(rb_cModule, “notimplemented_method”,
    rb_mod_notimplemented_method, -1);
    }
    Index: file.c
    ===================================================================
    — file.c (revision 16419)
    +++ file.c (working copy)
    @@ -1901,12 +1901,7 @@ rb_file_s_lchmod(int argc, VALUE *argv)
    return LONG2FIX(n);
    }
    #else
    -static VALUE
    -rb_file_s_lchmod(int argc, VALUE *argv)
    -{
  • rb_notimplement();
  • return Qnil; /* not reached */
    -}
    +#define rb_file_s_lchmod 0
    #endif

struct chown_args {
Index: test/ruby/test_notimp.rb

— test/ruby/test_notimp.rb (revision 0)
+++ test/ruby/test_notimp.rb (revision 0)
@@ -0,0 +1,33 @@
+require ‘test/unit’
+
+class TestNotImplement < Test::Unit::TestCase

  • class C
  • notimplemented_method :n
  • def x() end
  • end
  • def test_respond_to
  • assert_equal(false, C.new.respond_to?(:n))
  • assert_equal(true, C.new.respond_to?(:x))
  • end
  • def test_call
  • assert_raise(NotImplementedError) { C.new.n }
  • assert_nothing_raised { C.new.x }
  • end
  • def test_method
  • m = C.new.method(:n)
  • assert(m.notimplemented?)
  • m = C.new.method(:x)
  • assert(!m.notimplemented?)
  • end
  • def test_umethod
  • m = C.instance_method(:n)
  • assert(m.notimplemented?)
  • m = C.instance_method(:x)
  • assert(!m.notimplemented?)
  • end

+end

e$B?\F#$G$9!#e(B

In [email protected]
“[ruby-dev:34700] Re: fork e$BIT2DG=$J4D6-$G$Ne(B test_argv0_noarg” on
Wed, 14 May 2008 19:16:27 +0900,
“U.Nakamura” [email protected] wrote:

respond_to?e$B$GH=CG$9$k$h$j$b!“e(Bforkable?e$B$_$?$$$J%a%=%C%I$,$”$C$?J}$,e(B
e$B8+1I$($,NI$/$F;d$O9%$-$G$9!#e(B

forke$B0J30$O$3$&$G$9$+e(B?

e$B$b$A$m$s$3$l$O>iCL$G$9$1$I!“$”$j$($M!<$H;W$$$^$9!#e(B

e$B$I$&$7$F$“$j$($M!<$H;W$&$N$+$o$+$i$J$$$N$G$9$,!”;d$O$J$s$G>ie(B
e$BCL$J$s$@$m$&$H;W$$$^$7$?$7!“$”$j$($M!<$H$b;W$$$^$;$s$G$7$?!#e(B

e$B?t$,B?$9$.$k$H$$$&$3$H$G$9$+!)$J$s$G$be(Bablee$B$D$1$l$P$$$$$C$F$be(B
e$B$s$8$c$J$$$h$M!"$H$$$&$3$H$G$9$+!)e(B

e$BA0$N%a!<%k$K$O=q$$$F$$$J$+$C$?$N$G=q$$$F$*$/$H!“;d$O$J$+$`$ie(B
e$B$5$s$N0F$K$O;?@.$7$F$$$^$9!#$=$N>e$G$5$i$Ke(Bforke$B$G$-$k$+$I$&$+e(B
e$B$rH=CG$G$-$k%a%=%C%I$,$”$l$P4r$7$$$H;W$C$F$$$^$9!#e(B

respond_to?e$B$@$H4V0c$C$F0z?t$Ke(B:folke$B$H$+=q$$$F$b$J$+$J$+5$$E$+e(B
e$B$J$$$N$G$9$,!“e(Bfolkable?e$B$_$?$$$K=q$$$F$7$^$&$HNc30$,$”$,$k$Ne(B
e$B$G5$$E$-$d$9$$!“$H$$$&$N$b@lMQ%a%=%C%I$,$”$k$H4r$7$$M}M3$Ne(B1
e$B$D$G$9!#!JFC$K;d$Oe(Btypoe$B$,B?$$$N$G!Ke(B

e$B$H$O$$$(!";d$N9%$$O<u$1F~$l$i$lFq$$$b$N$,B?$$$h$&$J$N$G!"$“e(B
e$B$^$j5$$K$7$J$/$F7k9=$G$9!#e(Brespond_to?e$B$G$b$=$&$$$&H=CG$G$-$kJ}e(B
e$BK!$,$”$l$P<+J,$G@lMQ%a%=%C%I$r:n$C$F;H$($P$9$
$^$9$N$G!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:34718] Re: fork e$BIT2DG=$J4D6-$G$Ne(B
test_argv0_noarg”
on May.15,2008 20:50:40, [email protected] wrote:

e$B$b$A$m$s$3$l$O>iCL$G$9$1$I!“$”$j$($M!<$H;W$$$^$9!#e(B

e$B$I$&$7$F$“$j$($M!<$H;W$&$N$+$o$+$i$J$$$N$G$9$,!”;d$O$J$s$G>ie(B
e$BCL$J$s$@$m$&$H;W$$$^$7$?$7!“$”$j$($M!<$H$b;W$$$^$;$s$G$7$?!#e(B

e$B?t$,B?$9$.$k$H$$$&$3$H$G$9$+!)$J$s$G$be(Bablee$B$D$1$l$P$$$$$C$F$be(B
e$B$s$8$c$J$$$h$M!"$H$$$&$3$H$G$9$+!)e(B

e$BN>J}$G$9$M!#e(B

e$B$5$i$K8@$&$H!“@h$K$”$2$?$b$N0J30$N%a%=%C%I$NB8:_$b3NG’$7$?$/e(B
e$B$J$C$?$i!“$=$l$be(B -able? e$B$G3NG’$9$k$s$G$7$g$&$+e(B?
systemable? e$B$H$+!“e(BArray.countable? e$B$H$+!#e(B
e$B$=$&$8$c$J$/$F!”$I$N%a%=%C%I$K$OBP1~$9$ke(B -able? e$B$,$”$C$F!“$Ie(B
e$B$N%a%=%C%I$K$Oe(B -able? e$B$,$J$$!”$H$$$&$3$H$rA4It3NG’$7$F%3!<%Ie(B
e$B$r=q$/$s$G$7$g$&$+e(B?

e$B$“$k%a%=%C%I$NB8:_$r3NG’$9$k$?$a$K!”?7$?$K$=$N3NG’MQ$N%a%=%Ce(B
e$B%I$rDI2C$9$k!“$H$$$&H/A[$O!”>r7o<0$NCM$re(Btruee$B$HHf3S$9$k$H$+$$e(B
e$B$&H/A[$HF1$8Fw$$$,$7$F!"@5D><u$1F~$l$i$l$^$;$s!#e(B

respond_to?e$B$@$H4V0c$C$F0z?t$Ke(B:folke$B$H$+=q$$$F$b$J$+$J$+5$$E$+e(B
e$B$J$$$N$G$9$,!“e(Bfolkable?e$B$_$?$$$K=q$$$F$7$^$&$HNc30$,$”$,$k$Ne(B
e$B$G5$$E$-$d$9$$!“$H$$$&$N$b@lMQ%a%=%C%I$,$”$k$H4r$7$$M}M3$Ne(B1
e$B$D$G$9!#!JFC$K;d$Oe(Btypoe$B$,B?$$$N$G!Ke(B

e$BNc$($Pe(B system e$B$O$“$k$1$Ie(B systemable?
e$B$O$J$$!”$H$$$&$3$H$r3NG’e(B
e$B$9$kI,MW$,$“$k$J$i!”$=$N3NG’$N2aDx$Ge(Btypoe$B$,F~$k2DG=@-$O8:$k$se(B
e$B$8$c$J$$$+$H$$$&5$$,$7$^$9!#e(B

e$B$H$O$$$(!";d$N9%$$O<u$1F~$l$i$lFq$$$b$N$,B?$$$h$&$J$N$G!"$“e(B
e$B$^$j5$$K$7$J$/$F7k9=$G$9!#e(Brespond_to?e$B$G$b$=$&$$$&H=CG$G$-$kJ}e(B
e$BK!$,$”$l$P<+J,$G@lMQ%a%=%C%I$r:n$C$F;H$($P$9$
$^$9$N$G!#e(B

e$B$^$“!”;d$N8@$C$F$k$N$b;d$N9%$_$NLdBj$J$N$G!“B>$N?M$K$O$^$?B>e(B
e$B$N0U8+$,$”$k$s$8$c$J$$$G$7$g$&$+!#e(B

forkable?e$B$"$?$j$Oe(BActiveSupporte$B$H$+$G:NMQ$5$l$?$j$7$Fe(B :slight_smile:

e$B$=$l$G$O!#e(B

In article [email protected],
“U.Nakamura” [email protected] writes:

e$BNc$($Pe(B system e$B$O$“$k$1$Ie(B systemable? e$B$O$J$$!”$H$$$&$3$H$r3NG’e(B
e$B$9$kI,MW$,$“$k$J$i!”$=$N3NG’$N2aDx$Ge(Btypoe$B$,F~$k2DG=@-$O8:$k$se(B
e$B$8$c$J$$$+$H$$$&5$$,$7$^$9!#e(B

e$B$$$A$P$se(B typo e$B$K5$$,$D$-$d$9$$=q$-J}$O$$$-$J$jL\E*$N%a%=%C%Ie(B
e$B$r8F$s$G!"e(BNotImplementedError e$B$re(B rescue
e$B$9$k$3$H$G$O$J$$$G$7$ge(B
e$B$&$+!#e(B

begin
Process.setrlimit(…)
rescue NotImplementedError

end

e$B$J$I$H$9$l$P!"e(Bsetrlimit e$B$Ke(B typo
e$B$,F~$l$P!“e(BNoMethodError e$B$K$Je(B
e$B$k$N$G!“e(B(e$B$*$=$i$/e(B)
e$B%”%W%j%1!<%7%g%s$OCfCG$5$l!”$9$0$K5$$,$De(B
e$B$/$3$H$,$G$-$^$9!#e(B

e$B$b$A$m$s!“I{:nMQ$NOC$,$”$j$^$9$+$i!">o$K$3$N%9%?%$%k$G=q$1$ke(B
e$B$o$1$G$O$J$$$G$7$g$&$,!“e(Bsetrlimit e$B$G@)8B$G$-$l$P@)8B$9$k$,e(B
setrlimit e$B$,$J$1$l$P5$$K$7$J$$$GB3$1$k!”$H$$$C$?>u67$G$O$$$-e(B
e$B$J$j8F$S=P$9$3$H$,2DG=$G$9!#e(B

e$B$7$+$7!"e(Bsetrlimit e$B$,$J$$4D6-$G%a%=%C%I$rDj5A$5$l$J$/$J$k$H!“e(B
e$B$3$N%9%?%$%k$,;H$($J$/$J$j$^$9!#$”$($FF1$8%9%?%$%k$G=q$/$H$9e(B
e$B$l$Pe(B

begin
Process.setrlimit(…)
rescue NoMethodError

end

e$B$H$$$&$h$&$Ke(B NoMethodError e$B$re(B rescue
e$B$9$k$3$H$K$J$j$^$9$,!“e(B
e$B$3$&$9$k$He(B setrlimit e$B$KF~$j9~$`e(B typo
e$B$rKI$2$J$/$J$j$^$9!#e(B
setrlimit e$B$re(B typo e$B$9$k$H!”%a%=%C%I$,$J$$$N$Ge(B NoMethodError
e$B$K$J$j!"e(Bsetrlimit e$B$,$J$$$H$-$N=hM}$K?J$s$G$7$^$$$^$9!#e(B

e$B=>$C$F!"4D6-0MB8$J%a%=%C%I$rDj5A$7$J$$$h$&$K$9$k$3$H$K$OH?BPe(B
e$B$7$^$9!#e(B

e$B$7$+$7!"$3$N%9%?%$%k$,;H$($J$$>u67$G$b0lHLE*$KH=CG$G$-$k$N$,e(B
e$BK>$^$7$$$N$O3N$+$G!"8F$S=P$9$He(B NotImplementedError
e$B$K$J$k$,!"e(B
respond_to? e$B$K$O56$rJV$9%a%=%C%I$rF3F~$9$k$H$$$&$N$rDs0F$9$ke(B
e$B$N$O$=$&$$$&$o$1$G$9!#e(B

e$B?\F#$G$9!#e(B

In [email protected]
“[ruby-dev:34719] Re: fork e$BIT2DG=$J4D6-$G$Ne(B test_argv0_noarg” on
Thu, 15 May 2008 21:17:28 +0900,
“U.Nakamura” [email protected] wrote:

e$B$5$i$K8@$&$H!“@h$K$”$2$?$b$N0J30$N%a%=%C%I$NB8:_$b3NG’$7$?$/e(B
e$B$J$C$?$i!"$=$l$be(B -able? e$B$G3NG’$9$k$s$G$7$g$&$+e(B?
systemable? e$B$H$+!"e(BArray.countable? e$B$H$+!#e(B

e$B%W%i%C%H%U%)!<%`0MB8$N%a%=%C%I$NOC$@$H;W$C$F$$$^$7$?!#e(B
e$B%P!<%8%g%s4V$G$N8_49@-$N%A%'%C%/$H$+$O9M$($F$$$^$;$s$G$7$?!#e(B

e$B$=$&$8$c$J$/$F!“$I$N%a%=%C%I$K$OBP1~$9$ke(B -able? e$B$,$”$C$F!“$Ie(B
e$B$N%a%=%C%I$K$Oe(B -able? e$B$,$J$$!”$H$$$&$3$H$rA4It3NG’$7$F%3!<%Ie(B
e$B$r=q$/$s$G$7$g$&$+e(B?

e$B$J$s$G$b$+$s$G$b3NG’$9$k$H$O;W$($J$$$s$G$9$,!#!#!#e(B
forke$B$H$+$O$+$J$jFC<l$J%a%=%C%I$@$H;W$C$F$$$^$7$?!#e(B

e$B$“$k%a%=%C%I$NB8:_$r3NG’$9$k$?$a$K!”?7$?$K$=$N3NG’MQ$N%a%=%Ce(B
e$B%I$rDI2C$9$k!“$H$$$&H/A[$O!”>r7o<0$NCM$re(Btruee$B$HHf3S$9$k$H$+$$e(B
e$B$&H/A[$HF1$8Fw$$$,$7$F!"@5D><u$1F~$l$i$l$^$;$s!#e(B

e$B$=$NF1$8Fw$$$,$9$k463P$O$A$g$C$H$o$+$j$^$;$s$G$7$?!#e(B

e$BNc$($P!"e(B

if respond_to?(:fork) == true

e$B$He(B

if forkable?

e$B$,F1$8$h$&$K5$;}$A0-$$$H$$$&$3$H$G$9$h$M!)e(B

e$B;d$O$=$&$O46$8$J$$$H$$$&$@$1$J$N$G!"$&!<$s!#!#!#e(B

respond_to?e$B$@$H4V0c$C$F0z?t$Ke(B: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