fdpass.c revision e345ae91dff5a8c3ab8f43035d1c4da41d0c8a2d
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen/* Copyright (c) 2002-2010 Dovecot authors, see the included COPYING file */
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen fdpass.c - File descriptor passing between processes via UNIX sockets
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen This isn't fully portable, but pretty much all UNIXes nowadays should
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen support this. If you're having runtime problems with fd_read(), check the
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen end of fd_read() and play with the if condition. If you're having problems
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen with fd_send(), try defining BUGGY_CMSG_MACROS.
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen If this file doesn't compile at all, you should check if this is supported
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen in your system at all. It may require some extra #define to enable it.
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen If not, you're pretty much out of luck. Cygwin didn't last I checked.
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen#if defined(irix) || defined (__irix__) || defined(sgi) || defined (__sgi__)
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen#if !defined(_AIX) && !defined(_XOPEN_SOURCE_EXTENDED)
6e8f0036cad59d1d6bcd9ef69bfe712d01656ca3Timo Sirainen# define _XOPEN_SOURCE_EXTENDED /* for Tru64, breaks AIX */
# include "lib.h"
# define i_assert(x)
#include <string.h>
#include <limits.h>
#include "fdpass.h"
#ifndef HAVE_CONFIG_H
struct const_iovec {
const void *iov_base;
#ifdef BUGGY_CMSG_MACROS
#ifndef CMSG_SPACE
# ifndef _CMSG_DATA_ALIGNMENT
# ifndef _CMSG_HDR_ALIGNMENT
#ifdef SCM_RIGHTS
#ifdef __osf__
#ifdef LINUX20
if (ret <= 0) {
return ret;
return ret;
# ifdef __GNUC__