summaryrefslogtreecommitdiff
path: root/include/mailutils/stream.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-12-10 21:33:00 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2010-12-10 21:33:00 +0200
commit1ef742582942bb2a7ef4ce8531cf3b306b3f82d7 (patch)
treeb8b97fcb906a3e0a82ed88653035a4d570a49cca /include/mailutils/stream.h
parent841fc4842ae81579edab2a7752b0347944575d2c (diff)
downloadmailutils-1ef742582942bb2a7ef4ce8531cf3b306b3f82d7.tar.gz
mailutils-1ef742582942bb2a7ef4ce8531cf3b306b3f82d7.tar.bz2
Remove the MU_STREAM_FD_AUTOCLOSE stream flag.
This is the default behavior now. The reverse can be requested by a special MU_IOCTL_FD,MU_IOCTL_FD_SET_BORROW ioctl. * include/mailutils/stream.h (MU_STREAM_FD_AUTOCLOSE): Remove. This is the default behavior now. (MU_IOCTL_FD): New ioctl. (MU_IOCTL_FD_GET_BORROW, MU_IOCTL_FD_SET_BORROW): New opcodes. * include/mailutils/sys/file_stream.h (_MU_FILE_STREAM_FD_BORROWED): New flag. * libmailutils/stream/file_stream.c (fd_close): Close the fd unless _MU_FILE_STREAM_FD_BORROWED bit is set. (fd_open): Clear the _MU_FILE_STREAM_FD_BORROWED bit. (fd_ioctl): Handle MU_IOCTL_FD. (mu_file_stream_create): Remove MU_STREAM_FD_AUTOCLOSE. * ibmailutils/base/version.c (mu_print_options): Set borrow mode on the temporary stdout stream. * libmailutils/cfg/driver.c (mu_cfg_tree_reduce): Set borrow mode on the temporary stderr stream. * libmailutils/stdstream/strerr.c (mu_stdstream_strerr_create): Set borrow mode on the stderr stream. * libmailutils/tests/tempfile.c: set borrow mode on the temporary stream, because it may be reopened later (verify mode). * examples/mta.c: Remove MU_STREAM_FD_AUTOCLOSE. * imap4d/io.c: Likewise. * libmailutils/stream/prog_stream.c: Likewise. * libmailutils/stream/socket_stream.c: Likewise. * libmailutils/stream/temp_file_stream.c: Likewise. * maidag/lmtp.c: Likewise. * pop3d/extra.c: Likewise. These will disappear when the corresponding utilities are rewritten to use MU stdstream: * mail/escape.c (quote0): set borrow mode on the output stream. * mimeview/mimeview.c (display_file): set borrow mode on the input stream. Likewise, these will disappear when MH uses MU stdstream: * mh/anno.c (main): Set borrow mode on the input stream. * mh/mh_init.c (mh_real_install): Likewise. * mh/mh_whatnow.c (_whatnow): Likewise. * mh/mhl.c (open_output): Set borrow mode on the output stream. * mh/mhn.c (mhn_show,store_handler): Likewise.
Diffstat (limited to 'include/mailutils/stream.h')
-rw-r--r--include/mailutils/stream.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/mailutils/stream.h b/include/mailutils/stream.h
index 01311fd24..ec6164cb0 100644
--- a/include/mailutils/stream.h
+++ b/include/mailutils/stream.h
@@ -43,8 +43,7 @@ enum mu_buffer_type
#define MU_STREAM_CREAT 0x00000010
/* So far used only by TCP streams. */
#define MU_STREAM_NONBLOCK 0x00000020
-/* For fd streams only */
-#define MU_STREAM_FD_AUTOCLOSE 0x00000040
+/* Not used 0x00000040 */
/* Not used. Intended for mailboxes only. */
#define MU_STREAM_NONLOCK 0x00000080
/* Not used as well 0x00000100 */
@@ -71,7 +70,8 @@ enum mu_buffer_type
#define MU_IOCTL_NULLSTREAM 6 /* Null stream (see below) */
#define MU_IOCTL_LOGSTREAM 7 /* Log stream (see below) */
#define MU_IOCTL_XSCRIPTSTREAM 8 /* Transcript stream (see below) */
-
+#define MU_IOCTL_FD 9 /* File descriptor manipulation */
+
/* Opcodes common for various families */
#define MU_IOCTL_OP_GET 0
#define MU_IOCTL_OP_SET 1
@@ -147,6 +147,17 @@ enum mu_buffer_type
New transcript level is set to *X. Previous level is stored in X.
*/
#define MU_IOCTL_XSCRIPTSTREAM_LEVEL 0
+
+ /* Opcodes for MU_IOCTL_FD */
+ /* Get "borrow state". Borrowed descriptors remain in open state
+ after the stream is closed.
+ Arg: int *
+ */
+#define MU_IOCTL_FD_GET_BORROW 0
+ /* Set borrow state.
+ Arg: int *
+ */
+#define MU_IOCTL_FD_SET_BORROW 1
#define MU_TRANSPORT_INPUT 0
#define MU_TRANSPORT_OUTPUT 1

Return to:

Send suggestions and report system problems to the System administrator.