summaryrefslogtreecommitdiff
path: root/include/os.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-10-01 11:55:08 -0600
committerSimon Glass <sjg@chromium.org>2018-10-09 04:40:26 -0600
commit056a5cea3139cd41836051114a0f3344ac3d9f58 (patch)
treee470ad79ba80909ee6c0ea40f104795914bb2d5d /include/os.h
parent50b288aca324649fb5b357ce75972a5261cf94fc (diff)
sandbox: Add a way to write data to the host filesystem
For debugging it is sometimes useful to write out data for inspection using an external tool. Add a function which can write this data to a given file. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/os.h')
-rw-r--r--include/os.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/os.h b/include/os.h
index 9e3a561b65..efa9e52d12 100644
--- a/include/os.h
+++ b/include/os.h
@@ -347,4 +347,17 @@ void os_abort(void);
*/
int os_mprotect_allow(void *start, size_t len);
+/**
+ * os_write_file() - Write a file to the host filesystem
+ *
+ * This can be useful when debugging for writing data out of sandbox for
+ * inspection by external tools.
+ *
+ * @name: File path to write to
+ * @buf: Data to write
+ * @size: Size of data to write
+ * @return 0 if OK, -ve on error
+ */
+int os_write_file(const char *name, const void *buf, int size);
+
#endif