diff options
author | Simon Glass | 2021-08-18 21:40:30 -0600 |
---|---|---|
committer | Tom Rini | 2021-09-16 13:19:25 -0400 |
commit | b4467fae06e7c5b48635cd28e0b168b8508ad168 (patch) | |
tree | c6bdb800ed5f2021484a0945388cc61922ff9702 /include/os.h | |
parent | 79b3f367304dc743518200eb6b82556890c9ae05 (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.h | 8 |
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 |