summaryrefslogtreecommitdiffstats
path: root/compiler-rt/include
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-04-24 17:42:16 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-04-24 17:42:16 +0000
commit16f2f18105e0c4b0d7bf247a70c82f955113b69b (patch)
treef1b7207a151c1426a3e93fb457f0113f879aeb14 /compiler-rt/include
parentf4223918de0aa08443ef9910e7237cfecdca60ac (diff)
downloadbcm5719-llvm-16f2f18105e0c4b0d7bf247a70c82f955113b69b.tar.gz
bcm5719-llvm-16f2f18105e0c4b0d7bf247a70c82f955113b69b.zip
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 llvm-svn: 207131
Diffstat (limited to 'compiler-rt/include')
-rw-r--r--compiler-rt/include/sanitizer/dfsan_interface.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler-rt/include/sanitizer/dfsan_interface.h b/compiler-rt/include/sanitizer/dfsan_interface.h
index 913e7f3d0ed..bcd4ae00248 100644
--- a/compiler-rt/include/sanitizer/dfsan_interface.h
+++ b/compiler-rt/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"
OpenPOWER on IntegriCloud