Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/nolibc: Add fseek() to stdio.h

A very basic wrapper around lseek() that implements fseek().

Signed-off-by: Daniel Palmer <daniel@thingy.jp>
Link: https://patch.msgid.link/20260105023629.1502801-3-daniel@thingy.jp
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

authored by

Daniel Palmer and committed by
Thomas Weißschuh
109770cc edaf3074

+19
+19
tools/include/nolibc/stdio.h
··· 272 272 } 273 273 274 274 275 + /* fseek */ 276 + static __attribute__((unused)) 277 + int fseek(FILE *stream, long offset, int whence) 278 + { 279 + int fd = fileno(stream); 280 + off_t ret; 281 + 282 + ret = lseek(fd, offset, whence); 283 + 284 + /* lseek() and fseek() differ in that lseek returns the new 285 + * position or -1, fseek() returns either 0 or -1. 286 + */ 287 + if (ret >= 0) 288 + return 0; 289 + 290 + return -1; 291 + } 292 + 293 + 275 294 /* minimal printf(). It supports the following formats: 276 295 * - %[l*]{d,u,c,x,p} 277 296 * - %s