Implement "read cache" streams. Rewrite stdio and socket streams.
* include/mailutils/sys/stdio_stream.h: Remove. * include/mailutils/sys/socket_stream.h: Remove. * include/mailutils/sys/rdcache_stream.h: New file. * include/mailutils/sys/Makefile.am: Update. * mailbox/rdcache_stream.c: New file. * mailbox/Makefile.am: Update. * examples/mucat.c: New example. * examples/musocio.c: New example. * examples/Makefile.am (noinst_PROGRAMS): Build new examples. * include/mailutils/stream.h (mu_fd_stream_create): New proto. (mu_rdcache_stream_create): New proto. * include/mailutils/sys/file_stream.h (_mu_file_stream_create): Change prototype. * mailbox/file_stream.c (fd_open): Raise the MU_STREAM_AUTOCLOSE bit. (fd_ioctl): Support MU_IOCTL_SET_TRANSPORT. (_mu_file_stream_create): Change signature. All uses updated. Allocate a copy of the filename argument, unless it is NULL. (mu_fd_stream_create): New function. * mailbox/socket_stream.c: Rewrite using file_stream directly. * mailbox/stdio_stream.c: Rewrite. Use rdcache_stream if the seek capability is required on an input stream. * mailbox/streamcpy.c (mu_stream_copy): Handle eventual EACCES return from mu_stream_seek as equivalent to ENOSYS.
Showing
15 changed files
with
547 additions
and
268 deletions
examples/mucat.c
0 → 100644
examples/musocio.c
0 → 100644
mailbox/rdcache_stream.c
0 → 100644
-
Please register or sign in to post a comment