summaryrefslogtreecommitdiff
path: root/include/os.h
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2024-08-07 16:47:24 -0600
committerTom Rini <[email protected]>2024-08-09 16:03:19 -0600
commitb254a8359ecdc8ec85cd93e055c6bbeee259df1d (patch)
treeef8e14b921dd1a74ac6214844a0547a71b788bc8 /include/os.h
parentd8289e7dfe5541dfef59520917d81cd39e10c8f3 (diff)
sandbox: Return error code from read/write/seek
The existing API for these functions is different from the rest of U-Boot, in that any error code must be obtained from the errno variable on failure. This variable is part of the C library, so accessing it outside of the special 'sandbox' shim-functions is not ideal. Adjust the API to return an error code, to avoid this. Update existing uses to check for any negative value, rather than just -1. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'include/os.h')
-rw-r--r--include/os.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/os.h b/include/os.h
index 877404a6c13..4371270a1ee 100644
--- a/include/os.h
+++ b/include/os.h
@@ -29,7 +29,7 @@ int os_printf(const char *format, ...);
* @fd: File descriptor as returned by os_open()
* @buf: Buffer to place data
* @count: Number of bytes to read
- * Return: number of bytes read, or -1 on error
+ * Return: number of bytes read, or -errno on error
*/
ssize_t os_read(int fd, void *buf, size_t count);
@@ -39,7 +39,7 @@ ssize_t os_read(int fd, void *buf, size_t count);
* @fd: File descriptor as returned by os_open()
* @buf: Buffer containing data to write
* @count: Number of bytes to write
- * Return: number of bytes written, or -1 on error
+ * Return: number of bytes written, or -errno on error
*/
ssize_t os_write(int fd, const void *buf, size_t count);
@@ -49,7 +49,7 @@ ssize_t os_write(int fd, const void *buf, size_t count);
* @fd: File descriptor as returned by os_open()
* @offset: File offset (based on whence)
* @whence: Position offset is relative to (see below)
- * Return: new file offset
+ * Return: new file offset, or -errno on error
*/
off_t os_lseek(int fd, off_t offset, int whence);