istream-unix.c revision 03915cfec4eb1b5a65e5b6b676c8f4151bc80351
2454dfa32c93c20a8522c6ed42fe057baaac9f9aStephan Bosch/* Copyright (c) 2014-2017 Dovecot authors, see the included COPYING file */
d74c9f4bf7ee37f3f58a895032ea013d07294865Timo Siraineni_stream_unix_close(struct iostream_private *stream, bool close_parent)
c0435c854a0e7246373b9752d163095cc4fbe985Timo Sirainen struct unix_istream *ustream = (struct unix_istream *)stream;
dd62b77c932d1b518f2a3e4bf80e36542becc256Timo Sirainenstatic ssize_t i_stream_unix_read(struct istream_private *stream)
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen struct unix_istream *ustream = (struct unix_istream *)stream;
c0435c854a0e7246373b9752d163095cc4fbe985Timo Sirainen i_assert(ustream->fstream.skip_left == 0); /* not supported here.. */
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen ret = fd_read(stream->fd, stream->w_buffer + stream->pos, size,
d74c9f4bf7ee37f3f58a895032ea013d07294865Timo Sirainen /* if we get EBADF for a valid fd, it means something's
ecc81625167ed96c04c02aa190a1ea5baa65b474Timo Sirainen really wrong and we'd better just crash. */
252db51b6c0a605163326b3ea5d09e9936ca3b29Timo Sirainenstruct istream *i_stream_create_unix(int fd, size_t max_buffer_size)
d74c9f4bf7ee37f3f58a895032ea013d07294865Timo Sirainen input = i_stream_create_file_common(&ustream->fstream, fd, NULL,
d74c9f4bf7ee37f3f58a895032ea013d07294865Timo Sirainen input->real_stream->iostream.close = i_stream_unix_close;
a94936bafd127680184da114c6a177b37ff656e5Timo Sirainen input->real_stream->read = i_stream_unix_read;
af81f402ddc897c74c1e85abd02879612ce44882Timo Sirainenvoid i_stream_unix_set_read_fd(struct istream *input)
9e095dd6a77097356aca8216356d4d71ef1bea45Timo Sirainenvoid i_stream_unix_unset_read_fd(struct istream *input)