summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/fseek.c
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-09 21:17:12 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-09 21:17:12 +0100
commitb5cd18739a64c8d923a55b61c89ae3900faafd84 (patch)
treed192f7b25257ae9a8a4760c68f5314dcbc0d9b91 /lib/libc/stdio/fseek.c
parent119aed5bc787ccbf23d2f151759ec1f3a80977e1 (diff)
Fix include paths and formatting inconsistencies
Diffstat (limited to 'lib/libc/stdio/fseek.c')
-rw-r--r--lib/libc/stdio/fseek.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c
index af12cd2c..0e425e8e 100644
--- a/lib/libc/stdio/fseek.c
+++ b/lib/libc/stdio/fseek.c
@@ -1,28 +1,31 @@
-#include <unistd.h>
-#include <io.h>
-#include <stdio.h>
-#include <atomic.h>
+#include "__stdio.h" // for _IO_EOF, _IO_ERR
+#include "stddef.h" // for NULL
+
+#include <atomic.h> // for LIBC_LOCK, LIBC_UNLOCK
+#include <libc.h> // for __IMPL
+#include <stdio.h> // for FILE, fseek
+#include <unistd.h> // for lseek, off_t
int fseek(FILE *stream, long offset, int whence)
{
- if (stream == NULL || stream->fd < 0)
+ if (stream == NULL || __IMPL(stream)->fd < 0)
return -1;
- LIBC_LOCK(stream->lock);
+ LIBC_LOCK(__IMPL(stream)->lock);
- stream->buf_pos = 0;
- stream->buf_len = 0;
- stream->flags &= ~_IO_EOF;
+ __IMPL(stream)->buf_pos = 0;
+ __IMPL(stream)->buf_len = 0;
+ __IMPL(stream)->flags &= ~_IO_EOF;
- off_t result = lseek(stream->fd, offset, whence);
+ off_t result = lseek(__IMPL(stream)->fd, offset, whence);
- LIBC_UNLOCK(stream->lock);
+ LIBC_UNLOCK(__IMPL(stream)->lock);
if (result == (off_t)-1) {
- stream->flags |= _IO_ERR;
+ __IMPL(stream)->flags |= _IO_ERR;
return -1;
}
- stream->offset = result;
+ __IMPL(stream)->offset = result;
return 0;
}