ruby-changes:14833
From: nobu <ko1@a...>
Date: Wed, 17 Feb 2010 17:16:36 +0900 (JST)
Subject: [ruby-changes:14833] Ruby:r26698 (mvm): * merged from trunk r26678:26697.
nobu 2010-02-17 17:16:13 +0900 (Wed, 17 Feb 2010) New Revision: 26698 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26698 Log: * merged from trunk r26678:26697. Removed directories: branches/mvm/ext/dl/callback/ Modified files: branches/mvm/.merged-trunk-revision branches/mvm/ChangeLog branches/mvm/KNOWNBUGS.rb branches/mvm/common.mk branches/mvm/configure.in branches/mvm/ext/dl/cfunc.c branches/mvm/ext/dl/closure.c branches/mvm/ext/dl/cptr.c branches/mvm/ext/dl/depend branches/mvm/ext/dl/dl_conversions.c branches/mvm/ext/dl/method.c branches/mvm/file.c branches/mvm/gc.c branches/mvm/hash.c branches/mvm/test/dl/test_base.rb branches/mvm/test/dl/test_handle.rb branches/mvm/test/dl/test_import.rb branches/mvm/test/dl/test_method.rb branches/mvm/vm.c branches/mvm/vm_eval.c branches/mvm/vm_insnhelper.c Index: mvm/configure.in =================================================================== --- mvm/configure.in (revision 26697) +++ mvm/configure.in (revision 26698) @@ -1114,7 +1114,7 @@ setitimer setruid seteuid setreuid setresuid setproctitle socketpair\ setrgid setegid setregid setresgid issetugid pause lchown lchmod\ getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\ - getpriority getrlimit setrlimit sysconf group_member\ + getpriority getrlimit setrlimit sysconf \ dlopen sigprocmask sigaction sigsetjmp _setjmp _longjmp snprintf\ setsid telldir seekdir fchmod cosh sinh tanh log2 round signbit\ setuid setgid daemon select_large_fdset setenv unsetenv\ Index: mvm/ChangeLog =================================================================== --- mvm/ChangeLog (revision 26697) +++ mvm/ChangeLog (revision 26698) @@ -1,3 +1,56 @@ +Wed Feb 17 17:05:39 2010 Nobuyoshi Nakada <nobu@r...> + + * vm_insnhelper.c (vm_call_cfunc): removed unused variable. + + * vm.c (vm_frametype_name): define only when VMDEBUG. + +Wed Feb 17 15:34:45 2010 Nobuyoshi Nakada <nobu@r...> + + * ext/dl/dl_conversions.c (rb_dl_type_to_ffi_type): support signed + long long. + + * ext/dl/cfunc.c (rb_dlcfunc_inspect): get rid of overflow. + + * ext/dl/closure.c (dlc_callback, rb_dlclosure_init): ditto. + + * ext/dl/cptr.c (rb_dlptr_s_malloc): ditto. + + * ext/dl/method.c (rb_dlfunction_initialize): ditto. + +Wed Feb 17 01:16:12 2010 Yusuke Endoh <mame@t...> + + * hash.c (hash_update): always raise an exception when adding a new + key during iteration. Traditionally, an exception was raised only + when rehash occurs, but it may lead to difficult bug to reproduce. + [ruby-core:23614] + +Tue Feb 16 22:09:27 2010 Yusuke Endoh <mame@t...> + + * gc.c (chain_finalized_object): fix precedence. + +Tue Feb 16 21:32:01 2010 Yusuke Endoh <mame@t...> + + * gc.c (rb_objspace_call_finalizer): always run finalizer at exit, + before object is free'd. [ruby-dev:40382] + +Tue Feb 16 20:56:39 2010 Tanaka Akira <akr@f...> + + * file.c (rb_group_member): renamed from group_member. + don't use group_member() in glibc because it's not valgrind clean. + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=570047 + +Tue Feb 16 19:19:21 2010 Nobuyoshi Nakada <nobu@r...> + + * ext/dl/cfunc.c (rb_dlcfunc_call): convert signed value to + unsigned. + +Tue Feb 16 19:02:59 2010 Nobuyoshi Nakada <nobu@r...> + + * test/dl/test_{base,handle}.rb: use more verbose assertions. + + * test/dl/test_import.rb (DL::LIBC::BoundQsortCallback): renamed + to get rid of overwriting warning. + Tue Feb 16 11:03:19 2010 Aaron Patterson <aaron@t...> * ext/dl/method.c: Adding DL::Method as a superclass for DL::Function Index: mvm/vm_eval.c =================================================================== --- mvm/vm_eval.c (revision 26697) +++ mvm/vm_eval.c (revision 26698) @@ -816,8 +816,10 @@ return Qnil; /* dummy */ } +#if VMDEBUG static const char * vm_frametype_name(const rb_control_frame_t *cfp); +#endif VALUE rb_iterate(VALUE (* it_proc) (VALUE), VALUE data1, @@ -860,7 +862,9 @@ /* check skipped frame */ while (th->cfp != cfp) { - /* printf("skipped frame: %s\n", vm_frametype_name(th->cfp)); */ +#if VMDEBUG + printf("skipped frame: %s\n", vm_frametype_name(th->cfp)); +#endif if (UNLIKELY(VM_FRAME_TYPE(th->cfp) == VM_FRAME_MAGIC_CFUNC)) { const rb_method_entry_t *me = th->cfp->me; EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, th->cfp->self, me->called_id, me->klass); Index: mvm/common.mk =================================================================== --- mvm/common.mk (revision 26697) +++ mvm/common.mk (revision 26698) @@ -703,7 +703,7 @@ srcs: {$(VPATH)}parse.c {$(VPATH)}lex.c {$(VPATH)}newline.c srcs-ext srcs-enc -EXT_SRCS = $(srcdir)/ext/ripper/ripper.c $(srcdir)/ext/dl/callback/callback.c +EXT_SRCS = $(srcdir)/ext/ripper/ripper.c srcs-ext: $(EXT_SRCS) Index: mvm/gc.c =================================================================== --- mvm/gc.c (revision 26697) +++ mvm/gc.c (revision 26698) @@ -2566,11 +2566,29 @@ } static void -run_final(rb_objspace_t *objspace, VALUE obj) +run_finalizer(rb_objspace_t *objspace, VALUE obj, VALUE objid, VALUE table) { long i; int status; - VALUE args[3], table, objid; + VALUE args[3]; + + args[1] = 0; + args[2] = (VALUE)rb_safe_level(); + if (!args[1] && RARRAY_LEN(table) > 0) { + args[1] = rb_obj_freeze(rb_ary_new3(1, objid)); + } + for (i=0; i<RARRAY_LEN(table); i++) { + VALUE final = RARRAY_PTR(table)[i]; + args[0] = RARRAY_PTR(final)[1]; + args[2] = FIX2INT(RARRAY_PTR(final)[0]); + rb_protect(run_single_final, (VALUE)args, &status); + } +} + +static void +run_final(rb_objspace_t *objspace, VALUE obj) +{ + VALUE table, objid; RUBY_DATA_FUNC free_func = 0; objid = rb_obj_id(obj); /* make obj into id */ @@ -2588,17 +2606,7 @@ if (finalizer_table && st_delete(finalizer_table, (st_data_t*)&obj, &table)) { - args[1] = 0; - args[2] = (VALUE)rb_safe_level(); - if (!args[1] && RARRAY_LEN(table) > 0) { - args[1] = rb_obj_freeze(rb_ary_new3(1, objid)); - } - for (i=0; i<RARRAY_LEN(table); i++) { - VALUE final = RARRAY_PTR(table)[i]; - args[0] = RARRAY_PTR(final)[1]; - args[2] = FIX2INT(RARRAY_PTR(final)[0]); - rb_protect(run_single_final, (VALUE)args, &status); - } + run_finalizer(objspace, obj, objid, table); } } @@ -2630,20 +2638,35 @@ chain_finalized_object(st_data_t key, st_data_t val, st_data_t arg) { RVALUE *p = (RVALUE *)key, **final_list = (RVALUE **)arg; - if (p->as.basic.flags & FL_FINALIZE) { + if ((p->as.basic.flags & (FL_FINALIZE|FL_MARK)) == FL_FINALIZE) { if (BUILTIN_TYPE(p) != T_ZOMBIE) { p->as.free.flags = FL_MARK | T_ZOMBIE; /* remain marked */ RDATA(p)->dfree = 0; } p->as.free.next = *final_list; *final_list = p; - return ST_CONTINUE; } - else { - return ST_DELETE; - } + return ST_CONTINUE; } +struct force_finalize_list { + VALUE obj; + VALUE table; + struct force_finalize_list *next; +}; + +static int +force_chain_object(st_data_t key, st_data_t val, st_data_t arg) +{ + struct force_finalize_list **prev = (struct force_finalize_list **)arg; + struct force_finalize_list *curr = ALLOC(struct force_finalize_list); + curr->obj = key; + curr->table = val; + curr->next = *prev; + *prev = curr; + return ST_DELETE; +} + void rb_gc_call_finalizer_at_exit(void) { @@ -2659,15 +2682,24 @@ /* run finalizers */ if (finalizer_table) { - finalize_deferred(objspace); - while (finalizer_table->num_entries > 0) { + do { + /* XXX: this loop will make no sense */ + /* because mark will not be removed */ + finalize_deferred(objspace); + mark_tbl(objspace, finalizer_table, 0); st_foreach(finalizer_table, chain_finalized_object, - (st_data_t)&final_list); - if (!(p = final_list)) break; - do { - final_list = p->as.free.next; - run_final(objspace, (VALUE)p); - } while ((p = final_list) != 0); + (st_data_t)&deferred_final_list); + } while (deferred_final_list); + /* force to run finalizer */ + while (finalizer_table->num_entries) { + struct force_finalize_list *list = 0; + st_foreach(finalizer_table, force_chain_object, (st_data_t)&list); + while (list) { + struct force_finalize_list *curr = list; + run_finalizer(objspace, curr->obj, rb_obj_id(curr->obj), curr->table); + list = curr->next; + xfree(curr); + } } st_free_table(finalizer_table); finalizer_table = 0; Index: mvm/KNOWNBUGS.rb =================================================================== --- mvm/KNOWNBUGS.rb (revision 26697) +++ mvm/KNOWNBUGS.rb (revision 26698) @@ -3,3 +3,14 @@ # So all tests will cause failure. # +assert_finish 1, %q{ + open("tst-remove-load.rb", "w") {|f| + f << <<'End' +module Kernel + remove_method :load +end +raise +End + } + load "tst-remove-load.rb" +}, '[ruby-dev:40234] [ruby-core:27959]' Index: mvm/ext/dl/cfunc.c =================================================================== --- mvm/ext/dl/cfunc.c (revision 26697) +++ mvm/ext/dl/cfunc.c (revision 26698) @@ -147,12 +147,12 @@ struct cfunc_data *data; void *saddr; const char *sname; - + rb_scan_args(argc, argv, "13", &addr, &type, &name, &calltype); - + saddr = (void*)(NUM2PTR(rb_Integer(addr))); sname = NIL_P(name) ? NULL : StringValuePtr(name); - + TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, data); if( data->name ) xfree(data->name); data->ptr = saddr; @@ -284,11 +284,11 @@ { VALUE val; char *str; - int str_size; + size_t str_size; struct cfunc_data *cfunc; - + TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc); - + str_size = (cfunc->name ? strlen(cfunc->name) : 0) + 100; str = ruby_xmalloc(str_size); snprintf(str, str_size - 1, @@ -339,22 +339,31 @@ memset(stack, 0, sizeof(DLSTACK_TYPE) * DLSTACK_SIZE); Check_Type(ary, T_ARRAY); - + TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc); if( cfunc->ptr == 0 ){ rb_raise(rb_eDLError, "can't call null-function"); return Qnil; } - + + if( RARRAY_LEN(ary) >= DLSTACK_SIZE ){ + rb_raise(rb_eDLError, "too many arguments (stack overflow)"); + } for( i = 0; i < RARRAY_LEN(ary); i++ ){ - if( i >= DLSTACK_SIZE ){ - rb_raise(rb_eDLError, "too many arguments (stack overflow)"); + unsigned long rb_big2ulong_pack(VALUE x); + VALUE arg = RARRAY_PTR(ary)[i]; + + rb_check_safe_obj(arg); + if (FIXNUM_P(arg)) { + stack[i] = FIX2LONG(arg); } - rb_check_safe_obj(RARRAY_PTR(ary)[i]); - stack[i] = NUM2LONG(RARRAY_PTR(ary)[i]); + else { + Check_Type(arg, T_BIGNUM); + stack[i] = rb_big2ulong_pack(arg); + } } - + /* calltype == CFUNC_CDECL */ if( cfunc->calltype == CFUNC_CDECL #ifndef FUNC_STDCALL Index: mvm/ext/dl/depend =================================================================== --- mvm/ext/dl/depend (revision 26697) +++ mvm/ext/dl/depend (revision 26698) @@ -1,7 +1,13 @@ cfunc.o: cfunc.c dl.h $(hdrdir)/ruby.h +closure.o: closure.c dl.h dl_conversions.h $(hdrdir)/ruby.h + cptr.o: cptr.c dl.h $(hdrdir)/ruby.h $(hdrdir)/io.h handle.o: handle.c dl.h $(hdrdir)/ruby.h +method.o: method.c dl.h dl_conversions.h $(hdrdir)/ruby.h + dl.o: dl.c dl.h $(hdrdir)/ruby.h $(hdrdir)/io.h + +dl_conversions.o: dl_conversions.c dl_conversions.h Index: mvm/ext/dl/method.c =================================================================== --- mvm/ext/dl/method.c (revision 26697) +++ mvm/ext/dl/method.c (revision 26698) @@ -91,7 +91,7 @@ result = ffi_prep_cif ( cif, NUM2INT(abi), - RARRAY_LEN(args), + RARRAY_LENINT(args), DL2FFI_TYPE(NUM2INT(ret_type)), arg_types); Index: mvm/ext/dl/dl_conversions.c =================================================================== --- mvm/ext/dl/dl_conversions.c (revision 26697) +++ mvm/ext/dl/dl_conversions.c (revision 26698) @@ -1,38 +1,40 @@ #include <dl_conversions.h> -ffi_type * rb_dl_type_to_ffi_type(int dl_type) +ffi_type * +rb_dl_type_to_ffi_type(int dl_type) { int signed_p = 1; - if(dl_type < 0) { + if (dl_type < 0) { dl_type = -1 * dl_type; signed_p = 0; } - switch(dl_type) { - case DLTYPE_VOID: - return &ffi_type_void; - case DLTYPE_VOIDP: - return &ffi_type_pointer; - case DLTYPE_CHAR: - return signed_p ? &ffi_type_schar : &ffi_type_uchar; - case DLTYPE_SHORT: - return signed_p ? &ffi_type_sshort : &ffi_type_ushort; - case DLTYPE_INT: - return signed_p ? &ffi_type_sint : &ffi_type_uint; - case DLTYPE_LONG: - return signed_p ? &ffi_type_slong : &ffi_type_ulong; +#define rb_ffi_type_of(t) (signed_p ? &ffi_type_s##t : &ffi_type_u##t) + + switch (dl_type) { + case DLTYPE_VOID: + return &ffi_type_void; + case DLTYPE_VOIDP: + return &ffi_type_pointer; + case DLTYPE_CHAR: + return rb_ffi_type_of(char); + case DLTYPE_SHORT: + return rb_ffi_type_of(short); + case DLTYPE_INT: + return rb_ffi_type_of(int); + case DLTYPE_LONG: + return rb_ffi_type_of(long); #if HAVE_LONG_LONG - case DLTYPE_LONG_LONG: - return &ffi_type_uint64; - break; + case DLTYPE_LONG_LONG: + return rb_ffi_type_of(int64); #endif - case DLTYPE_FLOAT: - return &ffi_type_float; - case DLTYPE_DOUBLE: - return &ffi_type_double; - default: - rb_raise(rb_eRuntimeError, "unknown type %d", dl_type); + case DLTYPE_FLOAT: + return &ffi_type_float; + case DLTYPE_DOUBLE: + return &ffi_type_double; + default: + rb_raise(rb_eRuntimeError, "unknown type %d", dl_type); } return &ffi_type_pointer; } Index: mvm/ext/dl/cptr.c =================================================================== --- mvm/ext/dl/cptr.c (revision 26697) +++ mvm/ext/dl/cptr.c (revision 26698) @@ -104,7 +104,7 @@ else{ rb_raise(rb_eTypeError, "DL::PtrData was expected"); } - + return ptr; } @@ -186,7 +186,7 @@ rb_dlptr_s_malloc(int argc, VALUE argv[], VALUE klass) { VALUE size, sym, obj; - int s; + long s; freefunc_t f; switch (rb_scan_args(argc, argv, "11", &size, &sym)) { Index: mvm/ext/dl/closure.c =================================================================== --- mvm/ext/dl/closure.c (revision 26697) +++ mvm/ext/dl/closure.c (revision 26698) @@ -57,7 +57,7 @@ VALUE self = (VALUE)ctx; VALUE rbargs = rb_iv_get(self, "@args"); VALUE ctype = rb_iv_get(self, "@ctype"); - int argc = RARRAY_LEN(rbargs); + int argc = RARRAY_LENINT(rbargs); VALUE *params = xcalloc(argc, sizeof(VALUE *)); VALUE ret; int i, dl_type; @@ -165,7 +165,7 @@ if (2 == rb_scan_args(rbargc, argv, "21", &ret, &args, &abi)) abi = INT2NUM(FFI_DEFAULT_ABI); - argc = RARRAY_LEN(args); + argc = RARRAY_LENINT(args); TypedData_Get_Struct(self, dl_closure, &dlclosure_data_type, cl); Index: mvm/hash.c =================================================================== --- mvm/hash.c (revision 26697) +++ mvm/hash.c (revision 26698) @@ -268,6 +268,14 @@ } static void +hash_update(VALUE hash, VALUE key) +{ + if (RHASH(hash)->iter_lev > 0 && !st_lookup(RHASH(hash)->ntbl, key, 0)) { + rb_raise(rb_eRuntimeError, "can't add a new key into hash during iteration"); + } +} + +static void default_proc_arity_check(VALUE proc) { int n = rb_proc_arity(proc); @@ -1034,6 +1042,7 @@ rb_hash_aset(VALUE hash, VALUE key, VALUE val) { rb_hash_modify(hash); + hash_update(hash, key); if (hash == key) { rb_raise(rb_eArgError, "recursive key for hash"); } @@ -1628,6 +1637,7 @@ rb_hash_update_i(VALUE key, VALUE value, VALUE hash) { if (key == Qundef) return ST_CONTINUE; + hash_update(hash, key); st_insert(RHASH(hash)->ntbl, key, value); return ST_CONTINUE; } @@ -1639,6 +1649,7 @@ if (rb_hash_has_key(hash, key)) { value = rb_yield_values(3, key, rb_hash_aref(hash, key), value); } + hash_update(hash, key); st_insert(RHASH(hash)->ntbl, key, value); return ST_CONTINUE; } Index: mvm/.merged-trunk-revision =================================================================== --- mvm/.merged-trunk-revision (revision 26697) +++ mvm/.merged-trunk-revision (revision 26698) @@ -1 +1 @@ -26678 +26697 Index: mvm/vm.c =================================================================== --- mvm/vm.c (revision 26697) +++ mvm/vm.c (revision 26698) @@ -981,6 +981,7 @@ /* for vm development */ +#if VMDEBUG static const char * vm_frametype_name(const rb_control_frame_t *cfp) { @@ -999,6 +1000,7 @@ rb_bug("unknown frame"); } } +#endif /* evaluator body */ Index: mvm/vm_insnhelper.c =================================================================== --- mvm/vm_insnhelper.c (revision 26697) +++ mvm/vm_insnhelper.c (revision 26698) @@ -364,7 +364,6 @@ const rb_method_entry_t *me) { VALUE val = 0; - int state = 0; const rb_method_definition_t *def = me->def; rb_control_frame_t *cfp; Index: mvm/test/dl/test_method.rb =================================================================== --- mvm/test/dl/test_method.rb (revision 26697) +++ mvm/test/dl/test_method.rb (revision 26698) @@ -4,7 +4,7 @@ module DL class TestMethod < TestBase def test_method_call - f = Method.new(@libc['sinf'], [TYPE_FLOAT], TYPE_FLOAT) + f = Method.new(@libm['sinf'], [TYPE_FLOAT], TYPE_FLOAT) assert_in_delta 1.0, f.call(90 * Math::PI / 180), 0.0001 end end Property changes on: mvm/test/dl/test_method.rb ___________________________________________________________________ Name: svn:eol-style + LF Index: mvm/test/dl/test_base.rb =================================================================== --- mvm/test/dl/test_base.rb (revision 26697) +++ mvm/test/dl/test_base.rb (revision 26698) @@ -66,11 +66,11 @@ end def assert_match(expected, actual, message="") - assert(expected === actual, message) + assert_operator(expected, :===, actual, message) end def assert_positive(actual) - assert(actual > 0) + assert_operator(actual, :>, 0) end def assert_zero(actual) @@ -78,7 +78,7 @@ end def assert_negative(actual) - assert(actual < 0) + assert_operator(actual, :<, 0) end def test_empty() Index: mvm/test/dl/test_import.rb =================================================================== --- mvm/test/dl/test_import.rb (revision 26697) +++ mvm/test/dl/test_import.rb (revision 26698) @@ -18,7 +18,7 @@ extern "int gettimeofday(timeval*, timezone*)" rescue nil QsortCallback = bind("void *qsort_callback(void*, void*)", :temp) - BoundQsortCallback = bind("void *qsort_callback(void*, void*)"){|ptr1,ptr2| ptr1[0] <=> ptr2[0]} + BoundQsortCallback = bind("void *bound_qsort_callback(void*, void*)"){|ptr1,ptr2| ptr1[0] <=> ptr2[0]} Timeval = struct [ "long tv_sec", "long tv_usec", Index: mvm/test/dl/test_handle.rb =================================================================== --- mvm/test/dl/test_handle.rb (revision 26697) +++ mvm/test/dl/test_handle.rb (revision 26698) @@ -4,7 +4,7 @@ class TestHandle < TestBase def test_to_i handle = DL::Handle.new(LIBC_SO) - assert handle.to_i + assert_kind_of Integer, handle.to_i end def test_static_sym_secure @@ -22,7 +22,7 @@ end def test_static_sym - assert DL::Handle.sym('dlopen') + assert_not_nil DL::Handle.sym('dlopen') assert_equal DL::Handle.sym('dlopen'), DL::Handle['dlopen'] end @@ -57,8 +57,8 @@ def test_sym handle = DL::Handle.new(LIBC_SO) - assert handle.sym('calloc') - assert handle['calloc'] + assert_not_nil handle.sym('calloc') + assert_not_nil handle['calloc'] end def test_handle_close @@ -98,12 +98,12 @@ def test_initialize_noargs handle = DL::Handle.new - assert handle['rb_str_new'] + assert_not_nil handle['rb_str_new'] end def test_initialize_flags handle = DL::Handle.new(LIBC_SO, DL::RTLD_LAZY | DL::RTLD_GLOBAL) - assert handle['calloc'] + assert_not_nil handle['calloc'] end def test_enable_close @@ -134,7 +134,7 @@ # library. # --- Ubuntu Linux 8.04 dlsym(3) handle = DL::Handle::NEXT - assert handle['malloc'] + assert_not_nil handle['malloc'] rescue # BSD # @@ -145,19 +145,19 @@ # called from a shared library, all subsequent shared libraries are # searched. RTLD_NEXT is useful for implementing wrappers around library # functions. For example, a wrapper function getpid() could access the - # ealgetpid() with dlsym(RTLD_NEXT, "getpid"). (Actually, the dlfunc() + # "real" getpid() with dlsym(RTLD_NEXT, "getpid"). (Actually, the dlfunc() # interface, below, should be used, since getpid() is a function and not a # data object.) # --- FreeBSD 8.0 dlsym(3) require 'objspace' handle = DL::Handle::NEXT - assert handle['Init_objspace'] + assert_not_nil handle['Init_objspace'] end end def test_DEFAULT handle = DL::Handle::DEFAULT - assert handle['malloc'] + assert_not_nil handle['malloc'] end end end Index: mvm/file.c =================================================================== --- mvm/file.c (revision 26697) +++ mvm/file.c (revision 26698) @@ -920,9 +920,8 @@ #endif } -#ifndef HAVE_GROUP_MEMBER static int -group_member(GETGROUPS_T gid) +rb_group_member(GETGROUPS_T gid) { #ifndef _WIN32 if (getgid() == gid || getegid() == gid) @@ -949,7 +948,6 @@ #endif return FALSE; } -#endif #ifndef S_IXUGO # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) @@ -986,7 +984,7 @@ if (st.st_uid == euid) /* owner */ mode <<= 6; - else if (group_member(st.st_gid)) + else if (rb_group_member(st.st_gid)) mode <<= 3; if ((int)(st.st_mode & mode) == mode) return 0; @@ -1486,7 +1484,7 @@ struct stat st; if (rb_stat(fname, &st) < 0) return Qfalse; - if (group_member(st.st_gid)) return Qtrue; + if (rb_group_member(st.st_gid)) return Qtrue; #endif return Qfalse; } @@ -4323,7 +4321,7 @@ rb_stat_grpowned(VALUE obj) { #ifndef _WIN32 - if (group_member(get_stat(obj)->st_gid)) return Qtrue; + if (rb_group_member(get_stat(obj)->st_gid)) return Qtrue; #endif return Qfalse; } @@ -4385,7 +4383,7 @@ return st->st_mode & S_IRUSR ? Qtrue : Qfalse; #endif #ifdef S_IRGRP - if (group_member(get_stat(obj)->st_gid)) + if (rb_group_member(get_stat(obj)->st_gid)) return st->st_mode & S_IRGRP ? Qtrue : Qfalse; #endif #ifdef S_IROTH @@ -4477,7 +4475,7 @@ return st->st_mode & S_IWUSR ? Qtrue : Qfalse; #endif #ifdef S_IWGRP - if (group_member(get_stat(obj)->st_gid)) + if (rb_group_member(get_stat(obj)->st_gid)) return st->st_mode & S_IWGRP ? Qtrue : Qfalse; #endif #ifdef S_IWOTH @@ -4572,7 +4570,7 @@ return st->st_mode & S_IXUSR ? Qtrue : Qfalse; #endif #ifdef S_IXGRP - if (group_member(get_stat(obj)->st_gid)) + if (rb_group_member(get_stat(obj)->st_gid)) return st->st_mode & S_IXGRP ? Qtrue : Qfalse; #endif #ifdef S_IXOTH -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/