Loading include/client/preload.hpp +7 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,11 @@ void destroy_preload() __attribute__((destructor)); #endif void at_fork_syscall(); void at_child_syscall(); void at_parent_syscall(); #endif // IOINTERCEPT_PRELOAD_HPP src/client/preload.cpp +28 −1 Original line number Diff line number Diff line Loading @@ -337,6 +337,9 @@ init_environment() { } // namespace gkfs::preload std::atomic<bool> init{false}; /** * Called initially ONCE when preload library is used with the LD_PRELOAD * environment variable Loading @@ -346,7 +349,10 @@ init_preload() { // The original errno value will be restored after initialization to not // leak internal error codes auto oerrno = errno; if(!init) { init = true; pthread_atfork(&at_fork_syscall, &at_parent_syscall, &at_child_syscall); } CTX->enable_interception(); gkfs::preload::start_self_interception(); Loading Loading @@ -459,3 +465,24 @@ gkfs_end() { return 0; } void at_fork_syscall() { printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled()); destroy_preload(); } void at_parent_syscall() { printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled()); init_preload(); printf("%d -> x At fork parent %d\n", gettid(), CTX->interception_enabled()); } void at_child_syscall() { printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled()); init_preload(); printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled()); } Loading
include/client/preload.hpp +7 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,11 @@ void destroy_preload() __attribute__((destructor)); #endif void at_fork_syscall(); void at_child_syscall(); void at_parent_syscall(); #endif // IOINTERCEPT_PRELOAD_HPP
src/client/preload.cpp +28 −1 Original line number Diff line number Diff line Loading @@ -337,6 +337,9 @@ init_environment() { } // namespace gkfs::preload std::atomic<bool> init{false}; /** * Called initially ONCE when preload library is used with the LD_PRELOAD * environment variable Loading @@ -346,7 +349,10 @@ init_preload() { // The original errno value will be restored after initialization to not // leak internal error codes auto oerrno = errno; if(!init) { init = true; pthread_atfork(&at_fork_syscall, &at_parent_syscall, &at_child_syscall); } CTX->enable_interception(); gkfs::preload::start_self_interception(); Loading Loading @@ -459,3 +465,24 @@ gkfs_end() { return 0; } void at_fork_syscall() { printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled()); destroy_preload(); } void at_parent_syscall() { printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled()); init_preload(); printf("%d -> x At fork parent %d\n", gettid(), CTX->interception_enabled()); } void at_child_syscall() { printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled()); init_preload(); printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled()); }