- Modified strace to be able to implement a pull-style syscall tracing API for Lua scripting.
- Added support for Lua scripting, implemented a pull-style C API. Lua scripts can select syscalls they want to be notified about; inspect PID of the traced process, syscall arguments, and return value (on syscall
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size_t l = 0, r = 0; | |
for (size_t i = 1; i < n; ++i) { | |
size_t val = 0; | |
if (i < r) | |
val = min(r - i, z[i - l]); | |
while (i + val < n && s[val] == s[i + val]) | |
++val; | |
z[i] = val; | |
if (r < i + val) { | |
r = i + val; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# limitation: names of variables to return result to can not start with an underscore. | |
«() { | |
local -i _i=1 | |
while [[ ${!_i} != » ]]; do | |
declare -n _${_i}=${!_i} | |
(( ++_i )) | |
done | |
"${@:$[_i+1]}" | |
} |