diff options
author | Adrian Kummerlaender | 2016-02-06 22:27:55 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2016-02-06 22:27:55 +0100 |
commit | 8923cf4f88ae6e665b0571ac435c72f62461efb3 (patch) | |
tree | a6bbe2145db5b7933f95bedcf824c4e8579a22bd | |
parent | f08930c9c9ce91007c2f576c25d3f874abb96a00 (diff) | |
download | change-8923cf4f88ae6e665b0571ac435c72f62461efb3.tar change-8923cf4f88ae6e665b0571ac435c72f62461efb3.tar.gz change-8923cf4f88ae6e665b0571ac435c72f62461efb3.tar.bz2 change-8923cf4f88ae6e665b0571ac435c72f62461efb3.tar.lz change-8923cf4f88ae6e665b0571ac435c72f62461efb3.tar.xz change-8923cf4f88ae6e665b0571ac435c72f62461efb3.tar.zst change-8923cf4f88ae6e665b0571ac435c72f62461efb3.zip |
Track `writev` system call
-rw-r--r-- | src/actual_function.h | 6 | ||||
-rw-r--r-- | src/change_log.cc | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/actual_function.h b/src/actual_function.h index 0ffe0c2..8229ccf 100644 --- a/src/actual_function.h +++ b/src/actual_function.h @@ -7,6 +7,7 @@ #include <dlfcn.h> #include <sys/mman.h> +#include <sys/uio.h> #include <memory> #include <cstring> @@ -31,6 +32,11 @@ namespace actual { int, const void*, size_t >("write"); + static auto writev = get_actual_function< + ssize_t, + int, const iovec*, int + >("writev"); + static auto rename = get_actual_function< int, const char*, const char* diff --git a/src/change_log.cc b/src/change_log.cc index 4caaa6a..a060c91 100644 --- a/src/change_log.cc +++ b/src/change_log.cc @@ -44,6 +44,18 @@ ssize_t write(int fd, const void* buffer, size_t count) { return actual::write(fd, buffer, count); } +ssize_t writev(int fd, const iovec* iov, int iovcnt) { + if ( fd != *fd_guard && utility::is_regular_file(fd) ) { + const std::string file_name{ utility::get_file_name(fd) }; + + if ( !tracker->is_tracked(file_name) ) { + tracker->track(file_name); + } + } + + return actual::writev(fd, iov, iovcnt); +} + int rename(const char* old_path, const char* new_path) { if ( !tracker->is_tracked(old_path) ) { tracker->track(old_path); |