sandbox: Add a way to find the size of a file
Add a function to return the size of a file. This is useful in situations
where we need to allocate memory for it before reading it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek BehĂșn <marek.behun@nic.cz>
diff --git a/include/os.h b/include/os.h
index 7b20d60..7661078 100644
--- a/include/os.h
+++ b/include/os.h
@@ -52,6 +52,14 @@
#define OS_SEEK_END 2
/**
+ * os_filesize() - Calculate the size of a file
+ *
+ * @fd: File descriptor as returned by os_open()
+ * Return: file size or negative error code
+ */
+int os_filesize(int fd);
+
+/**
* Access to the OS open() system call
*
* @pathname: Pathname of file to open