aboutsummaryrefslogtreecommitdiffstats
path: root/ext/fiddle
Commit message (Collapse)AuthorAgeFilesLines
* * ext/fiddle/handle.c: check tainted string arguments.nagachika2015-12-161-7/+10
| | | | | | | | Patch provided by tenderlove and nobu. * test/fiddle/test_handle.rb (class TestHandle): add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* handle ext/ as r53141naruse2015-12-1611-0/+11
| | | | | | | | g -L frozen_string_literal ext/**/*.rb|xargs ruby -Ka -e'ARGV.each{|fn|puts fn;open(fn,"r+"){|f|s=f.read.sub(/\A(#!.*\n)?(#.*coding.*\n)?/,"\\&# frozen_string_literal: false\n");f.rewind;f.write s}}' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* function.c: fix typonobu2015-12-131-3/+3
| | | | | | | * ext/fiddle/function.c (initialize): fix typo "ary" to "args", and adjust type of variables to suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/fiddle/function.c: fix build error introduced at r53082.usa2015-12-131-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* function.c: check argumentsnobu2015-12-131-16/+34
| | | | | | | * ext/fiddle/function.c (initialize): check all arguments first. reported by Marcin 'Icewall' Noga of Cisco Talos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* conversions.h: PTR2NUMnobu2015-12-131-2/+2
| | | | | | | * ext/fiddle/conversions.h (PTR2NUM): use signed integer to make Fixnum for negative values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* NEWS: add note about Fiddle GVL releasenormal2015-12-111-1/+3
| | | | | | | * NEWS: note Fiddle GVL release [Feature #11607] * ext/fiddle/function.c (Init_fiddle_function): document above, too git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/**/*.c (*_memsize): same as r52986 for extensions.ko12015-12-094-12/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: release GVL for ffi_callnormal2015-11-234-35/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some external functions I wish to call may take a long time and unnecessarily block other threads. This may lead to performance regressions for fast functions as releasing/acquiring the GVL is not cheap, but can improve performance for long-running functions in multi-threaded applications. This also means we must reacquire the GVL when calling Ruby-defined callbacks for Fiddle::Closure, meaning we must detect whether the current thread has the GVL by exporting ruby_thread_has_gvl_p in internal.h * ext/fiddle/function.c (struct nogvl_ffi_call_args): new struct for GVL release (nogvl_ffi_call): new function (function_call): adjust for GVL release [ruby-core:71642] [Feature #11607] * ext/fiddle/closure.c (struct callback_args): new struct for GVL acquire (with_gvl_callback): adjusted original callback function (callback): wrapper for conditional GVL acquire * ext/fiddle/depend: add dependencies * ext/fiddle/extconf.rb: include top_srcdir for internal.h * internal.h (ruby_thread_has_gvl_p): expose for fiddle * vm_core.h (ruby_thread_has_gvl_p): moved to internal.h * test/fiddle/test_function.rb (test_nogvl_poll): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext: use RARRAY_AREFnobu2015-11-052-4/+4
| | | | | | | | * ext/**/*.c: prefer RARRAY_AREF to indexing RARRAY_CONST_PTR. pointed out by hanmac. https://github.com/ruby/ruby/commit/3553a86#commitcomment-14187670 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext: use RARRAY_CONST_PTRnobu2015-11-042-5/+5
| | | | | | | * ext/bigdecimal/bigdecimal.c: use RARRAY_CONST_PTR just fore reference instead of RARRAY_PTR, to keep the array WB-protected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext: adjust index typenobu2015-11-041-1/+1
| | | | | | * ext: use long for index instead of int and RARRAY_LENINT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use rb_check_arity [ci skip]nobu2015-10-251-3/+2
| | | | | | | * ext: use rb_check_arity and rb_error_arity to raise ArgumentError. [Feature #9025] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/fiddle/closure.c (callback): static functionnormal2015-10-191-1/+1
| | | | | | | | The `callback' function is not used outside of closure.c and should not be able to cause namespace conflicts in compilers without visibility pragmas. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: $LOCAL_LIBS needs to be expandednobu2015-07-291-1/+1
| | | | | | | * ext/fiddle/extconf.rb: revert part of r51401 and expand $LOCAL_LIBS as it will be extracted and copied to exts.mk. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: clean dot dirnobu2015-07-271-1/+1
| | | | | | * ext/fiddle/depend (distclean-libffi): clean dot directory too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: unexpand LIBFFI_DIRnobu2015-07-271-3/+4
| | | | | | * ext/fiddle/extconf.rb: use LIBFFI_DIR instead of expanding it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: $SAFE=2 is now obsolete.hsbt2015-06-181-3/+0
| | | | | | | | | | * dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c gc.c, io.c, process.c, safe.c, signal.c, win32/file.c: removed code for $SAFE=2 * test/erb/test_erb.rb, test/fiddle/test_handle.rb test/ruby/test_env.rb: removed tests for $SAFE=2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/fiddle/depend: Fix "Wrong mix of special targets" error withakr2015-04-121-3/+3
| | | | | | | | OpenBSD make. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* libff: fix enable-shared conditionnobu2015-03-131-1/+1
| | | | | | | | | | * ext/fiddle/extconf.rb: needs --enable-shared when linked to libruby or fiddle.so. since --with-static-linked-ext does no longer link extensions to ruby program with --enable-shared, the only combination needs --enable-static is --disable-shared and --with-static-linked-ext. [ruby-dev:48901] [Bug #10960] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* libffi: workaround of VC12 mlnobu2015-01-241-1/+1
| | | | | | | | * ext/fiddle/win32/libffi.mk.tmpl: assemble without directory prefix. workaround of a bug of VC12 ml, by unak at [ruby-core:67792]. [ruby-core:67789] [Bug #10780] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: --disable-bundled-libffinobu2015-01-171-2/+4
| | | | | | | * ext/fiddle/extconf.rb: disable bundled libffi if explicitly disabled by --disable-bundled-libffi. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: check assemblernobu2015-01-111-0/+3
| | | | | | * ext/fiddle/extconf.rb: requires assembler for src/win{32,64}.S. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: fix for old VCnobu2015-01-111-0/+15
| | | | | | | * ext/fiddle/win32/libffi-3.2.1-mswin.patch (include/ffi.h.in): old version VCs did not support long long, use __int64 instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cparser.rb: limit word numbernobu2015-01-031-1/+1
| | | | | | | * ext/fiddle/lib/fiddle/cparser.rb (parse_ctype): limit split word number as the rest are not used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/fiddle/lib/fiddle/cparser.rb: r49110 brake Fiddle::Import withhsbt2015-01-031-0/+1
| | | | | | | | type_alias * test/fiddle/test_cparser.rb: added type_alias test for parse_ctype and parse_struct_signature. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * remove trailing spaces.svn2015-01-031-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/fiddle/lib/fiddle/cparser.rb: Support for Fiddle::CParserhsbt2015-01-031-70/+86
| | | | | | | | to handle rich signatures including parameter names and function pointer types. Patch by @theryan [fix GH-590] * test/fiddle/test_cparser.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: append libffi config.lognobu2014-12-301-1/+7
| | | | | | * ext/fiddle/extconf.rb: copy config.log of libffi when failed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* libffi.mk.tmpl: fix STATICLIBnobu2014-12-251-1/+1
| | | | | | | * ext/fiddle/win32/libffi.mk.tmpl (STATICLIB): fix static library name. [ruby-core:67128] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extconf.rb: libffi PIC objectsnobu2014-12-251-2/+3
| | | | | | | * ext/fiddle/extconf.rb: make PIC objects if it will be linked as a shared object eventually. [ruby-core:67128] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/fiddle/win32/libffi-3.2.1-mswin.patch: support mswin32.usa2014-12-251-3/+47
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: depend rulesnobu2014-12-241-3/+14
| | | | | | | * ext/fiddle/depend: mark PHONY targets, and workaround of unexpected DEPEND_RULES on mswin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: win32/libffi-config.rbnobu2014-12-245-21/+197
| | | | | | | * ext/fiddle/win32/libffi-config.rb: generate necessary files to build on mswin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/fiddle/extconf.rb: remove ffitarget.h generated by configure onusa2014-12-241-0/+3
| | | | | | | | mswin, because it's not normal file (cygwin's symlink) and have system attribute. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: extlibsnobu2014-12-232-0/+134
| | | | | | | * ext/fiddle/extlibs: libffi-3.2.1 and patch for mswin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extconf.rb: no empty CPPnobu2014-12-231-1/+1
| | | | | | | * ext/fiddle/extconf.rb: pass CPP only if necessary, should not make it empty. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extmk.rb: replace current directory namenobu2014-12-231-3/+1
| | | | | | | | * ext/extmk.rb (extmake): replace "./" at beginning in LOCAL_LIBS with the current directory name for values cached in previous Makefile. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: use RMALLnobu2014-12-231-1/+1
| | | | | | | * ext/fiddle/depend (realclean-libffi): use RMALL instead of RMDIRS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: clean-libffinobu2014-12-232-2/+21
| | | | | | * ext/fiddle/depend (clean-libffi): clean libffi directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extconf.rb: try modversion ff pkg_config succeedednobu2014-12-231-2/+2
| | | | | | | * ext/fiddle/extconf.rb: when pkg_config failed, module version is not available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extconf.rb: libffi on mswinnobu2014-12-231-8/+35
| | | | | | | * ext/fiddle/extconf.rb: try to compile libffi as mingw on mswin if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extconf.rb: libffi with librubynobu2014-12-222-2/+6
| | | | | | | * ext/fiddle/extconf.rb: link libffi with libruby for symbols provided by ruby on some platforms, e.g. alloca. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extconf.rb: configure libffi firstnobu2014-12-221-14/+25
| | | | | | | * ext/fiddle/extconf.rb: configure libffi for the check requires the headers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: modversion may be unavailablenobu2014-12-211-17/+17
| | | | | | * ext/fiddle/extconf.rb: modversion may be unavailable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: do not disturb other checksnobu2014-12-211-2/+7
| | | | | | | | | * ext/fiddle/extconf.rb: add the local ffi library and header just before create_makefile, not to disturb other checks. also prepend the extension path name to the local library name for static linked ext. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* handle.c: suppress warningsnobu2014-12-211-1/+1
| | | | | | | * ext/fiddle/handle.c (CHECK_DLERROR): suppress warnings for using the result of an assignment as a condition without parentheses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: fix build failuresnobu2014-12-212-23/+28
| | | | | | | | | | * ext/fiddle/depend (build-libffi): get rid of eventually empty target for nmake. * ext/fiddle/extconf.rb: omit stuffs for libffi unless bundled libffi is found and used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* handle.c: suppress a warningnobu2014-12-211-0/+1
| | | | | | | * ext/fiddle/handle.c (rb_fiddle_handle_initialize): suppress an unused-but-set-variable warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: configure in mflagsnobu2014-12-202-5/+13
| | | | | | | | * ext/fiddle/extconf.rb: configure is already in mflags, use system instead of xsystem which requires a string, and logging libffi configure output. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e