ostream-file.c revision bad44d7239e5d1163aadff48ea8ca96d01ed1561
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz/* Copyright (c) 2002-2007 Dovecot authors, see the included COPYING file */
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz/* @UNSAFE: whole file */
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz/* try to keep the buffer size within 4k..128k. ReiserFS may actually return
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz 128k as optimal size. */
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz ((fstream)->head == (fstream)->tail && !(fstream)->full)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz ((size) < SSIZE_T_MAX ? (size_t)(size) : SSIZE_T_MAX)
/* XXXT...HXXX */
if (ret < 0) {
if (ret > 0)
sent = 0;
size = 0;
for (i = 0; i < IOV_MAX; i++)
IOV_MAX);
iov_size);
if (ret > 0) {
if (ret < 0) {
return ret;
int iov_len;
if (iov_len > 0) {
if (ret < 0)
int ret;
else if (!set) {
/* XXXT...HXXX */
int ret;
if (ret == 0)
sent = 0;
fstream);
return sent;
unsigned int iov_count)
if (ret < 0)
iov++;
iov_count--;
if (iov_count == 0)
return ret;
iov++;
iov_count--;
for (i = 0; i < iov_count; i++) {
return ret;
return ret;
if (ret <= 0) {
ret = 0;
int iov_len;
const unsigned char *data;
int pos;
skip_size = 0;
if (size == 0) {
if (ret < 0)
if (skip_size > 0) {
ret = 0;
skip_size = 0;
iov_len = 0;
const unsigned char *data;
if (ret < 0) {
int in_fd;
if (ret == 0) {
if (ret > 0) {
return ret;
static struct file_ostream *
return fstream;
struct ostream *
if (offset >= 0) {
if (max_buffer_size == 0)
return ostream;
struct ostream *
return ostream;