aboutsummaryrefslogtreecommitdiff
path: root/include/os.h
diff options
context:
space:
mode:
authorSimon Glass2021-08-18 21:40:30 -0600
committerTom Rini2021-09-16 13:19:25 -0400
commitb4467fae06e7c5b48635cd28e0b168b8508ad168 (patch)
treec6bdb800ed5f2021484a0945388cc61922ff9702 /include/os.h
parent79b3f367304dc743518200eb6b82556890c9ae05 (diff)
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>
Diffstat (limited to 'include/os.h')
-rw-r--r--include/os.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/os.h b/include/os.h
index 7b20d606dd0..7661078d336 100644
--- a/include/os.h
+++ b/include/os.h
@@ -52,6 +52,14 @@ off_t os_lseek(int fd, off_t offset, int whence);
#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