summaryrefslogtreecommitdiffstats
path: root/buf.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-11 19:53:29 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-11 19:53:29 -0700
commit1b615a6667660b353c7719d805a0a40cdd948789 (patch)
tree90e6442aca2974f37c15925015363b253c881a1a /buf.c
parentf226f44490a31e88017b2c3e2032d6926ef1c336 (diff)
downloadtxr-1b615a6667660b353c7719d805a0a40cdd948789.tar.gz
txr-1b615a6667660b353c7719d805a0a40cdd948789.tar.bz2
txr-1b615a6667660b353c7719d805a0a40cdd948789.zip
ffi: a measure of safety for callbacks.
We don't want, by default, for callbacks to capture delimited continuations across foreign code, or perpetrate non-local transfers across foreign code. Here, we take an approach similar for what was done in ftw_wrap. * ffi.c (s_exit_point): New global variable with internal linkage. (ffi_call_wrap): If s_exit_point isn't nil, then it means that the callback intercepted a nonlocal transfer and stored its exit point. We resume the transfer to that exit point instead of returning normally. (ffi_closure_dispatch_safe): New static function. (ffi_make_closure): Support a new argument which indicates whether to make a closure which uses ffi_closure_dispatch_safe, or ffi_closure_dispatch. (ffi_init): Update registration of ffi-make-closure intrinsic. * ffi.h (ffi_make_closure): Declaration updated. * share/txr/stdlib/ffi.tl (sys:deffi-cb-expander): New function. (deffi-cb): Macro internals replaced by call to new function. (deffi-cb-safe): New macro. * txr.1: Documentation of ffi-make-closure updated. New deffi-cb-unsafe macro documented.
Diffstat (limited to 'buf.c')
0 files changed, 0 insertions, 0 deletions