nuttx/libs/libc/stdio
Michal Lenc 0a107ca6d9 libc: add support for custom streams with fopencookie()
This commit adds support for custom stream via fopencookie function.
The function allows the programmer the create his own custom stream
for IO operations and hook his custom functions to it.

This is a non POSIX interface defined in Standard C library and implemented
according to it. The only difference is in usage of off_t instead of
off64_t. Programmer can use 64 bits offset if CONFIG_FS_LARGEFILE is
enabled. In that case off_t is defined as int64_t (int32_t otherwise).

Field fs_fd is removed from file_struct and fs_cookie is used instead
as a shared variable for file descriptor or user defined cookie.

The interface will be useful for future fmemopen implementation.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-10-18 21:13:01 +08:00
..
CMakeLists.txt libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
Kconfig libc/stdio: changed LIBC_NL_ARGMAX default value to 9 2023-08-03 19:07:22 -07:00
lib_asprintf.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_clearerr.c stdio/lib_clearerr: Did not clear stream buffer flags in clearerr 2021-03-17 03:15:17 -07:00
lib_dprintf.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_dtoa_data.c libs/libc/stdio: replace double_t to double 2020-09-15 14:42:36 +08:00
lib_dtoa_engine.c nuttx: Use MIN/MAX definitions from "sys/param.h" 2023-02-01 23:47:44 +08:00
lib_dtoa_engine.h Remove the unnecessary math.h inclusion 2021-04-12 22:58:23 -04:00
lib_fclose.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_feof.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_ferror.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_fflush.c fs/streams: Move the file streams from the group structure into TLS 2022-12-22 20:16:11 +08:00
lib_fgetc.c libs/libc: support unlock version for fread/fwrite/fputc/fgetc/... 2023-09-06 15:08:24 +03:00
lib_fgetpos.c lib/stdio: Handle 64bits off_t correctly 2021-11-18 10:06:27 -05:00
lib_fgets.c libs/libc: support unlock version for fread/fwrite/fputc/fgetc/... 2023-09-06 15:08:24 +03:00
lib_fileno.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_fopen.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_fopencookie.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_fprintf.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_fputc.c libs/libc: support unlock version for fread/fwrite/fputc/fgetc/... 2023-09-06 15:08:24 +03:00
lib_fputs.c libs/libc: support unlock version for fread/fwrite/fputc/fgetc/... 2023-09-06 15:08:24 +03:00
lib_fputwc.c libs/libc/wchar: add fputwc implementation 2023-09-22 08:51:07 +08:00
lib_fputws.c libs/libc/wchar: add fputws implementation 2023-09-22 08:51:07 +08:00
lib_fread.c libs/libc: support unlock version for fread/fwrite/fputc/fgetc/... 2023-09-06 15:08:24 +03:00
lib_freopen.c libs/libc: remove unnecessary flockfile to improve performance 2023-09-06 15:08:24 +03:00
lib_fscanf.c NuttX: Johannes Schock: update licenses to Apache 2021-04-01 12:13:12 -05:00
lib_fseek.c lib/stdio: Handle 64bits off_t correctly 2021-11-18 10:06:27 -05:00
lib_fseeko.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_fsetpos.c lib/stdio: Handle 64bits off_t correctly 2021-11-18 10:06:27 -05:00
lib_ftell.c lib/stdio: Handle 64bits off_t correctly 2021-11-18 10:06:27 -05:00
lib_ftello.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_fwrite.c libs/libc: support unlock version for fread/fwrite/fputc/fgetc/... 2023-09-06 15:08:24 +03:00
lib_getc.c libs/libc: support unlock version for fread/fwrite/fputc/fgetc/... 2023-09-06 15:08:24 +03:00
lib_getchar.c libs/libc: support unlock version for fread/fwrite/fputc/fgetc/... 2023-09-06 15:08:24 +03:00
lib_getdelim.c stdio: Remove CONFIG_EOL_IS_XXX 2023-02-24 00:35:19 +08:00
lib_gets_s.c libc/stdio: Make gets/gets_s work without CONFIG_FILE_STREAM 2023-02-24 10:39:48 +08:00
lib_gets.c libc/stdio: Make gets/gets_s work without CONFIG_FILE_STREAM 2023-02-24 10:39:48 +08:00
lib_libdgets.c libc/stdio: Make gets/gets_s work without CONFIG_FILE_STREAM 2023-02-24 10:39:48 +08:00
lib_libdtoa.c nuttx: Use MIN/MAX definitions from "sys/param.h" 2023-02-01 23:47:44 +08:00
lib_libfflush.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_libfgets.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_libfilelock.c semantic/parser: fix compile warning found by sparse 2023-05-30 23:00:00 +08:00
lib_libflushall.c libc/stdio: Remove the one line mutex wrapper 2022-11-09 21:38:10 +01:00
lib_libfread_unlocked.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_libfwrite.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_libgetstreams.c nxstyle: covert utf-8 to ascii 2023-07-14 01:24:50 +08:00
lib_libsprintf.c c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
lib_libvscanf.c c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
lib_libvsprintf.c libc: export lib_sprintf_internal function 2023-07-14 00:22:11 +03:00
lib_perror.c Indent the define statement by two spaces 2023-05-21 09:52:08 -03:00
lib_printf.c libc/stdio: Allocate file_struct dynamically 2020-09-11 17:58:17 +08:00
lib_putc.c libc: Refine the inline handling 2020-07-04 11:10:29 +09:00
lib_putchar.c libs/libc: support unlock version for fread/fwrite/fputc/fgetc/... 2023-09-06 15:08:24 +03:00
lib_puts.c libs/libc: support unlock version for fread/fwrite/fputc/fgetc/... 2023-09-06 15:08:24 +03:00
lib_putwc.c libs/libc/wchar: add putwc implementation 2023-09-22 08:51:07 +08:00
lib_putwchar.c libs/libc/wchar: add putwchar implementation 2023-09-22 08:51:07 +08:00
lib_rdflush_unlocked.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_remove.c libc/lib_remove: fix TOCTOU race condition 2023-06-29 18:15:06 +08:00
lib_renameat.c libc: Add a new argument(size_t fulllen) to lib_getfullpath 2023-05-08 09:57:01 +02:00
lib_rewind.c libc/stdio: Add stdio file locking functions 2022-10-22 23:34:45 +08:00
lib_scanf.c NuttX: Johannes Schock: update licenses to Apache 2021-04-01 12:13:12 -05:00
lib_setbuf.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_setbuffer.c libc: Add setbuffer to stdio. 2023-05-01 11:24:41 +03:00
lib_setvbuf.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_snprintf.c c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
lib_sprintf.c c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
lib_sscanf.c NuttX: Johannes Schock: update licenses to Apache 2021-04-01 12:13:12 -05:00
lib_tempnam.c Fixes in asprintf usage. 2023-04-19 02:48:39 +08:00
lib_tmpfile.c libc: tmpfile shouldn't hardcode the folder to /tmp 2020-06-03 07:46:02 -06:00
lib_tmpnam.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_ultoa_invert.c Revert "libc/stdio: enable long long formating by CONFIG_HAVE_LONG_LONG" 2022-07-20 18:06:29 +03:00
lib_ultoa_invert.h Revert "libc/stdio: enable long long formating by CONFIG_HAVE_LONG_LONG" 2022-07-20 18:06:29 +03:00
lib_ungetc.c libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00
lib_vasprintf.c c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
lib_vdprintf.c c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
lib_vfprintf.c c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
lib_vfscanf.c c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
lib_vprintf.c libc/stdio: Allocate file_struct dynamically 2020-09-11 17:58:17 +08:00
lib_vscanf.c
lib_vsnprintf.c c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
lib_vsprintf.c c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
lib_vsscanf.c c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
lib_wrflush_unlocked.c libs/libc: remove unnecessary flockfile to improve performance 2023-09-06 15:08:24 +03:00
Make.defs libc: add support for custom streams with fopencookie() 2023-10-18 21:13:01 +08:00