diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2014-04-24 17:42:16 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2014-04-24 17:42:16 +0000 |
commit | 655ff4d7c9303c0e658ee78a88f8ab88963b8b96 (patch) | |
tree | b2aa763a0f35afa657a40ba3912b1b10d4dd2bfb /include/sanitizer | |
parent | 166a37ab16749fbb710b41a2ac4c07ed4c3defaf (diff) |
Add user-defined callback on write() calls.
Add dfsan_set_write_callback(), which sets a callback to be invoked when
a write() call is invoked within DFSan instrumented code.
Patch by Sam Kerner!
Differential Revision: http://reviews.llvm.org/D3268
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@207131 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/sanitizer')
-rw-r--r-- | include/sanitizer/dfsan_interface.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/sanitizer/dfsan_interface.h b/include/sanitizer/dfsan_interface.h index 913e7f3d0..bcd4ae002 100644 --- a/include/sanitizer/dfsan_interface.h +++ b/include/sanitizer/dfsan_interface.h @@ -39,6 +39,9 @@ struct dfsan_label_info { void *userdata; }; +/// Signature of the callback argument to dfsan_set_write_callback(). +typedef void (*dfsan_write_callback_t)(int fd, const void *buf, size_t count); + /// Computes the union of \c l1 and \c l2, possibly creating a union label in /// the process. dfsan_label dfsan_union(dfsan_label l1, dfsan_label l2); @@ -77,6 +80,11 @@ dfsan_label dfsan_has_label_with_desc(dfsan_label label, const char *desc); /// Returns the number of labels allocated. size_t dfsan_get_label_count(void); +/// Sets a callback to be invoked on calls to write(). The callback is invoked +/// before the write is done. The write is not guaranteed to succeed when the +/// callback executes. Pass in NULL to remove any callback. +void dfsan_set_write_callback(dfsan_write_callback_t labeled_write_callback); + #ifdef __cplusplus } // extern "C" |