nyara
nyara copied to clipboard
Find a way to override read(2) / write(2) / send(2)
Override kernel IO functions before loading database drivers, then we can make everything even C-ext based database drivers async. But these read/write/send need to be separated from the usage in nyara's ext.
Then drivers of mongo, pg and mysql can be made totally async easily.
For concurrency safety, we still need to consider their C-side thread-local storages.
stubbing
To stub system calls in linux, use LD_PRELOAD
, example
LD_PRELOAD=/my/malloc.so ls
It could be ignored if rid (real user) != eid (effective user), ref: http://www.lst.de/~okir/blackhats/node23.html
The OSX equivalent is DYLD_INSERT_LIBRARIES
(not quite equivalent in fact)
https://blogs.oracle.com/DatabaseEmporium/entry/where_is_ld_preload_under