summaryrefslogtreecommitdiff
path: root/src/OS
diff options
context:
space:
mode:
Diffstat (limited to 'src/OS')
-rw-r--r--src/OS/Makefile-AIX26
-rw-r--r--src/OS/Makefile-BSDI23
-rw-r--r--src/OS/Makefile-Base703
-rw-r--r--src/OS/Makefile-CYGWIN113
-rw-r--r--src/OS/Makefile-DGUX33
-rw-r--r--src/OS/Makefile-Darwin26
-rw-r--r--src/OS/Makefile-Default332
-rw-r--r--src/OS/Makefile-FreeBSD36
-rw-r--r--src/OS/Makefile-GNU24
-rw-r--r--src/OS/Makefile-HI-OSF10
-rw-r--r--src/OS/Makefile-HI-UX14
-rw-r--r--src/OS/Makefile-HP-UX17
-rw-r--r--src/OS/Makefile-HP-UX-917
-rw-r--r--src/OS/Makefile-IRIX14
-rw-r--r--src/OS/Makefile-IRIX615
-rw-r--r--src/OS/Makefile-IRIX63218
-rw-r--r--src/OS/Makefile-IRIX6518
-rw-r--r--src/OS/Makefile-Linux31
-rw-r--r--src/OS/Makefile-Linux-libc523
-rw-r--r--src/OS/Makefile-NetBSD27
-rw-r--r--src/OS/Makefile-NetBSD-a.out24
-rw-r--r--src/OS/Makefile-OSF112
-rw-r--r--src/OS/Makefile-OpenBSD26
-rw-r--r--src/OS/Makefile-OpenUNIX19
-rw-r--r--src/OS/Makefile-QNX31
-rw-r--r--src/OS/Makefile-SCO29
-rw-r--r--src/OS/Makefile-SCO_SV34
-rw-r--r--src/OS/Makefile-SunOS423
-rw-r--r--src/OS/Makefile-SunOS524
-rw-r--r--src/OS/Makefile-SunOS5-hal20
-rw-r--r--src/OS/Makefile-ULTRIX20
-rw-r--r--src/OS/Makefile-UNIX_SV26
-rw-r--r--src/OS/Makefile-USG35
-rw-r--r--src/OS/Makefile-Unixware734
-rw-r--r--src/OS/Makefile-mips19
-rw-r--r--src/OS/eximon.conf-Default43
-rw-r--r--src/OS/os.Configuring209
-rw-r--r--src/OS/os.c-GNU57
-rw-r--r--src/OS/os.c-HI-OSF37
-rw-r--r--src/OS/os.c-IRIX120
-rw-r--r--src/OS/os.c-IRIX6120
-rw-r--r--src/OS/os.c-IRIX632120
-rw-r--r--src/OS/os.c-IRIX65120
-rw-r--r--src/OS/os.c-Linux155
-rw-r--r--src/OS/os.c-Linux-libc539
-rw-r--r--src/OS/os.c-OSF138
-rw-r--r--src/OS/os.c-cygwin652
-rw-r--r--src/OS/os.h-AIX25
-rw-r--r--src/OS/os.h-BSDI12
-rw-r--r--src/OS/os.h-DGUX27
-rw-r--r--src/OS/os.h-Darwin29
-rw-r--r--src/OS/os.h-FreeBSD12
-rw-r--r--src/OS/os.h-GNU20
-rw-r--r--src/OS/os.h-HI-OSF11
-rw-r--r--src/OS/os.h-HI-UX20
-rw-r--r--src/OS/os.h-HP-UX19
-rw-r--r--src/OS/os.h-HP-UX-922
-rw-r--r--src/OS/os.h-IRIX22
-rw-r--r--src/OS/os.h-IRIX621
-rw-r--r--src/OS/os.h-IRIX63223
-rw-r--r--src/OS/os.h-IRIX6521
-rw-r--r--src/OS/os.h-Linux39
-rw-r--r--src/OS/os.h-Linux-libc513
-rw-r--r--src/OS/os.h-NetBSD15
-rw-r--r--src/OS/os.h-NetBSD-a.out7
-rw-r--r--src/OS/os.h-OSF113
-rw-r--r--src/OS/os.h-OpenBSD15
-rw-r--r--src/OS/os.h-OpenUNIX18
-rw-r--r--src/OS/os.h-QNX23
-rw-r--r--src/OS/os.h-SCO20
-rw-r--r--src/OS/os.h-SCO_SV18
-rw-r--r--src/OS/os.h-SunOS438
-rw-r--r--src/OS/os.h-SunOS533
-rw-r--r--src/OS/os.h-SunOS5-hal13
-rw-r--r--src/OS/os.h-ULTRIX17
-rw-r--r--src/OS/os.h-UNIX_SV24
-rw-r--r--src/OS/os.h-USG18
-rw-r--r--src/OS/os.h-Unixware721
-rw-r--r--src/OS/os.h-cygwin53
-rw-r--r--src/OS/os.h-mips26
80 files changed, 4314 insertions, 0 deletions
diff --git a/src/OS/Makefile-AIX b/src/OS/Makefile-AIX
new file mode 100644
index 000000000..42659a6cd
--- /dev/null
+++ b/src/OS/Makefile-AIX
@@ -0,0 +1,26 @@
+# $Cambridge: exim/src/OS/Makefile-AIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for AIX
+# Written by Nick Waterman (nick@cimio.co.uk)
+
+# Note that the output of uname -m is probably not what Philip expected,
+# so you might end up with more build-AIX-random_number directories than
+# you expected if you have too many AIX boxes, but it seems to work... I
+# blame IBM.
+
+# Note that nowadays you have to pay extra for a compiler with AIX!
+
+CC=cc
+
+# This needs to be in here rather than os.h-AIX because of regexp stuff.
+# basically strchr is a #define, which means "extern char *strchr()"
+# ruins things. __STR31__ seems to get around this by magic. The AIX
+# include files are quite a confusing maze.
+
+CFLAGS = -D__STR31__
+
+# Needed for vfork() and vfork() only?
+
+LIBS = -lbsd
+
+# End
diff --git a/src/OS/Makefile-BSDI b/src/OS/Makefile-BSDI
new file mode 100644
index 000000000..10ea69895
--- /dev/null
+++ b/src/OS/Makefile-BSDI
@@ -0,0 +1,23 @@
+# $Cambridge: exim/src/OS/Makefile-BSDI,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for BSDI. Its antique link editor
+# cannot handle the TextPop overriding.
+
+CFLAGS=-O
+CHOWN_COMMAND=/usr/sbin/chown
+
+HAVE_SA_LEN=YES
+
+X11=/usr/X11
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib
+X11_LD_LIB=$(X11)/lib
+
+LIBS_EXIMON=-lSM -lICE -lipc
+EXIMON_TEXTPOP=
+
+EXIWHAT_PS_ARG=-ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_KILL_SIGNAL=-USR1
+
+# End
diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base
new file mode 100644
index 000000000..7a5cf2b43
--- /dev/null
+++ b/src/OS/Makefile-Base
@@ -0,0 +1,703 @@
+# $Cambridge: exim/src/OS/Makefile-Base,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# This file is the basis of the main makefile for Exim and friends. The
+# makefile at the top level arranges to build the main makefile by calling
+# scripts/Configure-Makefile from within the build directory. This
+# concatentates the configuration settings from Local/Makefile and other,
+# optional, Local/* files at the front of this file, to create Makefile in the
+# build directory.
+
+SHELL = $(MAKE_SHELL)
+SCRIPTS = ../scripts
+EDITME = ../Local/Makefile
+EXIMON_EDITME = ../Local/eximon.conf
+
+# The compiler used for linking is normally the same as the compiler used for
+# compiling. However, by giving it a different name, we can override it from
+# the command line, and this is helpful for certain types of testing.
+
+LNCC = $(CC)
+
+
+# The default target double-checks the existence of $(EDITME) and then arranges
+# to touch it if it exists and any of the optional configuration files, which
+# depend on the os or the architecture, have been altered. The same sub-target
+# does the same thing for the eximon configuration file if it exists. Then
+# there is a check that the Makefile (the one built from this file) is
+# up-to-date. Then the os-specific source files and the C configuration file
+# are set up, and finally it goes to the main Exim target.
+
+all: $(EDITME) checklocalmake Makefile os.h os.c config.h allexim
+
+checklocalmake:
+ @if $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE) $(EDITME) || \
+ $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(ARCHTYPE) $(EDITME) || \
+ $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE)-$(ARCHTYPE) $(EDITME); \
+ then \
+ touch $(EDITME); \
+ fi
+ @if $(SHELL) $(SCRIPTS)/newer $(EXIMON_EDITME)-$(OSTYPE) $(EXIMON_EDITME) || \
+ $(SHELL) $(SCRIPTS)/newer $(EXIMON_EDITME)-$(ARCHTYPE) $(EXIMON_EDITME) || \
+ $(SHELL) $(SCRIPTS)/newer $(EXIMON_EDITME)-$(OSTYPE)-$(ARCHTYPE) $(EXIMON_EDITME); \
+ then \
+ if [ -f $(EXIMON_EDITME) ]; then touch $(EXIMON_EDITME); fi \
+ fi
+
+$(EDITME):
+ @echo " "
+ @echo "*** Please create Local/Makefile by copying src/EDITME and making"
+ @echo "*** appropriate changes for your site."
+ @echo " "
+ @false
+
+$(EXIMON_EDITME):
+ @echo " "
+ @echo "*** Please create Local/eximon.conf by copying exim_monitor/EDITME and making"
+ @echo "*** appropriate changes for your site."
+ @echo " "
+ @test ! -d ../Local && mkdir ../Local
+ @false
+
+# Check that the local Makefile is up-to-date
+
+Makefile: ../OS/Makefile-Base ../OS/Makefile-Default \
+ $(SCRIPTS)/Configure $(SCRIPTS)/Configure-Makefile $(EDITME)
+ @echo " "
+ @echo "*** Makefile needs rebuilding"
+ @echo "*** Please run \"make makefile\" at top level"
+ @echo " "
+ @false
+
+# Build (link) the os.h file
+
+os.h:
+ $(SHELL) $(SCRIPTS)/Configure-os.h
+
+# Build the os.c file
+
+os.c: ../src/os.c
+ $(SHELL) $(SCRIPTS)/Configure-os.c
+
+# Build the config.h file.
+
+config.h: Makefile buildconfig ../src/config.h.defaults $(EDITME)
+ $(SHELL) $(SCRIPTS)/Configure-config.h
+
+
+# This target is recognized specially by GNU make. It records those targets
+# that do not correspond to files that are being built and which should
+# therefore always be run, even if the files exist. This shouldn't in fact be a
+# problem, but it does no harm. Other make programs will just ignore this.
+
+.PHONY: all allexim buildauths buildlookups buildpcre buildrouters \
+ buildtransports checklocalmake clean
+
+
+# This is the real default target for all the various exim binaries and
+# scripts, once the configuring stuff is done.
+
+allexim: config.h buildpcre $(EXIM_MONITOR) exicyclog exinext exiwhat \
+ exigrep eximstats exipick exiqgrep exiqsumm \
+ transport-filter.pl convert4r3 convert4r4 \
+ exim_checkaccess \
+ exim_dbmbuild exim_dumpdb exim_fixdb exim_tidydb exim_lock \
+ buildlookups buildrouters buildtransports \
+ buildauths exim
+
+
+# Targets for special-purpose configuration header builders
+buildconfig: buildconfig.c
+ $(CC) $(CFLAGS) $(INCLUDE) -o buildconfig buildconfig.c $(LIBS)
+
+
+# Target for the exicyclog utility script
+exicyclog: Makefile config.h ../src/exicyclog.src
+ @rm -f exicyclog
+ sed \
+ -e "s?PROCESSED_FLAG?This file has been so processed.?"\
+ -e "/^# /p" \
+ -e "/^# /d" \
+ -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
+ -e "s?CONFIGURE_FILE_USE_EUID?$(CONFIGURE_FILE_USE_EUID)?" \
+ -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
+ -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
+ -e "s?EXICYCLOG_MAX?$(EXICYCLOG_MAX)?" \
+ -e "s?COMPRESS_COMMAND?$(COMPRESS_COMMAND)?" \
+ -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \
+ -e "s?CHOWN_COMMAND?$(CHOWN_COMMAND)?" \
+ -e "s?CHGRP_COMMAND?$(CHGRP_COMMAND)?" \
+ -e "s?MV_COMMAND?$(MV_COMMAND)?" \
+ -e "s?RM_COMMAND?$(RM_COMMAND)?" \
+ ../src/exicyclog.src > exicyclog-t
+ @mv exicyclog-t exicyclog
+ @chmod a+x exicyclog
+ @echo ">>> exicyclog script built"; echo ""
+
+# Target for the exinext utility script
+exinext: Makefile config.h ../src/exinext.src
+ @rm -f exinext
+ sed \
+ -e "s?PROCESSED_FLAG?This file has been so processed.?"\
+ -e "/^# /p" \
+ -e "/^# /d" \
+ -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
+ -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
+ -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
+ ../src/exinext.src > exinext-t
+ @mv exinext-t exinext
+ @chmod a+x exinext
+ @echo ">>> exinext script built"; echo ""
+
+# Target for the exiwhat utility script
+exiwhat: Makefile config.h ../src/exiwhat.src
+ @rm -f exiwhat
+ sed \
+ -e "s?PROCESSED_FLAG?This file has been so processed.?"\
+ -e "/^# /p" \
+ -e "/^# /d" \
+ -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
+ -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
+ -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
+ -e "s?EXIWHAT_PS_CMD?$(EXIWHAT_PS_CMD)?" \
+ -e "s?EXIWHAT_PS_ARG?$(EXIWHAT_PS_ARG)?" \
+ -e "s?EXIWHAT_KILL_SIGNAL?$(EXIWHAT_KILL_SIGNAL)?" \
+ -e "s?EXIWHAT_EGREP_ARG?$(EXIWHAT_EGREP_ARG)?" \
+ -e "s?EXIWHAT_MULTIKILL_CMD?$(EXIWHAT_MULTIKILL_CMD)?" \
+ -e "s?EXIWHAT_MULTIKILL_ARG?$(EXIWHAT_MULTIKILL_ARG)?" \
+ ../src/exiwhat.src > exiwhat-t
+ @mv exiwhat-t exiwhat
+ @chmod a+x exiwhat
+ @echo ">>> exiwhat script built"; echo ""
+
+# Target for the exim_checkaccess utility script
+exim_checkaccess: Makefile config.h ../src/exim_checkaccess.src
+ @rm -f exim_checkaccess
+ sed \
+ -e "s?PROCESSED_FLAG?This file has been so processed.?"\
+ -e "/^# /p" \
+ -e "/^# /d" \
+ -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
+ -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
+ -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
+ -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+ ../src/exim_checkaccess.src > exim_checkaccess-t
+ @mv exim_checkaccess-t exim_checkaccess
+ @chmod a+x exim_checkaccess
+ @echo ">>> exim_checkaccess script built"; echo ""
+
+# Target for the Exim monitor start-up script
+eximon: Makefile config.h ../src/eximon.src ../OS/eximon.conf-Default \
+ ../Local/eximon.conf
+ @rm -f eximon
+ $(SHELL) $(SCRIPTS)/Configure-eximon
+ sed \
+ -e "s?PROCESSED_FLAG?This file has been so processed.?"\
+ -e "/^# /p" \
+ -e "/^# /d" \
+ -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
+ -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
+ -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
+ -e "s?BASENAME_COMMAND?$(BASENAME_COMMAND)?" \
+ -e "s?HOSTNAME_COMMAND?$(HOSTNAME_COMMAND)?" \
+ -e "s?X11_LD_LIBRARY?$(X11_LD_LIB)?" \
+ ../src/eximon.src >> eximon
+ @echo ">>> eximon script built"; echo ""
+
+# Targets for utilities; these are all Perl scripts that have to get the
+# location of Perl put in them. A few need other things as well.
+
+exigrep: Makefile ../src/exigrep.src
+ @rm -f exigrep
+ sed \
+ -e "s?PROCESSED_FLAG?This file has been so processed.?"\
+ -e "/^# /p" \
+ -e "/^# /d" \
+ -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+ -e "s?ZCAT_COMMAND?$(ZCAT_COMMAND)?" \
+ -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \
+ ../src/exigrep.src > exigrep-t
+ @mv exigrep-t exigrep
+ @chmod a+x exigrep
+ @echo ">>> exigrep script built"; echo ""
+
+eximstats: Makefile ../src/eximstats.src
+ @rm -f eximstats
+ sed \
+ -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+ ../src/eximstats.src > eximstats-t
+ @mv eximstats-t eximstats
+ @chmod a+x eximstats
+ @echo ">>> eximstats script built"; echo ""
+
+exiqgrep: Makefile ../src/exiqgrep.src
+ @rm -f exiqgrep
+ sed \
+ -e "s?PROCESSED_FLAG?This file has been so processed.?"\
+ -e "/^# /p" \
+ -e "/^# /d" \
+ -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
+ -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+ ../src/exiqgrep.src > exiqgrep-t
+ @mv exiqgrep-t exiqgrep
+ @chmod a+x exiqgrep
+ @echo ">>> exiqgrep script built"; echo ""
+
+exiqsumm: Makefile ../src/exiqsumm.src
+ @rm -f exiqsumm
+ sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+ ../src/exiqsumm.src > exiqsumm-t
+ @mv exiqsumm-t exiqsumm
+ @chmod a+x exiqsumm
+ @echo ">>> exiqsumm script built"; echo ""
+
+exipick: Makefile ../src/exipick.src
+ @rm -f exipick
+ sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+ -e "s?SPOOL_DIRECTORY?$(SPOOL_DIRECTORY)?" \
+ ../src/exipick.src > exipick-t
+ @mv exipick-t exipick
+ @chmod a+x exipick
+ @echo ">>> exipick script built"; echo ""
+
+transport-filter.pl: Makefile ../src/transport-filter.src
+ @rm -f transport-filter.pl
+ sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+ ../src/transport-filter.src > transport-filter.pl-t
+ @mv transport-filter.pl-t transport-filter.pl
+ @chmod a+x transport-filter.pl
+ @echo ">>> transport-filter.pl script built"; echo ""
+
+convert4r3: Makefile ../src/convert4r3.src
+ @rm -f convert4r3
+ sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+ ../src/convert4r3.src > convert4r3-t
+ @mv convert4r3-t convert4r3
+ @chmod a+x convert4r3
+ @echo ">>> convert4r3 script built"; echo ""
+
+convert4r4: Makefile ../src/convert4r4.src
+ @rm -f convert4r4
+ sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+ ../src/convert4r4.src > convert4r4-t
+ @mv convert4r4-t convert4r4
+ @chmod a+x convert4r4
+ @echo ">>> convert4r4 script built"; echo ""
+
+
+# Targets for final binaries; the main one has a build number which is
+# updated each time. We don't bother with that for the auxiliaries.
+
+OBJ_EXIM = acl.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
+ directory.o dns.o drtables.o enq.o exim.o expand.o filter.o \
+ filtertest.o globals.o \
+ header.o host.o ip.o log.o lss.o match.o moan.o \
+ os.o parse.o queue.o \
+ rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o \
+ route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
+ store.o string.o tls.o tod.o transport.o tree.o verify.o \
+ local_scan.o $(EXIM_PERL)
+
+exim: pcre/libpcre.a lookups/lookups.a auths/auths.a \
+ routers/routers.a transports/transports.a \
+ $(OBJ_EXIM) version.c
+ @echo " "
+ awk '{ print ($$1+1) }' cnumber.h > cnumber.temp
+ rm -f cnumber.h; mv cnumber.temp cnumber.h
+ $(CC) -c $(CFLAGS) $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) version.c
+ rm -f exim
+ $(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
+ pcre/libpcre.a \
+ routers/routers.a transports/transports.a lookups/lookups.a \
+ auths/auths.a \
+ $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \
+ $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \
+ $(PERL_LIBS) $(TLS_LIBS)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim; \
+ $(STRIP_COMMAND) exim; \
+ fi
+ $(EXIM_CHMOD)
+ @echo " "
+ @echo ">>> exim binary built"
+ @echo " "
+
+# The utility for dumping the contents of an exim database
+
+OBJ_DUMPDB = exim_dumpdb.o util-os.o util-store.o
+
+exim_dumpdb: $(OBJ_DUMPDB)
+ $(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LFLAGS) $(OBJ_DUMPDB) \
+ $(LIBS) $(EXTRALIBS) $(DBMLIB)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim_dumpdb; \
+ $(STRIP_COMMAND) exim_dumpdb; \
+ fi
+ @echo " "
+ @echo ">>> exim_dumpdb utility built"
+ @echo " "
+
+# The utility for interrogating/fixing the contents of an exim database
+
+OBJ_FIXDB = exim_fixdb.o util-os.o util-store.o
+
+exim_fixdb: $(OBJ_FIXDB)
+ $(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \
+ $(LIBS) $(EXTRALIBS) $(DBMLIB)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim_fixdb; \
+ $(STRIP_COMMAND) exim_fixdb; \
+ fi
+ @echo " "
+ @echo ">>> exim_fixdb utility built"
+ @echo " "
+
+# The utility for tidying the contents of an exim database
+
+OBJ_TIDYDB = exim_tidydb.o util-os.o util-store.o
+
+exim_tidydb: $(OBJ_TIDYDB)
+ $(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LFLAGS) $(OBJ_TIDYDB) \
+ $(LIBS) $(EXTRALIBS) $(DBMLIB)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim_tidydb; \
+ $(STRIP_COMMAND) exim_tidydb; \
+ fi
+ @echo " "
+ @echo ">>> exim_tidydb utility built"
+ @echo " "
+
+# The utility for building dbm files
+
+exim_dbmbuild: exim_dbmbuild.o
+ $(LNCC) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \
+ $(LIBS) $(EXTRALIBS) $(DBMLIB)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim_dbmbuild; \
+ $(STRIP_COMMAND) exim_dbmbuild; \
+ fi
+ @echo " "
+ @echo ">>> exim_dbmbuild utility built"
+ @echo " "
+
+# The utility for locking a mailbox while messing around with it
+
+exim_lock: exim_lock.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c
+ $(LNCC) -o exim_lock $(LFLAGS) exim_lock.o \
+ $(LIBS) $(EXTRALIBS)
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) exim_lock; \
+ $(STRIP_COMMAND) exim_lock; \
+ fi
+ @echo " "
+ @echo ">>> exim_lock utility built"
+ @echo " "
+
+# The X-based Exim monitor program's binary part. There's a macro for cutting
+# out the modified TextPop module, because some antique link editors cannot
+# handle the fact that it is redefining things that are found later in the
+# Xaw library.
+
+# Object modules that are the unique Eximon modules
+
+MONBIN = em_StripChart.o $(EXIMON_TEXTPOP) em_globals.o em_init.o \
+ em_log.o em_main.o em_menu.o em_queue.o em_strip.o \
+ em_text.o em_xs.o
+
+# The complete modules list also includes some specially compiled versions of
+# code from the main Exim source tree.
+
+OBJ_MONBIN = util-spool_in.o util-store.o util-string.o tod.o tree.o $(MONBIN)
+
+eximon.bin: $(EXIMON_EDITME) eximon $(OBJ_MONBIN) pcre/libpcre.a \
+ ../exim_monitor/em_version.c
+ $(CC) -o em_version.o -c \
+ $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c
+ $(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \
+ $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 pcre/libpcre.a \
+ $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc
+ @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
+ echo $(STRIP_COMMAND) eximon.bin; \
+ $(STRIP_COMMAND) eximon.bin; \
+ fi
+ @echo " "
+ @echo ">>> exim monitor binary built"
+ @echo " "
+
+
+# Compile step for most of the exim modules. HDRS is a list of headers
+# which cause everthing to be rebuilt. PHDRS is the same, for the use
+# of routers, transports, and authenticators. I can't find a way of doing this
+# in one. This list is overkill, but it doesn't really take much time to
+# rebuild Exim on a modern computer.
+
+HDRS = config.h dbfunctions.h dbstuff.h exim.h functions.h globals.h local_scan.h macros.h mytypes.h structs.h
+PHDRS = ../config.h ../dbfunctions.h ../dbstuff.h ../exim.h ../functions.h ../globals.h ../local_scan.h ../macros.h ../mytypes.h ../structs.h
+
+.SUFFIXES: .o .c
+.c.o:; $(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c
+
+# This is the dummy module for use by test compiles of individual modules. It
+# contains functions such as log_write() that may be called from bits of Exim
+# in the tested code.
+
+dummies.o: dummies.c
+
+# Compile instructions for perl.o for when EXIM_PERL is set
+
+perl.o: $(HDRS) perl.c
+ $(PERL_CC) $(PERL_CCOPTS) $(INCLUDE) -c perl.c
+
+# Compile instructions for the database utility modules
+
+exim_dumpdb.o: $(HDRS) exim_dbutil.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) \
+ -DCOMPILE_UTILITY \
+ -DEXIM_DUMPDB \
+ -o exim_dumpdb.o exim_dbutil.c
+
+exim_fixdb.o: $(HDRS) exim_dbutil.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) \
+ -DCOMPILE_UTILITY \
+ -DEXIM_FIXDB \
+ -o exim_fixdb.o exim_dbutil.c
+
+exim_tidydb.o: $(HDRS) exim_dbutil.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) \
+ -DCOMPILE_UTILITY \
+ -DEXIM_TIDYDB \
+ -o exim_tidydb.o exim_dbutil.c
+
+# Compile instructions for exim_dbmbuild
+
+exim_dbmbuild.o: $(HDRS) exim_dbmbuild.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) -o exim_dbmbuild.o exim_dbmbuild.c
+
+# Utilities use special versions of some modules - typically with debugging
+# calls cut out.
+
+util-spool_in.o: $(HDRS) spool_in.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-spool_in.o spool_in.c
+
+util-store.o: $(HDRS) store.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-store.o store.c
+
+util-string.o: $(HDRS) string.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-string.o string.c
+
+util-os.o: $(HDRS) os.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) \
+ -DCOMPILE_UTILITY \
+ -DOS_LOAD_AVERAGE \
+ -DFIND_RUNNING_INTERFACES \
+ -o util-os.o os.c
+
+# The local scan module depends only on its own special header, and is compiled
+# from a source whose location is set by configuration.
+
+local_scan.o: Makefile local_scan.h ../$(LOCAL_SCAN_SOURCE)
+ $(CC) -c $(CFLAGS) -I. $(INCLUDE) -o local_scan.o ../$(LOCAL_SCAN_SOURCE)
+
+# Dependencies for the "ordinary" exim modules
+
+acl.o: $(HDRS) acl.c
+child.o: $(HDRS) child.c
+crypt16.o: $(HDRS) crypt16.c
+daemon.o: $(HDRS) daemon.c
+dbfn.o: $(HDRS) dbfn.c
+debug.o: $(HDRS) debug.c
+deliver.o: $(HDRS) deliver.c
+directory.o: $(HDRS) directory.c
+dns.o: $(HDRS) dns.c
+enq.o: $(HDRS) enq.c
+exim.o: $(HDRS) exim.c
+expand.o: $(HDRS) expand.c
+filter.o: $(HDRS) filter.c
+filtertest.o: $(HDRS) filtertest.c
+globals.o: $(HDRS) globals.c
+header.o: $(HDRS) header.c
+host.o: $(HDRS) host.c
+ip.o: $(HDRS) ip.c
+log.o: $(HDRS) log.c
+lss.o: $(HDRS) lss.c
+match.o: $(HDRS) match.c
+moan.o: $(HDRS) moan.c
+os.o: $(HDRS) os.c
+parse.o: $(HDRS) parse.c
+queue.o: $(HDRS) queue.c
+rda.o: $(HDRS) rda.c
+readconf.o: $(HDRS) readconf.c
+receive.o: $(HDRS) receive.c
+retry.o: $(HDRS) retry.c
+rewrite.o: $(HDRS) rewrite.c
+rfc2047.o: $(HDRS) rfc2047.c
+route.o: $(HDRS) route.c
+search.o: $(HDRS) search.c
+sieve.o: $(HDRS) sieve.c
+smtp_in.o: $(HDRS) smtp_in.c
+smtp_out.o: $(HDRS) smtp_out.c
+spool_in.o: $(HDRS) spool_in.c
+spool_out.o: $(HDRS) spool_out.c
+store.o: $(HDRS) store.c
+string.o: $(HDRS) string.c
+tls.o: $(HDRS) tls.c tls-gnu.c tls-openssl.c
+tod.o: $(HDRS) tod.c
+transport.o: $(HDRS) transport.c
+tree.o: $(HDRS) tree.c
+verify.o: $(HDRS) verify.c
+
+# The module containing tables of available lookups, routers, auths, and
+# transports must be rebuilt if any of them are. However, because the makefiles
+# for the drivers are always run, we don't actually put the dependencies here,
+# because if we do, some version of "make" (e.g. IRIX) insist on rebuilding
+# drtables.o even though the .a files haven't in fact been updated. Instead
+# it is arranged that the lower-level makefiles remove drtables.o when they
+# rebuild the .a files.
+
+drtables.o: $(HDRS) drtables.c
+
+
+# The exim monitor's private modules - the sources live in a private
+# subdirectory. The final binary combines the private modules with some
+# modules from the main exim binary.
+
+em_StripChart.o: ../exim_monitor/em_StripChart.c
+em_TextPop.o: ../exim_monitor/em_TextPop.c
+em_globals.o: ../exim_monitor/em_globals.c ../exim_monitor/em_hdr.h
+em_init.o: ../exim_monitor/em_init.c ../exim_monitor/em_hdr.h
+em_log.o: ../exim_monitor/em_log.c ../exim_monitor/em_hdr.h
+em_main.o: ../exim_monitor/em_main.c ../exim_monitor/em_hdr.h
+em_menu.o: ../exim_monitor/em_menu.c ../exim_monitor/em_hdr.h
+em_queue.o: ../exim_monitor/em_queue.c ../exim_monitor/em_hdr.h
+em_strip.o: ../exim_monitor/em_strip.c ../exim_monitor/em_hdr.h
+em_text.o: ../exim_monitor/em_text.c ../exim_monitor/em_hdr.h
+em_xs.o: ../exim_monitor/em_xs.c ../exim_monitor/em_hdr.h
+em_version.o: ../exim_monitor/em_version.c ../exim_monitor/em_hdr.h
+$(MONBIN): $(HDRS)
+ $(CC) -o $@ -c $(CFLAGS) -I. -I../exim_monitor $(INCLUDE) $(XINCLUDE) \
+ ../exim_monitor/`echo $@ | sed 's/o$$/c/'`
+
+
+# Targets for the various libraries that Exim uses. This coding is tedious,
+# because different versions of "make" behave in different ways with regard
+# to rebuilding. If these target names are of the form pcre/libpcre.a, for
+# example, then a forcing mechanism is required to get them obeyed each time.
+# That's fine on Solaris and other systems; the rebuilding of the exim target
+# happens only if the libraries are actually rebuilt. However, on IRIX, if
+# the target is forced, the exim target gets unnecessarily rebuilt even if
+# the .a file is not. Contrariwise, if we use dummy names, they don't interact
+# with the building of exim (and eximon.bin), but for libpcre Exim doesn't get
+# rebuilt when it should. (For the others it does, because they remove
+# drtables.o when they rebuild.) To get round this, we forcibly remove the
+# binary when it needs to be rebuilt.
+
+# The PCRE regex library. Move the pcretest program to the util directory. Some
+# "clever" versions of make notice that there are two successive shell
+# commands, and they run them in the same shell. This means that we have to
+# take care to encapsulate change of directory in parentheses, so that it
+# reverts when it should.
+
+buildpcre:
+ @(cd pcre; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" \
+ CFLAGS="$(CFLAGS) $(PCRE_CFLAGS)" \
+ RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
+ INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)")
+ @if $(SHELL) $(SCRIPTS)/newer pcre/libpcre.a exim; then \
+ rm -f exim eximon.bin; fi
+
+# The lookups library.
+
+buildlookups:
+ @cd lookups; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
+ RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
+ INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"; \
+ echo " "
+
+# The routers library.
+
+buildrouters:
+ @cd routers; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
+ RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
+ INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
+ echo " "
+
+# The transports library.
+
+buildtransports:
+ @cd transports; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
+ RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
+ INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
+ echo " "
+
+# The library of authorization modules
+
+buildauths:
+ @cd auths; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
+ RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
+ INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
+ echo " "
+
+# The "clean", "install", and "makefile" targets just pass themselves back to
+# the main Exim makefile. These targets will be obeyed only if "make" is obeyed
+# for them in the build directory.
+
+clean install makefile:; cd ..; $(MAKE) $(MFLAGS) build=$(build) $@
+
+# Targets for building stand-alone testing programs for basic testing of
+# some of the building blocks. These are not integrated with the makefile-
+# building targets. If you change something that is going to cause the
+# makefile to be rebuilt, you must run "make makefile" before running one
+# of these.
+
+# The testing programs use different versions of some modules - usually
+# with bits cut out that are not relevant to the test in hand. For those
+# that are used by several tests, we use a different name.
+
+sa-globals.o: $(HDRS) globals.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -o sa-globals.o globals.c
+
+sa-os.o: $(HDRS) os.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) \
+ -DFIND_RUNNING_INTERFACES \
+ -o sa-os.o os.c
+
+# These are the test targets themselves
+
+test_dbfn: config.h dbfn.c dummies.o sa-globals.o sa-os.o store.o \
+ string.o tod.o version.o
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c
+ $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \
+ dummies.o sa-globals.o sa-os.o store.o string.o \
+ tod.o version.o $(LIBS) $(DBMLIB)
+ rm -f dbfn.o
+
+test_host: config.h host.c dns.c dummies.o sa-globals.o sa-os.o store.o \
+ string.o tod.o tree.o
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c
+ $(LNCC) -o test_host $(LFLAGS) \
+ host.o dns.o dummies.o sa-globals.o os.o store.o string.o tod.o tree.o \
+ $(LIBS) $(LIBRESOLV)
+ rm -f dummies.o host.o dns.o
+
+test_os: os.h os.c dummies.o sa-globals.o store.o string.o tod.o
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c
+ $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \
+ sa-globals.o store.o string.o tod.o $(LIBS)
+ rm -f os.o
+
+test_parse: config.h parse.c dummies.o sa-globals.o \
+ store.o string.o tod.o version.o
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c
+ $(LNCC) -o test_parse $(LFLAGS) parse.o \
+ dummies.o sa-globals.o store.o string.o tod.o version.o
+ rm -f parse.o
+
+test_string: config.h string.c dummies.o sa-globals.o store.o tod.o
+ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c
+ $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \
+ dummies.o sa-globals.o store.o tod.o $(LIBS)
+ rm -f string.o
+
+# End
diff --git a/src/OS/Makefile-CYGWIN b/src/OS/Makefile-CYGWIN
new file mode 100644
index 000000000..e9b7a9ee7
--- /dev/null
+++ b/src/OS/Makefile-CYGWIN
@@ -0,0 +1,113 @@
+# $Cambridge: exim/src/OS/Makefile-CYGWIN,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# OS-specific file for Cygwin.
+
+# This file provided by Pierre A. Humblet <Pierre.Humblet@ieee.org>
+
+HAVE_ICONV = yes
+CFLAGS= -g -Wall -O2
+LIBS= -lcrypt -lresolv
+LIBS_EXIM= -liconv
+EXIWHAT_PS_ARG=-as
+EXIWHAT_KILL_SIGNAL=-USR1
+EXIWHAT_EGREP_ARG='/(EXIM|exim)[0-9. -]*$$'
+
+DBMLIB=-lgdbm
+USE_GDBM=YES
+
+# Some OS add a suffix to executables
+EXE = .exe
+
+# To add a resource file with an icon
+LIBS_EXIM +=../Local/exim_res.o
+
+# To produce a linker map
+#LIBS_EXIM+=-Wl,-Map,Exim.Map
+
+
+##################################################
+# The following is normaly set in local/Makefile.
+# Makefile.cygwin provides defaults with which the
+# precompiled version is built
+##################################################
+
+BIN_DIRECTORY=/usr/bin
+CONFIGURE_FILE=/etc/exim.conf
+EXIM_USER=18 # This changes if user exim exists
+EXIM_GROUP=544 # Administrators
+SPOOL_DIRECTORY=/var/spool/exim
+LOG_FILE_PATH=/var/log/exim/exim_%s.log
+TIMEZONE_DEFAULT = ""
+
+AUTH_CRAM_MD5=yes
+AUTH_PLAINTEXT=yes
+AUTH_SPA=yes
+
+SUPPORT_TLS=yes
+TLS_LIBS=-lssl -lcrypto
+
+ROUTER_ACCEPT=yes
+ROUTER_DNSLOOKUP=yes
+ROUTER_IPLITERAL=yes
+ROUTER_MANUALROUTE=yes
+ROUTER_QUERYPROGRAM=yes
+ROUTER_REDIRECT=yes
+
+TRANSPORT_APPENDFILE=yes
+TRANSPORT_AUTOREPLY=yes
+TRANSPORT_PIPE=yes
+TRANSPORT_SMTP=yes
+
+SUPPORT_MAILDIR=yes
+SUPPORT_MAILSTORE=yes
+SUPPORT_MBX=yes
+
+LOOKUP_DBM=yes
+LOOKUP_LSEARCH=yes
+
+# LOOKUP_CDB=yes
+LOOKUP_DNSDB=yes
+# LOOKUP_DSEARCH=yes
+# LOOKUP_LDAP=yes
+# LOOKUP_MYSQL=yes
+# LOOKUP_NIS=yes
+# LOOKUP_NISPLUS=yes
+# LOOKUP_ORACLE=yes
+LOOKUP_PASSWD=yes
+# LOOKUP_PGSQL=yes
+# LOOKUP_WHOSON=yes
+
+# It is important to define this variable but its value is always overridden
+CONFIGURE_OWNER=544
+
+EXICYCLOG_MAX=10
+
+COMPRESS_COMMAND=/usr/bin/gzip
+COMPRESS_SUFFIX=gz
+ZCAT_COMMAND=/usr/bin/zcat
+
+# EXIM_PERL=perl.o
+
+# Comment the two lines below if you do not have PAM, e.g. from
+# ftp://ftp.uni-erlangen.de/pub/pc/gnuwin32/cygwin/porters/Humblet_Pierre_A
+SUPPORT_PAM=yes
+CFLAGS += -DINCLUDE_PAM -I ../pam -I ../../pam
+
+APPENDFILE_MODE = 0644 # default if no ntsec
+APPENDFILE_DIRECTORY_MODE = 0777
+APPENDFILE_LOCKFILE_MODE = 0666
+EXIMDB_DIRECTORY_MODE = 0777
+EXIMDB_MODE = 0666
+EXIMDB_LOCKFILE_MODE = 0666
+INPUT_DIRECTORY_MODE = 0777
+LOG_DIRECTORY_MODE = 0777
+LOG_MODE = 0666
+MSGLOG_DIRECTORY_MODE = 0777
+SPOOL_DIRECTORY_MODE = 0777
+SPOOL_MODE = 0666
+
+# PERL_CC=gcc -g -O2 -I ../minires
+# PERL_CCOPTS= -dD -save-temps -I ../minires
+# PERL_LIBS = /usr/lib/perl5/5.6.1/cygwin-multi/auto/DynaLoader/DynaLoader.a -L/usr/lib/perl5/5.6.1/cygwin-multi/CORE -llibperl5_6_1
+
+# End
diff --git a/src/OS/Makefile-DGUX b/src/OS/Makefile-DGUX
new file mode 100644
index 000000000..4f0439b93
--- /dev/null
+++ b/src/OS/Makefile-DGUX
@@ -0,0 +1,33 @@
+# $Cambridge: exim/src/OS/Makefile-DGUX,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for DGUX
+#
+# Written by Ken Bailey (K.Bailey@rbgkew.org.uk) Feb 1998
+# on dgux R4.11MU04 generic AViiON mc88100
+# with no X
+
+# Minor tidies to remove settings that are actually the default,
+# in line with the style of other system files - PH.
+
+BASENAME_COMMAND=/bin/basename
+CHOWN_COMMAND=/bin/chown
+CHGRP_COMMAND=/bin/chgrp
+
+# PERL
+# Perl is not necessary for running Exim itself, but some Perl utilities
+# are provided for processing the logs. Perl 5 is assumed.
+# DG ship perl version 4.036 in /bin/perl so need to use locally installed perl
+
+PERL_COMMAND=/usr/local/bin/perl
+
+# dg's version of gcc likes O2
+
+CFLAGS=-O2
+
+RANLIB=@true
+LIBS=-lsocket -lnsl
+LIBRESOLV=-lresolv
+DBMLIB=-ldbm
+
+# End
+
diff --git a/src/OS/Makefile-Darwin b/src/OS/Makefile-Darwin
new file mode 100644
index 000000000..6b8cdc8a6
--- /dev/null
+++ b/src/OS/Makefile-Darwin
@@ -0,0 +1,26 @@
+# $Cambridge: exim/src/OS/Makefile-Darwin,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for Darwin (Mac OS X).
+
+CC=cc
+
+BASENAME_COMMAND=look_for_it
+CHOWN_COMMAND=/usr/sbin/chown
+
+HAVE_SA_LEN=YES
+
+CFLAGS=-O -no-cpp-precomp -DBIND_8_COMPAT
+
+USE_DB = yes
+DBMLIB =
+
+X11=/usr/X11R6
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib
+X11_LD_LIB=$(X11)/lib
+
+EXIWHAT_PS_ARG=ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_KILL_SIGNAL=-USR1
+
+# End
diff --git a/src/OS/Makefile-Default b/src/OS/Makefile-Default
new file mode 100644
index 000000000..5e0640568
--- /dev/null
+++ b/src/OS/Makefile-Default
@@ -0,0 +1,332 @@
+# $Cambridge: exim/src/OS/Makefile-Default,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+##################################################
+# The Exim mail transport agent #
+##################################################
+
+# Generic default make file containing settings that relate to the OS or
+# to selectable features within the OS. The configuration options for Exim
+# itself live in Local/Makefile, which is constructed by editing src/EDITME.
+
+# These settings are basic defaults which may be overridden, either by the
+# generic OS-specific files, or by site-specific files. Do not edit this file.
+# Instead, edit or create suitable OS-specific and/or site specific files.
+# See the manual for details.
+
+
+# MAKE_SHELL contains the name of the shell to be used for executing commands
+# from the make files. Normally /bin/sh should be used.
+
+MAKE_SHELL=/bin/sh
+
+
+# BASENAME_COMMAND contains the path to the "basename" command, which varies
+# from OS to OS. This is used when building the Exim monitor script only. (See
+# also HOSTNAME_COMMAND.) If BASENAME_COMMAND is set to "look_for_it" then the
+# script checks for /usr/bin/basename and /bin/basename, and if neither is
+# found, it uses /usr/ucb/basename. This copes with Solaris 2 and Linux, both
+# of which come in different versions.
+
+BASENAME_COMMAND=/usr/bin/basename
+
+
+# If you set STRIP_COMMAND to the path of the "strip" command, it will be run
+# on every binary that is built. It is left unset by default, which leaves
+# the binaries unstripped.
+
+# STRIP_COMMAND=/usr/bin/strip
+
+
+# Some of the following commands live in different places in different OS. We
+# include them all here for generality.
+
+CHOWN_COMMAND=/usr/bin/chown
+CHGRP_COMMAND=/usr/bin/chgrp
+MV_COMMAND=/bin/mv
+RM_COMMAND=/bin/rm
+
+
+# Some operating systems have different ways of building libraries of
+# functions. This macro defines the command to do this, defaulting to
+# the "ar" command with options "cq".
+
+AR=ar cq
+
+
+# Not all operating systems have the iconv() function. Those that do have
+#
+# HAVE_ICONV=yes
+#
+# in their OS-specific Makefiles. On those that don't it is possible to
+# install an independent implementation of iconv(). If you've done this,
+# add "HAVE_ICONV=yes" to your Local/Makefile.
+
+
+# Perl is not necessary for running Exim itself, except when EXIM_PERL
+# is set to cause Perl embedding. However, some Perl utilities are provided
+# for processing the logs. Perl 5 is assumed.
+
+PERL_COMMAND=/usr/bin/perl
+
+
+# CC contains the name of the C compiler to be used.
+
+CC=gcc
+
+
+# CFLAGS contains flags to be passed to the compiler. Nothing is defaulted
+# here; instead each OS-dependent Makefile contains a default setting.
+
+# CFLAGS=-O
+
+
+# LFLAGS contains flags to be passed to the link editor. Nothing is defaulted
+# here; instead each OS-dependent Makefile contains a default setting if one
+# is needed.
+
+# LFLAGS=
+
+
+# LIBS and EXTRALIBS contain library settings that are used on linking
+# commands to build binaries. The OS-dependent Makefile may contain a default
+# setting for LIBS, leaving EXTRALIBS available for adding further libraries
+# that are required for optional extras.
+
+# LIBS=
+# EXTRALIBS=
+
+
+# LIBS_EXIM and EXTRALIBS_EXIM contain library settings that are used
+# only when linking the Exim binary. They are not used for other binaries.
+# One possible use is for the TCP wrappers library.
+
+# LIBS_EXIM=
+# EXTRALIBS_EXIM=
+
+
+# LIBS_EXIMON and EXTRALIBS_EXIMON contain library settings that are
+# used only when linking the Exim monitor binary. They are not used for
+# other binaries.
+
+# LIBS_EXIMON=
+# EXTRALIBS_EXIMON=
+
+
+# PCRE_CFLAGS contains flags to be passed to the CFLAGS parameter of the
+# makefile for building the PCRE regular expression library, in addition
+# to CFLAGS. Typical use is to set -DUSE_BCOPY on legacy systems that lack
+# the memmove() function but do have bcopy().
+
+# PCRE_CFLAGS=
+
+
+# The error name for quota exceeded varies among operating systems, and
+# even, unfortunately, in different versions of the same operating system.
+# EDQUOT was not in Sys V, but is in SPEC 1170, apparently. It was used
+# in SunOS4, but got taken out for SunOS5, where ENOSPC was given if a quota
+# was exceeded. However, it got put back into SunOS5 with a patch to 5.4 in
+# order to comply with SPEC 1170. Thus even different patch levels of the same
+# system (SunOS5) may use different numbers.
+#
+# If you don't have quotas or are not interested in handling quota errors
+# specially, just set this variable to 0. If it is not set, it defaults to
+# EDQUOT if that is defined for the OS; otherwise it defaults to ENOSPC.
+
+# ERRNO_QUOTA=EDQUOT
+
+
+# The exiwhat utility script finds all the processes running Exim, and sends
+# them a SIGUSR1 signal to get them to write their status to a file. There are
+# two ways in which this can be done:
+#
+# (1) If the OS has a command to find processes and signal them, that can be
+# used. Linux has "killall"; Solaris has "pkill". (Note: "killall" on Solaris
+# does something very different - and disastrous.) The following are set in the
+# OS-specific Makefiles for those OS where this can be done:
+
+# EXIWHAT_MULTIKILL_CMD=
+# EXIWHAT_MULTIKILL_ARG=
+
+# (2) For other operating systems, exiwhat calls the ps command and egreps the
+# output in order to find all the processes running Exim. The arguments for the
+# various commands needed to do this vary from OS to OS. These defaults work on
+# Solaris 2, HPUX, and IRIX. The OS-specific Makefiles have different versions
+# for other systems, and you can override with your own requirements in your
+# private Makefiles in the Local directory. The most commonly found
+# alternatives are -ax instead of -e for the ps argument, and / instead of a
+# blank before the name exim for the egrep argument on systems whose ps output
+# shows the full path name. The quotes for the egrep argument are specified
+# here so that leading white space can be used. This value should always be
+# given in single quotes.
+
+EXIWHAT_PS_CMD=/bin/ps
+EXIWHAT_PS_ARG=-e
+EXIWHAT_EGREP_ARG=' exim( |$$|-)'
+
+# For both kinds of exiwhat usage, the next setting specifies the signal that
+# is sent.
+
+EXIWHAT_KILL_SIGNAL=-USR1
+
+
+# IPv6 is coming. Exim has experimental support that has been tried out on
+# one or two OS. See the file README.IPV6 for the current status of this
+# support. Do not set this option unless you are working on IPv6 and know
+# what you are doing. As well as the basic enabling option, there are
+# parameters for include and library directories that may be needed for IPv6
+# on some systems.
+
+# HAVE_IPV6=YES
+# IPV6_INCLUDE=-I /usr/ipv6/include
+# IPV6_LIBS=-L/usr/ipv6/libs -linet6
+
+# Setting this brings in support for A6 DNS records for IPV6. These are
+# now expected to be reduced to "experimental" status by the IETF, so
+# the code is omitted by default.
+
+# SUPPORT_A6=yes
+
+# Exim uses the function getaddrinfo() for converting IPv6 addresses in text
+# form to binary. Apparently some operating systems do not support this, or not
+# correctly, and require the use of the function inet_pton() instead. The
+# following setting enables this. Note, however, the inet_pton() has reduced
+# functionality compared with getaddrinfo(). In particular, it does not
+# recognize the percent convention for identifying scopes (interfaces) that is
+# used by some operating systems.
+
+# IPV6_USE_INET_PTON=yes
+
+
+# HOSTNAME_COMMAND contains the path to the "hostname" command, which varies
+# from OS to OS. This is used when building the Exim monitor script only. (See
+# also BASENAME_COMMAND.) If HOSTNAME_COMMAND is set to "look_for_it" then the
+# script checks for /usr/bin/hostname and /bin/hostname, and if neither is
+# found, it uses /usr/ucb/basename. This copes with Solaris 2, which comes in
+# different versions.
+
+HOSTNAME_COMMAND=/bin/hostname
+
+
+# INCLUDE contains arbitrary include parameters that you may need to use
+# when building exim. It is added to every compile command.
+
+# INCLUDE=-I /some/special/include-directory
+
+
+# Some OS require a separate library to be quoted when linking programs that
+# call name resolver functions. This can be set in LIBRESOLV, which is left
+# unset here, but is set is some of the OS-specific Makefiles.
+
+# LIBRESOLV=
+
+
+# Additional libraries and include directories may be required for some
+# lookup styles, e.g. LDAP or SQL. LOOKUP_LIBS is included only on the
+# command for linking Exim itself, not on any auxiliary programs. You
+# don't need to set LOOKUP_INCLUDE if the relevant directories are already
+# specified in INCLUDE.
+
+# LOOKUP_INCLUDE=-I /usr/local/ldap/include -I /usr/local/sql/include
+# LOOKUP_LIBS=-L/usr/local/lib -lldap -llber
+
+
+# RANLIB should be set to something that does nothing on systems that do not
+# have the ranlib command or do not need to run it on library files.
+
+RANLIB=ranlib
+
+
+# EXIM_CHMOD is available to specify a command that is automatically applied
+# to the Exim binary immediately it is compiled. (I find this useful when
+# building test versions.)
+
+EXIM_CHMOD=@true
+
+
+# LOCAL_SCAN_SOURCE defines the file in which the function local_scan() is
+# defined. This provides the administrator with a hook for including C code
+# for scanning incoming mails. The path that is defined must be relative to
+# the Exim distribution directory. For example
+
+# LOCAL_SCAN_SOURCE=Local/local_scan.c
+
+# The default setting points to a template function that doesn't actually do
+# any scanning, but just accepts the message.
+
+LOCAL_SCAN_SOURCE=src/local_scan.c
+
+# If you want to specify options for your local_scan() that can be set from
+# the main Exim configuration file, you need to uncomment the following line,
+# and then provide a table of options in your local_scan() source, as described
+# in the reference manual.
+
+# LOCAL_SCAN_HAS_OPTIONS=yes
+
+
+#############################################################################
+# The following are all concerned with configuring the way Exim handles its
+# database (hints) and other dbm files.
+
+# Some systems require a separate library to be supplied when linking programs
+# that make use of DBM library calls. This can be set in DBMLIB, which is unset
+# by default, but is set in some of the OS-specific Makefiles. Setting it in
+# your Local/Makefile will override any other setting.
+
+# DBMLIB=
+
+
+# When Exim is attempting to lock one of its database (hints) files, it
+# applies a timeout which can be altered here.
+
+# EXIMDB_LOCK_TIMEOUT=60
+
+
+# By default, Exim uses traditional ndbm function calls to handle its indexed
+# hints databases. On systems that have Berkeley db installed, this still
+# works via the compatibility interface. However, by defining USE_DB you can
+# make it use native db function calls.
+
+# USE_DB=YES
+
+# Similarly, if you are using gdbm, Exim will by default use the ndbm
+# compatibility interface. However, by defining USE_GDBM you can make it
+# use the native gdbm function calls.
+
+# USE_GDBM=YES
+
+
+#############################################################################
+# The following definitions are relevant only when compiling the Exim monitor
+# program, which requires an X11 display. See the varible EXIM_MONITOR in
+# src/EDITME for how to suppress this compilation.
+
+# X11 contains the location of the X11 libraries and include files.
+
+X11=/usr/X11R6
+
+# XINCLUDE contains options for header inclusion when compiling functions
+# that call X11 functions.
+
+XINCLUDE=-I$(X11)/include
+
+# XLFLAGS contains flags to be passed to the linker when linking the monitor.
+
+XLFLAGS=-L$(X11)/lib
+
+# X11_LD_LIB contains the name of the X11 library that is to be added to
+# LD_LIBRARY_PATH when running the monitor program.
+
+X11_LD_LIB=$(X11)/lib
+
+# A modified version of the Athena TextPop module is supplied with Exim. The
+# modification is to remove the "replace" part of the "search and replace"
+# operation because it isn't wanted. TextPop is only one of a number of
+# modules that make up the Text widget. Some antique link editors cannot handle
+# the case of a replacement module for one of a set of modules. To allow
+# the monitor to be linked in such cases, set the value of EXIMON_TEXTPOP
+# to be empty. The search operations will then contain a useless "replace"
+# option, which is untidy, but does no harm.
+
+EXIMON_TEXTPOP=em_TextPop.o
+
+# End
diff --git a/src/OS/Makefile-FreeBSD b/src/OS/Makefile-FreeBSD
new file mode 100644
index 000000000..179cbacb4
--- /dev/null
+++ b/src/OS/Makefile-FreeBSD
@@ -0,0 +1,36 @@
+# $Cambridge: exim/src/OS/Makefile-FreeBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for FreeBSD
+# There's no setting of CFLAGS here, to allow the system default
+# for "make" to be the default.
+
+PORTOBJFORMAT!= test -x /usr/bin/objformat && /usr/bin/objformat || echo aout
+
+CHOWN_COMMAND=/usr/sbin/chown
+
+HAVE_SA_LEN=YES
+
+# crypt() is in a separate library
+LIBS=-lcrypt
+
+# FreeBSD always ships with Berkeley DB
+USE_DB=yes
+
+# This setting changed on Sheldon Hearn's recommendation
+# X11=/usr/X11R6
+X11=$(X11BASE)
+
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib
+.if ${PORTOBJFORMAT} == "elf"
+XLFLAGS+=-Wl,-rpath,${X11BASE}/lib
+.endif
+X11_LD_LIB=$(X11)/lib
+
+EXIWHAT_PS_ARG=-ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_MULTIKILL_CMD='killall -m'
+EXIWHAT_MULTIKILL_ARG='^exim($$|-[0-9.]+-[0-9]+$$)'
+EXIWHAT_KILL_SIGNAL=-USR1
+
+# End
diff --git a/src/OS/Makefile-GNU b/src/OS/Makefile-GNU
new file mode 100644
index 000000000..d52fb22c9
--- /dev/null
+++ b/src/OS/Makefile-GNU
@@ -0,0 +1,24 @@
+# $Cambridge: exim/src/OS/Makefile-GNU,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for GNU/Hurd.
+
+BASENAME_COMMAND=look_for_it
+
+DBMLIB = -ldb
+USE_DB = yes
+
+LIBS = -lnsl -lcrypt
+LIBRESOLV = -lresolv
+
+CFLAGS = -O2 -g -Wall
+
+X11=/usr/X11R6
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib
+X11_LD_LIB=$(X11)/lib
+
+EXIWHAT_PS_ARG=ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_KILL_SIGNAL=-USR1
+
+# End
diff --git a/src/OS/Makefile-HI-OSF b/src/OS/Makefile-HI-OSF
new file mode 100644
index 000000000..c49d12547
--- /dev/null
+++ b/src/OS/Makefile-HI-OSF
@@ -0,0 +1,10 @@
+# $Cambridge: exim/src/OS/Makefile-HI-OSF,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for HI-OSF/1-MJ and HI-UX/MPP
+
+CC=cc
+CFLAGS=-O
+RANLIB=@true
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+
+# End
diff --git a/src/OS/Makefile-HI-UX b/src/OS/Makefile-HI-UX
new file mode 100644
index 000000000..f8c968aa4
--- /dev/null
+++ b/src/OS/Makefile-HI-UX
@@ -0,0 +1,14 @@
+# $Cambridge: exim/src/OS/Makefile-HI-UX,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for HI-UX
+
+CC=cc -Aa -D_HIUX_SOURCE
+HAVE_SETRESUID=YES
+HAVE_SETEUID=NO
+XINCLUDE=-I/usr/include/X11R5
+XLFLAGS=-L/usr/lib/X11R5
+DBMLIB = -lndbm
+NEED_H_ERRNO=1
+RANLIB=@true
+
+# End
diff --git a/src/OS/Makefile-HP-UX b/src/OS/Makefile-HP-UX
new file mode 100644
index 000000000..a5d5374c3
--- /dev/null
+++ b/src/OS/Makefile-HP-UX
@@ -0,0 +1,17 @@
+# $Cambridge: exim/src/OS/Makefile-HP-UX,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for HP-UX later than 9
+
+CFLAGS=-O
+BASENAME_COMMAND=/bin/basename
+HAVE_ICONV=yes
+HAVE_SETRESUID=YES
+HAVE_SETEUID=NO
+XINCLUDE=-I/usr/include/X11R6 -I/usr/contrib/X11R6/include
+XLFLAGS=-L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib
+X11_LD_LIB=/usr/contrib/X11R6/lib
+EXIMON_TEXTPOP=
+DBMLIB=-lndbm
+RANLIB=@true
+
+# End
diff --git a/src/OS/Makefile-HP-UX-9 b/src/OS/Makefile-HP-UX-9
new file mode 100644
index 000000000..f96a0bc24
--- /dev/null
+++ b/src/OS/Makefile-HP-UX-9
@@ -0,0 +1,17 @@
+# $Cambridge: exim/src/OS/Makefile-HP-UX-9,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for HP-UX 9
+
+CFLAGS=-O
+BASENAME_COMMAND=/bin/basename
+HAVE_ICONV=yes
+HAVE_SETRESUID=YES
+HAVE_SETEUID=NO
+XINCLUDE=-I/usr/include/X11R5
+XLFLAGS=-L/usr/lib/X11R5 -L/usr/contrib/X11R5/lib
+X11_LD_LIB=/usr/contrib/X11R5/lib
+EXIMON_TEXTPOP=
+DBMLIB=-lndbm
+RANLIB=@true
+
+# End
diff --git a/src/OS/Makefile-IRIX b/src/OS/Makefile-IRIX
new file mode 100644
index 000000000..bab1e9910
--- /dev/null
+++ b/src/OS/Makefile-IRIX
@@ -0,0 +1,14 @@
+# $Cambridge: exim/src/OS/Makefile-IRIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for IRIX
+
+HAVE_ICONV=yes
+BASENAME_COMMAND=/sbin/basename
+HOSTNAME_COMMAND=/usr/bsd/hostname
+CFLAGS=-OPT:Olimit=1500
+LIBS=-lmld
+XINCLUDE=-I/usr/include/X11
+vfork=fork
+RANLIB=@true
+
+# End
diff --git a/src/OS/Makefile-IRIX6 b/src/OS/Makefile-IRIX6
new file mode 100644
index 000000000..3534e5d66
--- /dev/null
+++ b/src/OS/Makefile-IRIX6
@@ -0,0 +1,15 @@
+# $Cambridge: exim/src/OS/Makefile-IRIX6,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for IRIX6 on 64-bit systems
+
+HAVE_ICONV=yes
+HOSTNAME_COMMAND=/usr/bsd/hostname
+CFLAGS=-O2 -n32 -OPT:Olimit=4000
+LFLAGS=-n32
+LIBS=-lelf
+XINCLUDE=-I/usr/include/X11
+XLFLAGS=
+vfork=fork
+RANLIB=@true
+
+# End
diff --git a/src/OS/Makefile-IRIX632 b/src/OS/Makefile-IRIX632
new file mode 100644
index 000000000..5b09364df
--- /dev/null
+++ b/src/OS/Makefile-IRIX632
@@ -0,0 +1,18 @@
+# $Cambridge: exim/src/OS/Makefile-IRIX632,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for IRIX 6 on 32-bit systems.
+# There seems to be some variation. The commented settings show
+# some alternatives.
+
+HAVE_ICONV=yes
+HOSTNAME_COMMAND=/usr/bsd/hostname
+#CFLAGS=-OPT:Olimit=1500 -32 -mips2
+CFLAGS=-32
+LFLAGS=-32
+#LIBS=-lmld
+LIBS=-lelf
+XINCLUDE=-I/usr/include/X11
+vfork=fork
+RANLIB=@true
+
+# End
diff --git a/src/OS/Makefile-IRIX65 b/src/OS/Makefile-IRIX65
new file mode 100644
index 000000000..b678e37ae
--- /dev/null
+++ b/src/OS/Makefile-IRIX65
@@ -0,0 +1,18 @@
+# $Cambridge: exim/src/OS/Makefile-IRIX65,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for IRIX 6.5
+
+HAVE_ICONV=yes
+HOSTNAME_COMMAND=/usr/bsd/hostname
+CC=cc
+CFLAGS=-O2 -OPT:Olimit=0
+# CFLAGS=-O2 # override with this (in your Local/Makefile) if using gcc
+LFLAGS=-Wl,-LD_MSG:off=85
+LFLAGS=
+# nlist has moved from libmld to libelf
+LIBS=-lelf
+XINCLUDE=-I/usr/include/X11
+vfork=fork
+RANLIB=@true
+
+# End
diff --git a/src/OS/Makefile-Linux b/src/OS/Makefile-Linux
new file mode 100644
index 000000000..d933c056a
--- /dev/null
+++ b/src/OS/Makefile-Linux
@@ -0,0 +1,31 @@
+# $Cambridge: exim/src/OS/Makefile-Linux,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for Linux. This is for modern Linuxes,
+# which use libc6.
+
+HAVE_ICONV=yes
+
+BASENAME_COMMAND=look_for_it
+CHOWN_COMMAND=look_for_it
+CHGRP_COMMAND=look_for_it
+
+CFLAGS=-O -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+
+DBMLIB = -ldb
+USE_DB = yes
+
+LIBS = -lnsl -lcrypt
+LIBRESOLV = -lresolv
+
+X11=/usr/X11R6
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib
+X11_LD_LIB=$(X11)/lib
+
+EXIWHAT_PS_ARG=ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_MULTIKILL_CMD=killall
+EXIWHAT_MULTIKILL_ARG=exim
+EXIWHAT_KILL_SIGNAL=-USR1
+
+# End
diff --git a/src/OS/Makefile-Linux-libc5 b/src/OS/Makefile-Linux-libc5
new file mode 100644
index 000000000..7ae2152e8
--- /dev/null
+++ b/src/OS/Makefile-Linux-libc5
@@ -0,0 +1,23 @@
+# $Cambridge: exim/src/OS/Makefile-Linux-libc5,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for Linux systems using the old libc5
+# version of the C library.
+
+BASENAME_COMMAND=look_for_it
+CHOWN_COMMAND=look_for_it
+CHGRP_COMMAND=look_for_it
+
+CFLAGS=-O
+
+DBMLIB = -lndbm
+
+X11=/usr/X11R6
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib
+X11_LD_LIB=$(X11)/lib
+
+EXIWHAT_PS_ARG=-ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_KILL_SIGNAL=-USR1
+
+# End
diff --git a/src/OS/Makefile-NetBSD b/src/OS/Makefile-NetBSD
new file mode 100644
index 000000000..0f00789cb
--- /dev/null
+++ b/src/OS/Makefile-NetBSD
@@ -0,0 +1,27 @@
+# $Cambridge: exim/src/OS/Makefile-NetBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for NetBSD (ELF object format)
+
+CHOWN_COMMAND=/usr/sbin/chown
+CFLAGS=-O
+
+HAVE_SA_LEN=YES
+HAVE_IPV6=YES
+LIBS=-lcrypt
+
+X11=/usr/X11R6
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib
+X11_LD_LIB=$(X11)/lib
+
+EXIWHAT_PS_ARG=-ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_KILL_SIGNAL=-USR1
+
+# NetBSD always ships with Berkeley DB
+USE_DB=yes
+
+# NetBSD ELF linker needs a -R flag.
+XLFLAGS+=-Wl,-R$(X11)/lib/
+
+# End
diff --git a/src/OS/Makefile-NetBSD-a.out b/src/OS/Makefile-NetBSD-a.out
new file mode 100644
index 000000000..1ef7a86c8
--- /dev/null
+++ b/src/OS/Makefile-NetBSD-a.out
@@ -0,0 +1,24 @@
+# $Cambridge: exim/src/OS/Makefile-NetBSD-a.out,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for NetBSD (a.out/COFF object format)
+
+CHOWN_COMMAND=/usr/sbin/chown
+CFLAGS=-O
+
+HAVE_SA_LEN=YES
+HAVE_IPV6=YES
+LIBS=-lcrypt
+
+X11=/usr/X11R6
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib
+X11_LD_LIB=$(X11)/lib
+
+EXIWHAT_PS_ARG=-ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_KILL_SIGNAL=-USR1
+
+# NetBSD always ships with Berkeley DB
+USE_DB=yes
+
+# End
diff --git a/src/OS/Makefile-OSF1 b/src/OS/Makefile-OSF1
new file mode 100644
index 000000000..b5a61fb19
--- /dev/null
+++ b/src/OS/Makefile-OSF1
@@ -0,0 +1,12 @@
+# $Cambridge: exim/src/OS/Makefile-OSF1,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for OSF1
+
+CFLAGS=-O
+LIBS=-liconv
+HAVE_CRYPT16=yes
+HAVE_ICONV=yes
+HOSTNAME_COMMAND=/usr/bin/hostname
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+
+# End
diff --git a/src/OS/Makefile-OpenBSD b/src/OS/Makefile-OpenBSD
new file mode 100644
index 000000000..05d0b3d44
--- /dev/null
+++ b/src/OS/Makefile-OpenBSD
@@ -0,0 +1,26 @@
+# $Cambridge: exim/src/OS/Makefile-OpenBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for OpenBSD
+
+CHOWN_COMMAND=/usr/sbin/chown
+CHGRP_COMMAND=/usr/sbin/chgrp
+CFLAGS=-O2 -Wall
+
+HAVE_SA_LEN=YES
+
+X11=/usr/X11R6
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib
+
+EXIWHAT_MULTIKILL_CMD=pkill
+EXIWHAT_MULTIKILL_ARG='exim( |$$|-)'
+EXIWHAT_PS_ARG=-ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_KILL_SIGNAL=-USR1
+
+HAVE_IPV6=YES
+
+# OpenBSD always ships with Berkeley DB
+USE_DB=yes
+
+# End
diff --git a/src/OS/Makefile-OpenUNIX b/src/OS/Makefile-OpenUNIX
new file mode 100644
index 000000000..2d543b64f
--- /dev/null
+++ b/src/OS/Makefile-OpenUNIX
@@ -0,0 +1,19 @@
+# $Cambridge: exim/src/OS/Makefile-OpenUNIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for OpenUNIX
+
+CC=/usr/bin/cc
+CFLAGS=-O -I/usr/local/include
+LFLAGS=-L/usr/local/lib
+
+LIBS=-lsocket -lnsl -lelf -lgen -lresolv
+EXTRALIBS_EXIMON=-lICE -lSM
+
+RANLIB=@true
+ERRNO_QUOTA=0
+
+X11=/usr/lib/X11
+XINCLUDE=-I/usr/include/X11
+XLFLAGS=-L/usr/lib -L$(X11)/lib
+
+# End
diff --git a/src/OS/Makefile-QNX b/src/OS/Makefile-QNX
new file mode 100644
index 000000000..d0f74608d
--- /dev/null
+++ b/src/OS/Makefile-QNX
@@ -0,0 +1,31 @@
+# $Cambridge: exim/src/OS/Makefile-QNX,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific makefile for QNX
+
+BASENAME_COMMAND=/bin/basename
+MAKE_SHELL=/usr/bin/bash
+
+CHOWN_COMMAND=/bin/chown
+CHGRP_COMMAND=/bin/chgrp
+HOSTNAME_COMMAND=/bin/hostname
+MV_COMMAND=/bin/mv
+PERL_COMMAND=/usr/bin/perl
+RM_COMMAND=/bin/rm
+
+AR=ar -rc
+
+CC=cc
+CFLAGS=-Otax
+LIBIDENTCFLAGS=
+
+RANLIB=@true
+DBMLIB=-ldb
+USE_DB=yes
+LIBS=-lsocket
+
+X11=/usr/X11R6
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib
+X11_LD_LIB=$(X11)/lib
+
+# End
diff --git a/src/OS/Makefile-SCO b/src/OS/Makefile-SCO
new file mode 100644
index 000000000..4366f387b
--- /dev/null
+++ b/src/OS/Makefile-SCO
@@ -0,0 +1,29 @@
+# $Cambridge: exim/src/OS/Makefile-SCO,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for SCO
+
+# It was reported that some versions of gcc (e.g. 2.8.1) require this to be
+# CFLAGS=-melf
+
+CFLAGS=-b elf
+
+RANLIB=@true
+DBMLIB=-lndbm
+ERRNO_QUOTA=0
+LIBS=-lsocket
+HAVE_ICONV=yes
+
+X11=/usr/lib/X11
+XINCLUDE=-I/usr/include/X11
+XLFLAGS=-L/usr/lib -L$(X11)/lib
+X11_LD_LIB=$(X11)/lib
+
+# Changes from Frank Bernhardt (30/09/04)
+
+BASENAME_COMMAND=/bin/basename
+CHOWN_COMMAND=/bin/chown
+CHGRP_COMMAND=/bin/chgrp
+HOSTNAME_COMMAND=/usr/bin/hostname
+
+
+# End
diff --git a/src/OS/Makefile-SCO_SV b/src/OS/Makefile-SCO_SV
new file mode 100644
index 000000000..48b5f2278
--- /dev/null
+++ b/src/OS/Makefile-SCO_SV
@@ -0,0 +1,34 @@
+# $Cambridge: exim/src/OS/Makefile-SCO_SV,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for SCO_SV release 5 (tested on 5.0.5 & 5.0.5)
+# (see the UNIX_SV files for SCO 4.2)
+# Supplied by: Tony Earnshaw <tonye@ilion.nl>
+
+# Note that 'gcc -melf -m486' applies to gcc 2.7.2 and higher;
+# 2.7.1 and SCO's SDK need '-belf'.
+
+# Removed -lwrap (PH 27/7/00) because not all systems have it
+
+CFLAGS=-melf -O3 -m486
+LFLAGS=-L/lib -L/usr/lib -L/usr/local/lib
+LIBS=-ltinfo -lm -lsocket
+
+HAVE_ICONV=yes
+
+RANLIB=@true
+DBMLIB=-lndbm
+ERRNO_QUOTA=0
+
+X11=/usr/lib/X11
+XINCLUDE=-I/usr/include/X11
+XLFLAGS=-L/usr/lib -L$(X11)/lib
+X11_LD_LIB=$(X11)/lib
+
+# Changes from Frank Bernhardt (30/9/04)
+
+BASENAME_COMMAND=/bin/basename
+CHOWN_COMMAND=/bin/chown
+CHGRP_COMMAND=/bin/chgrp
+HOSTNAME_COMMAND=/usr/bin/hostname
+
+# End
diff --git a/src/OS/Makefile-SunOS4 b/src/OS/Makefile-SunOS4
new file mode 100644
index 000000000..fd08dd23e
--- /dev/null
+++ b/src/OS/Makefile-SunOS4
@@ -0,0 +1,23 @@
+# $Cambridge: exim/src/OS/Makefile-SunOS4,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for SunOS4
+
+CFLAGS=-O
+
+# Don't need -DSTRERROR_FROM_ERRLIST in PCRE_CFLAGS, because it is in os.h
+# for SunOS4, which gets included for pcre.
+
+PCRE_CFLAGS=-DUSE_BCOPY
+
+CHOWN_COMMAND=/usr/etc/chown
+HOSTNAME_COMMAND=/usr/bin/hostname
+EXIT_FAILURE=1
+EXIT_SUCCESS=0
+LIBRESOLV=-lresolv
+XINCLUDE=-I/usr/include/X11
+
+EXIWHAT_PS_ARG=-ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_KILL_SIGNAL=-30
+
+# End
diff --git a/src/OS/Makefile-SunOS5 b/src/OS/Makefile-SunOS5
new file mode 100644
index 000000000..1afef4d23
--- /dev/null
+++ b/src/OS/Makefile-SunOS5
@@ -0,0 +1,24 @@
+# $Cambridge: exim/src/OS/Makefile-SunOS5,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for SunOS5
+
+CFLAGS=-O
+
+HAVE_ICONV=yes
+
+BASENAME_COMMAND=look_for_it
+HOSTNAME_COMMAND=look_for_it
+
+RANLIB=@true
+LIBS=-lsocket -lnsl -lkstat
+LIBRESOLV=-lresolv
+
+EXIWHAT_MULTIKILL_CMD=pkill
+EXIWHAT_MULTIKILL_ARG='exim( |$$|-)'
+
+X11=/usr/openwin
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib -R$(X11)/lib
+X11LIB=$(X11)/lib
+
+# End
diff --git a/src/OS/Makefile-SunOS5-hal b/src/OS/Makefile-SunOS5-hal
new file mode 100644
index 000000000..014bac1e1
--- /dev/null
+++ b/src/OS/Makefile-SunOS5-hal
@@ -0,0 +1,20 @@
+# $Cambridge: exim/src/OS/Makefile-SunOS5-hal,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for SunOS5 on a HAL
+
+# Note: The HAL runs a standard SunOS5 except that it has a 64 bit C
+# compiler called hcc. To make things work pass the -KV7 flag to force
+# 32bit compilation - this is necessary to interwork with some libraries.
+
+CC=hcc
+CFLAGS=-O -KV7
+LIBIDENTCFLAGS="-KV7 -O -DHAVE_ANSIHEADERS"
+LIBIDENTNAME=sunos5
+RANLIB=@true
+LIBS=-lsocket -lnsl -lkstat
+LIBRESOLV=-lresolv
+X11=/usr/X11R6
+XINCLUDE=-I$(X11)/include
+XLFLAGS=-L$(X11)/lib -R$(X11)/lib
+
+# End
diff --git a/src/OS/Makefile-ULTRIX b/src/OS/Makefile-ULTRIX
new file mode 100644
index 000000000..d9cd30262
--- /dev/null
+++ b/src/OS/Makefile-ULTRIX
@@ -0,0 +1,20 @@
+# $Cambridge: exim/src/OS/Makefile-ULTRIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for Ultrix
+
+MAKE_SHELL=/usr/bin/sh5
+
+CFLAGS=-O
+
+# This can either be /usr/include/X11 or /usr/include/mit depending on
+# the particular version of ULTRIX.
+
+XINCLUDE=-I/usr/include/X11 -I/usr/include/mit
+
+DBMLIB=-lgdbm
+
+EXIWHAT_PS_ARG=-ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_KILL_SIGNAL=-USR1
+
+# End
diff --git a/src/OS/Makefile-UNIX_SV b/src/OS/Makefile-UNIX_SV
new file mode 100644
index 000000000..1f56c59fa
--- /dev/null
+++ b/src/OS/Makefile-UNIX_SV
@@ -0,0 +1,26 @@
+# $Cambridge: exim/src/OS/Makefile-UNIX_SV,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for SCO SVR4.2MP (and maybe Unixware)
+#
+# *** Note that for SCO 5 the configuration file is called SCO_SV,
+# *** and that Unixware7 has its own configuration. This is an old
+# *** file that is retained for compatibility.
+#
+# Note that SCO does not include dbm/ndbm with their standard compiler
+# (it is available with /usr/ucb/cc, but that has bugs of its own). You
+# should install gcc and gdbm, then execute 'make install-compat' in the
+# gdbm source directory.
+
+CC=gcc -I/usr/local/include
+CFLAGS=-O
+
+RANLIB=@true
+DBMLIB=-lgdbm -L/usr/local/lib
+ERRNO_QUOTA=0
+LIBS=-lsocket -lelf -lgen -lnsl -lresolv
+
+X11=/usr/lib/X11
+XINCLUDE=-I/usr/include/X11
+XLFLAGS=-L/usr/lib -L$(X11)/lib
+
+# End
diff --git a/src/OS/Makefile-USG b/src/OS/Makefile-USG
new file mode 100644
index 000000000..b49feecc9
--- /dev/null
+++ b/src/OS/Makefile-USG
@@ -0,0 +1,35 @@
+# $Cambridge: exim/src/OS/Makefile-USG,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for Unixware 2.x
+#
+# Note that Unixware does not include db/dbm/ndbm with their standard compiler
+# (it is available with /usr/ucb/cc, but that has bugs of its own). You
+# should install gcc and Berkeley DB (or another dbm library if you really
+# insist). If you use a different dbm library you will need to override
+# DBMLIB below.
+#
+# DB 1.85 and 2.x can be found at http://www.sleepycat.com/.
+# They have different characteristics. See the discussion of dbm libraries
+# in doc/dbm.discuss.txt in the Exim distribution.
+#
+# DB needs to be compiled with gcc and you need a 'cc' in your path
+# before the Unixware CC to compile it.
+#
+# Don't bother even starting to install exim on Unixware unless
+# you have installed gcc and use it for everything.
+
+CC=gcc -I/usr/local/include
+CFLAGS=-O
+
+RANLIB=@true
+DBMLIB=-ldb -L/usr/local/lib
+USE_DB=YES
+ERRNO_QUOTA=0
+LIBS=-lsocket -lelf -lgen -lnsl -lresolv
+
+X11=/usr/lib/X11
+XINCLUDE=-I/usr/include/X11
+XLFLAGS=-L/usr/lib -L$(X11)/lib
+X11_LD_LIB=$(X11)/lib
+
+# End
diff --git a/src/OS/Makefile-Unixware7 b/src/OS/Makefile-Unixware7
new file mode 100644
index 000000000..5c228cc7f
--- /dev/null
+++ b/src/OS/Makefile-Unixware7
@@ -0,0 +1,34 @@
+# $Cambridge: exim/src/OS/Makefile-Unixware7,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for Unixware7
+# Based on information from James FitzGibbon <james@ehlo.com>
+
+# If you want to use libbind, you need to
+# add -I/usr/local/bind/include to CFLAGS
+# add -L/usr/local/bind/lib to LFLAGS
+# remove -lresolv from LIBS
+# add LOOKUP_LIBS=-lbind
+# The new settings should go in your Local/Makefile rather than here; then
+# they will be usable for subsequent Exim releases.
+
+CC=/usr/bin/cc
+CFLAGS=-O -I/usr/local/include
+LFLAGS=-L/usr/local/lib
+
+HAVE_ICONV=yes
+
+LIBS=-lsocket -lnsl -lelf -lgen -lresolv
+
+# Removed on the advice of Larry Rosenman
+# EXTRALIBS=-lwrap
+
+EXTRALIBS_EXIMON=-lICE -lSM
+
+RANLIB=@true
+ERRNO_QUOTA=0
+
+X11=/usr/lib/X11
+XINCLUDE=-I/usr/include/X11
+XLFLAGS=-L/usr/lib -L$(X11)/lib
+
+# End
diff --git a/src/OS/Makefile-mips b/src/OS/Makefile-mips
new file mode 100644
index 000000000..9df94e2d7
--- /dev/null
+++ b/src/OS/Makefile-mips
@@ -0,0 +1,19 @@
+# $Cambridge: exim/src/OS/Makefile-mips,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: OS-specific make file for RiscOS4bsd
+
+HOSTNAME_COMMAND=/usr/ucb/hostname
+EXIT_FAILURE=1
+EXIT_SUCCESS=0
+LIBRESOLV=-lresolv
+LIBS=-liberty
+XINCLUDE=-I/usr/X11R6/include
+
+CFLAGS=-O
+PCRE_CFLAGS=-DUSE_BCOPY -DSTRERROR_FROM_ERRLIST
+
+EXIWHAT_PS_ARG=-ax
+EXIWHAT_EGREP_ARG='/exim( |$$)'
+EXIWHAT_KILL_SIGNAL=-30
+
+# End
diff --git a/src/OS/eximon.conf-Default b/src/OS/eximon.conf-Default
new file mode 100644
index 000000000..08ef41537
--- /dev/null
+++ b/src/OS/eximon.conf-Default
@@ -0,0 +1,43 @@
+# $Cambridge: exim/src/OS/eximon.conf-Default,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+# Exim: Default settings for the eximon script which fires up the Exim monitor.
+# These can be overridden by OS-specific scripts and local installation
+# scripts, and also at run time by shell variables.
+
+# The name of the eximon binary, usually the same as the eximon script,
+# with .bin stuck on the end.
+
+EXIMON_BINARY=${EXIMON_BINARY-$0.bin}
+
+# The remaining parameters are values likely to be changed to suit the
+# user's taste. They are documented in the EDITME file.
+
+WINDOW_TITLE=${EXIMON_WINDOW_TITLE-'"${hostname} eximon"'}
+
+ACTION_OUTPUT=${EXIMON_ACTION_OUTPUT-no}
+ACTION_QUEUE_UPDATE=${EXIMON_ACTION_QUEUE_UPDATE-yes}
+BODY_MAX=${EXIMON_BODY_MAX-20000}
+LOG_DEPTH=${EXIMON_LOG_DEPTH-300}
+LOG_WIDTH=${EXIMON_LOG_WIDTH-${EXIMON_WIDTH-950}}
+LOG_BUFFER=${EXIMON_LOG_BUFFER-20K}
+LOG_FONT=${EXIMON_LOG_FONT--misc-fixed-medium-r-normal-*-14-140-*-*-*-*-iso8859-1}
+LOG_STRIPCHARTS='/ <= /in/
+ / => /out/
+ / => .+ R=local/local/
+ / => .+ T=[^ ]*smtp/smtp/'
+MENU_EVENT=${EXIMON_MENU_EVENT-'Shift<Btn1Down>'}
+MIN_HEIGHT=${EXIMON_MIN_HEIGHT-162}
+MIN_WIDTH=${EXIMON_MIN_WIDTH-103}
+QUEUE_DEPTH=${EXIMON_QUEUE_DEPTH-200}
+QUEUE_WIDTH=${EXIMON_QUEUE_WIDTH-${EXIMON_WIDTH-950}}
+QUEUE_FONT=${EXIMON_QUEUE_FONT-${LOG_FONT}}
+QUEUE_MAX_ADDRESSES=${EXIMON_QUEUE_MAX_ADDRESSES-10}
+QUEUE_INTERVAL=${EXIMON_QUEUE_INTERVAL-300}
+QUEUE_STRIPCHART_NAME=${EXIMON_QUEUE_STRIPCHART_NAME-queue}
+SIZE_STRIPCHART=${EXIMON_SIZE_STRIPCHART}
+SIZE_STRIPCHART_NAME=${EXIMON_SIZE_STRIPCHART_NAME}
+START_SMALL=${EXIMON_START_SMALL-no}
+STRIPCHART_INTERVAL=${EXIMON_STRIPCHART_INTERVAL-60}
+TEXT_DEPTH=${EXIMON_TEXT_DEPTH-200}
+
+# End
diff --git a/src/OS/os.Configuring b/src/OS/os.Configuring
new file mode 100644
index 000000000..df6c57d8d
--- /dev/null
+++ b/src/OS/os.Configuring
@@ -0,0 +1,209 @@
+$Cambridge: exim/src/OS/os.Configuring,v 1.1 2004/10/06 15:07:39 ph10 Exp $
+
+Configuring Exim for different Operating Systems
+------------------------------------------------
+
+These notes describe the way in which Exim is configured at the C program level
+for different operating systems. The normal configuration options that apply
+independently of the operating system are specified by creating files in the
+Local directory, as described in chapter 4 of the manual.
+
+These notes cover the os.* files in the OS directory, and contain information
+for people who want to port the program to some new OS, or to modify the
+configuration for an existing port. If you are just wanting to compile Exim on
+a system that it already knows about, you do not need to read further unless
+there are problems.
+
+The os.c-<ostype> files
+-----------------------
+
+There may be an os.c-<ostype> file for each operating system, but for many of
+them it is not necessary. No error occurs is there isn't one. There is a
+generic file called os.c which contains code that is common to two or more OS
+for setting a restarting or a non-restarting signal, for computing the load
+average, and for finding all the network interface addresses. A few OS have
+their own individual code for one or more of these. When they do, the code is
+put into an os.c-<ostype> file, which also defines a macro such as
+OS_RESTARTING_SIGNAL (for example) to cut out the common code in the generic
+os.c.
+
+The os.h-<ostype> files
+-----------------------
+
+For each OS that Exim knows about, there is an os.h-<ostype> file, where
+<ostype> is the OS name. The relevant file is included as a C header file for
+all Exim compilation by pointing a symbolic link called os.h at it from the
+build directory. The settings are as follows:
+
+The select() function
+---------------------
+
+There is a difference in the data type for the second argument to the select()
+function in some OS. The macro SELECT_ARG2_TYPE can be used to define the type.
+If it is not defined in os.h, then it is defaulted to fs_set in exim.h.
+
+The dn_expand() function
+------------------------
+
+There is a difference in the data type for the fourth argument to the
+dn_expand() function in some OS. The macro DN_EXPAND_ARG4_TYPE can be used to
+define the type. If it is not defined in os.h, then it is defaulted to char *
+in exim.h.
+
+The h_errno variable
+--------------------
+
+If NEED_H_ERRNO is defined, then a definition of the form
+
+extern int h_errno
+
+is included in the compiled code of Exim.
+
+The strerror() function
+-----------------------
+
+Most systems provide the ANSI standard strerror() function; older systems may
+instead have an errlist[] variable in which to look up error texts. Defining
+STRERROR_FROM_ERRLIST causes Exim to build its own strerror() function that
+mimics the ANSI function by lookup up the error code in errlist.
+
+Truncating files
+----------------
+
+The fcntl() option for truncating the length of a file is called F_FREESP in
+most systems; in some, however, it is called O_TRUNC. Some os.h files define
+F_FREESP to be O_TRUNC for this reason.
+
+Finding local interfaces
+------------------------
+
+The SIOCGIFCONF ioctl for finding local interfaces behaves differently on BSD
+systems. It returns a vector of ifreq blocks containing sockaddr structures
+that can be longer than their sizeof definition, making the returned ifreq
+blocks longer than their sizeof definitions. BSD sockaddrs structures contain
+an sa_len field giving the actual size. To cope with difference, there is a
+macro called HAVE_SA_LEN. If it is defined, code that works on BSD systems is
+used. Otherwise, the objects returned by SIOCGIFCONF are assumed to be of
+length sizeof(struct ifreq).
+
+On some operating systems, the SIOCGIFCONF ioctl returns the IP addresses
+with the list of interfaces, and there is no need to call SIOCGIFADDR for each
+individual address. Mostly, making the second call does no harm, but on Linux
+when there are IP aliases, it causes things to go wrong. This also happens on
+BSDI. Therefore, there is now a macro to cut it out, called
+SIOCGIFCONF_GIVES_ADDR.
+
+Note that, if IPv6 support is configured, Exim cannot find the IPv6 addresses
+on local interfaces by itself. You need to set the local_interfaces option in
+this situation.
+
+Computing load averages
+-----------------------
+
+There are several different ways that load averages are computed. One-off code
+is put in the os.c-<ostype>, but several OS use similar methods, and these
+are coded in the generic os.c, using a number of parameters to make variations
+between OS.
+
+Sometimes the load average is not available to unprivileged callers. If
+LOAD_AVG_NEEDS_ROOT is set, Exim ensures that it is root before trying to
+obtain a load average value.
+
+(1) If HAVE_BSD_GETLOADAVG is defined, Exim uses a simple call to the
+getloadavg() function.
+
+(2) If HAVE_KSTAT is defined, Exim uses the kstat package as found in Solaris 2
+(but nowhere else as yet). It uses some supplementary definitions:
+
+ LOAD_AVG_KSTAT the kstat to use
+ LOAD_AVG_KSTAT_MODULE the module to access
+ LOAD_AVG_KSTAT_SYMBOL the symbol containing the value we want
+ LOAD_AVG_KSTAT_FIELD the field identity
+
+(3) If HAVE_DEV_KMEM is defined, Exim reads load average values from the
+/dev/kmem device. It uses some supplementary definitions:
+
+ LOAD_AVG_TYPE the data type
+ LOAD_AVG_SYMBOL the symbol to look up
+ KERNEL_PATH the name of the kernel
+ FSCALE a scaling factor
+
+Sometimes FSCALE is defined in system headers so need not be defined in the
+os.h-<ostype> file.
+
+Glibc systems and IP options
+----------------------------
+
+The code for inspecting IP options is the same in all OS except for systems
+using glibc (e.g. Linux), which uses a different structure to return data from
+getsockopt(). To handle this, there is a macro called
+
+ GLIBC_IP_OPTIONS
+
+which should be set for Linux (in os.h-Linux) and any other operating system
+that uses glibc.
+
+Options for statvfs()
+---------------------
+
+The following settings apply to the compilation of the Exim monitor as well as
+to the main Exim binary.
+
+#undefine HAVE_STATFS
+
+Exim has options for checking the amount of space in the spool partition
+before accepting a message, and the monitor has the ability to display a
+stripchart of the percentage fullness of a particular disc partition, usually
+/var/spool/mail. The standard way of finding out the data is to call the
+statvfs() function, but some operating systems use statfs() and some may not
+have the ability at all. The Exim code uses STATVFS() for this function and
+this gets defined appropriately. HAVE_STATFS is defined before including the
+os.h file; undefining it suppresses the code for checking a partition in the
+main binary, and for monitoring disc partition in the monitor.
+
+When HAVE_STATFS is defined, the distinction between statvfs() and statfs() is
+made by checking HAVE_SYS_STATVFS_H. If it is defined, then sys/statvfs.h is
+included. Otherwise, STATVFS() is defined as a macro for statfs(), and some
+further includes are done, according to the following definitions:
+
+#define HAVE_SYS_MOUNT_H
+#define HAVE_VFS_H
+
+Each of those definitions causes the inclusion of the corresponding system
+header file in the Exim monitor compilation. For example, the first one causes
+
+#include <sys/mount.h>
+
+to be obeyed. Different systems may require different combinations of these
+headers.
+
+The sys/resource.h header
+-------------------------
+
+One OS does not have the sys/resource.h header. If NO_SYS_RESOURCE_H is defined
+in an os.h-<ostype> file, then the #include for this header is skipped in
+exim.h.
+
+The crypt_h header
+------------------
+
+Some OS require crypt.h to be included to get a prototype for the crypt()
+function. This is needed only when compiling with AUTH support. If CRYPT_H is
+defined, then this header is included.
+
+mmap() support
+--------------
+
+The CDB support includes the option of handling file operations by using
+mmap()/munmap(). This gives a reasonable performance increase which will
+probably scale over multiple processes (since the files are mapped read-only
+shared). The vast majority of modern operating systems will support mmap
+(certainly in the simplified way that it is being used here). For example any
+BSD 4.x derived or POSIX compliant system will support it, as will pretty much
+any system using dynamically shared link libraries.
+
+If the OS is believed to support mmap() then the symbol HAVE_MMAP is defined.
+Not all systems that support mmap will have had their config files updated to
+reflect this. Currently Linux, Sun, BSD and SGI/mips systems have been updated.
+
+*** End ***
diff --git a/src/OS/os.c-GNU b/src/OS/os.c-GNU
new file mode 100644
index 000000000..52316a73d
--- /dev/null
+++ b/src/OS/os.c-GNU
@@ -0,0 +1,57 @@
+/* $Cambridge: exim/src/OS/os.c-GNU,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* See the file NOTICE for conditions of use and distribution. */
+
+/* GNU-specific code. This is concatenated onto the generic src/os.c file.
+GNU/Hurd has approximately the same way to determine the load average as NeXT,
+so a variant of this could also be in the generic os.c file. See the GNU EMacs
+getloadavg.c file, from which this snippet was derived. getloadavg.c from Emacs
+is copyrighted by the FSF under the terms of the GPLv2 or any later version.
+Changes are hereby placed under the same license, as requested by the GPL. */
+
+#ifndef OS_LOAD_AVERAGE
+#define OS_LOAD_AVERAGE
+
+#include <mach.h>
+
+static processor_set_t default_set;
+static int getloadavg_initialized;
+
+int
+os_getloadavg (void)
+{
+host_t host;
+struct processor_set_basic_info info;
+unsigned info_count;
+
+if (!getloadavg_initialized)
+ {
+ if (processor_set_default (mach_host_self(), &default_set) == KERN_SUCCESS)
+ getloadavg_initialized = 1;
+ }
+
+if (getloadavg_initialized)
+ {
+ info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
+ if (processor_set_info(default_set, PROCESSOR_SET_BASIC_INFO, &host,
+ (processor_set_info_t)&info, &info_count) != KERN_SUCCESS)
+ getloadavg_initialized = 0;
+ else
+ {
+ #if LOAD_SCALE == 1000
+ return info.load_average;
+ #else
+ return (int) (((double) info.load_average * 1000) / LOAD_SCALE));
+ #endif
+ }
+ }
+
+return -1;
+}
+#endif /* OS_LOAD_AVERAGE */
+
+/* End of os.c-GNU */
diff --git a/src/OS/os.c-HI-OSF b/src/OS/os.c-HI-OSF
new file mode 100644
index 000000000..a21765022
--- /dev/null
+++ b/src/OS/os.c-HI-OSF
@@ -0,0 +1,37 @@
+/* $Cambridge: exim/src/OS/os.c-HI-OSF,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Copyright (c) University of Cambridge 2001 */
+/* See the file NOTICE for conditions of use and distribution. */
+
+/* HI-OSF-specific code. This is concatenated onto the generic
+src/os.c file. OSF has an apparently unique way of getting the
+load average, so we provide a unique function here, and define
+OS_LOAD_AVERAGE to stop src/os.c trying to provide the function. */
+
+#ifndef OS_LOAD_AVERAGE
+#define OS_LOAD_AVERAGE
+
+#include <sys/table.h>
+
+int
+os_getloadavg(void)
+{
+double avg;
+struct tbl_loadavg load_avg;
+
+table (TBL_LOADAVG, 0, &load_avg, 1, sizeof (load_avg));
+
+avg = (load_avg.tl_lscale == 0)?
+ load_avg.tl_avenrun.d[0] :
+ (load_avg.tl_avenrun.l[0] / (double)load_avg.tl_lscale);
+
+return (int)(avg * 1000.0);
+}
+
+#endif /* OS_LOAD_AVERAGE */
+
+/* End of os.c-HI-OSF */
diff --git a/src/OS/os.c-IRIX b/src/OS/os.c-IRIX
new file mode 100644
index 000000000..50d44feb7
--- /dev/null
+++ b/src/OS/os.c-IRIX
@@ -0,0 +1,120 @@
+/* $Cambridge: exim/src/OS/os.c-IRIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Copyright (c) University of Cambridge 2001 */
+/* See the file NOTICE for conditions of use and distribution. */
+
+/* Irix-specific code. This is concatenated onto the generic src/os.c file.
+Irix has a unique way of finding all the network interfaces, so we provide a
+unique function here, and define FIND_RUNNING_INTERFACES to stop src/os.c
+trying to provide the function. The macro may be set initially anyway, when
+compiling os. for utilities that don't want this function. */
+
+#ifndef FIND_RUNNING_INTERFACES
+#define FIND_RUNNING_INTERFACES
+
+/* This is the special form of the function using sysctl() which is the only
+form that returns all the aliases on IRIX systems. This code has its origins
+in a sample program that came from within SGI. */
+
+#include <sys/sysctl.h>
+#include <net/if_dl.h>
+#include <net/if_types.h>
+#include <net/soioctl.h>
+#include <net/route.h>
+
+#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) -1))) \
+ : sizeof(__uint64_t))
+#ifdef _HAVE_SA_LEN
+#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
+#else
+#define ADVANCE(x, n) (x += ROUNDUP(_FAKE_SA_LEN_DST(n)))
+#endif
+
+
+ip_address_item *
+os_find_running_interfaces(void)
+{
+ip_address_item *yield = NULL;
+ip_address_item *last = NULL;
+ip_address_item *next;
+
+size_t needed;
+int mib[6];
+char *buf, *nextaddr, *lim;
+register struct if_msghdr *ifm;
+
+mib[0] = CTL_NET;
+mib[1] = PF_ROUTE;
+mib[2] = 0;
+mib[3] = 0;
+mib[4] = NET_RT_IFLIST;
+mib[5] = 0;
+
+/* Get an estimate of the amount of store needed, then get the store and
+get the data into it. Any error causes a panic death. */
+
+if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
+ log_write(0, LOG_PANIC_DIE, "iflist-sysctl-estimate failed: %s",
+ strerror(errno));
+
+buf = store_get(needed);
+
+if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
+ log_write(0, LOG_PANIC_DIE, "sysctl of ifnet list failed: %s",
+ strerror(errno));
+
+/* Now fish out the data for each interface */
+
+lim = buf + needed;
+for (nextaddr = buf; nextaddr < lim; nextaddr += ifm->ifm_msglen)
+ {
+ ifm = (struct if_msghdr *)nextaddr;
+
+ if (ifm->ifm_type != RTM_IFINFO)
+ {
+ struct ifa_msghdr *ifam = (struct ifa_msghdr *)ifm;
+ struct sockaddr_in *mask = NULL, *addr = NULL;
+
+ if ((ifam->ifam_addrs & RTA_NETMASK) != 0)
+ mask = (struct sockaddr_in *)(ifam + 1);
+
+ if ((ifam->ifam_addrs & RTA_IFA) != 0)
+ {
+ char *cp = (char *)mask;
+ struct sockaddr *sa = (struct sockaddr *)mask;
+ ADVANCE(cp, sa);
+ addr = (struct sockaddr_in *)cp;
+ }
+
+ /* Create a data block for the address, fill in the data, and put it on
+ the chain. This data has to survive for ever, so use malloc. */
+
+ if (addr != NULL)
+ {
+ next = store_malloc(sizeof(ip_address_item));
+ next->next = NULL;
+ next->port = 0;
+ (void)host_ntoa(-1, addr, next->address, NULL);
+
+ if (yield == NULL) yield = last = next; else
+ {
+ last->next = next;
+ last = next;
+ }
+
+ DEBUG(D_interface) debug_printf("Actual local interface address is %s\n",
+ last->address);
+ }
+ }
+ }
+
+return yield;
+}
+
+#endif /* FIND_RUNNING_INTERFACES */
+
+/* End of os.c-IRIX */
diff --git a/src/OS/os.c-IRIX6 b/src/OS/os.c-IRIX6
new file mode 100644
index 000000000..5bb251554
--- /dev/null
+++ b/src/OS/os.c-IRIX6
@@ -0,0 +1,120 @@
+/* $Cambridge: exim/src/OS/os.c-IRIX6,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Copyright (c) University of Cambridge 2001 */
+/* See the file NOTICE for conditions of use and distribution. */
+
+/* Irix-specific code. This is concatenated onto the generic src/os.c file.
+Irix has a unique way of finding all the network interfaces, so we provide a
+unique function here, and define FIND_RUNNING_INTERFACES to stop src/os.c
+trying to provide the function. The macro may be set initially anyway, when
+compiling os. for utilities that don't want this function. */
+
+#ifndef FIND_RUNNING_INTERFACES
+#define FIND_RUNNING_INTERFACES
+
+/* This is the special form of the function using sysctl() which is the only
+form that returns all the aliases on IRIX systems. This code has its origins
+in a sample program that came from within SGI. */
+
+#include <sys/sysctl.h>
+#include <net/if_dl.h>
+#include <net/if_types.h>
+#include <net/soioctl.h>
+#include <net/route.h>
+
+#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) -1))) \
+ : sizeof(__uint64_t))
+#ifdef _HAVE_SA_LEN
+#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
+#else
+#define ADVANCE(x, n) (x += ROUNDUP(_FAKE_SA_LEN_DST(n)))
+#endif
+
+
+ip_address_item *
+os_find_running_interfaces(void)
+{
+ip_address_item *yield = NULL;
+ip_address_item *last = NULL;
+ip_address_item *next;
+
+size_t needed;
+int mib[6];
+char *buf, *nextaddr, *lim;
+register struct if_msghdr *ifm;
+
+mib[0] = CTL_NET;
+mib[1] = PF_ROUTE;
+mib[2] = 0;
+mib[3] = 0;
+mib[4] = NET_RT_IFLIST;
+mib[5] = 0;
+
+/* Get an estimate of the amount of store needed, then get the store and
+get the data into it. Any error causes a panic death. */
+
+if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
+ log_write(0, LOG_PANIC_DIE, "iflist-sysctl-estimate failed: %s",
+ strerror(errno));
+
+buf = store_get(needed);
+
+if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
+ log_write(0, LOG_PANIC_DIE, "sysctl of ifnet list failed: %s",
+ strerror(errno));
+
+/* Now fish out the data for each interface */
+
+lim = buf + needed;
+for (nextaddr = buf; nextaddr < lim; nextaddr += ifm->ifm_msglen)
+ {
+ ifm = (struct if_msghdr *)nextaddr;
+
+ if (ifm->ifm_type != RTM_IFINFO)
+ {
+ struct ifa_msghdr *ifam = (struct ifa_msghdr *)ifm;
+ struct sockaddr_in *mask = NULL, *addr = NULL;
+
+ if ((ifam->ifam_addrs & RTA_NETMASK) != 0)
+ mask = (struct sockaddr_in *)(ifam + 1);
+
+ if ((ifam->ifam_addrs & RTA_IFA) != 0)
+ {
+ char *cp = (char *)mask;
+ struct sockaddr *sa = (struct sockaddr *)mask;
+ ADVANCE(cp, sa);
+ addr = (struct sockaddr_in *)cp;
+ }
+
+ /* Create a data block for the address, fill in the data, and put it on
+ the chain. This data has to survive for ever, so use malloc. */
+
+ if (addr != NULL)
+ {
+ next = store_malloc(sizeof(ip_address_item));
+ next->next = NULL;
+ next->port = 0;
+ (void)host_ntoa(-1, addr, next->address, NULL);
+
+ if (yield == NULL) yield = last = next; else
+ {
+ last->next = next;
+ last = next;
+ }
+
+ DEBUG(D_interface) debug_printf("Actual local interface address is %s\n",
+ last->address);
+ }
+ }
+ }
+
+return yield;
+}
+
+#endif /* FIND_RUNNING_INTERFACES */
+
+/* End of os.c-IRIX */
diff --git a/src/OS/os.c-IRIX632 b/src/OS/os.c-IRIX632
new file mode 100644
index 000000000..b7e0994f1
--- /dev/null
+++ b/src/OS/os.c-IRIX632
@@ -0,0 +1,120 @@
+/* $Cambridge: exim/src/OS/os.c-IRIX632,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Copyright (c) University of Cambridge 2001 */
+/* See the file NOTICE for conditions of use and distribution. */
+
+/* Irix-specific code. This is concatenated onto the generic src/os.c file.
+Irix has a unique way of finding all the network interfaces, so we provide a
+unique function here, and define FIND_RUNNING_INTERFACES to stop src/os.c
+trying to provide the function. The macro may be set initially anyway, when
+compiling os. for utilities that don't want this function. */
+
+#ifndef FIND_RUNNING_INTERFACES
+#define FIND_RUNNING_INTERFACES
+
+/* This is the special form of the function using sysctl() which is the only
+form that returns all the aliases on IRIX systems. This code has its origins
+in a sample program that came from within SGI. */
+
+#include <sys/sysctl.h>
+#include <net/if_dl.h>
+#include <net/if_types.h>
+#include <net/soioctl.h>
+#include <net/route.h>
+
+#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) -1))) \
+ : sizeof(__uint64_t))
+#ifdef _HAVE_SA_LEN
+#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
+#else
+#define ADVANCE(x, n) (x += ROUNDUP(_FAKE_SA_LEN_DST(n)))
+#endif
+
+
+ip_address_item *
+os_find_running_interfaces(void)
+{
+ip_address_item *yield = NULL;
+ip_address_item *last = NULL;
+ip_address_item *next;
+
+size_t needed;
+int mib[6];
+char *buf, *nextaddr, *lim;
+register struct if_msghdr *ifm;
+
+mib[0] = CTL_NET;
+mib[1] = PF_ROUTE;
+mib[2] = 0;
+mib[3] = 0;
+mib[4] = NET_RT_IFLIST;
+mib[5] = 0;
+
+/* Get an estimate of the amount of store needed, then get the store and
+get the data into it. Any error causes a panic death. */
+
+if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
+ log_write(0, LOG_PANIC_DIE, "iflist-sysctl-estimate failed: %s",
+ strerror(errno));
+
+buf = store_get(needed);
+
+if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
+ log_write(0, LOG_PANIC_DIE, "sysctl of ifnet list failed: %s",
+ strerror(errno));
+
+/* Now fish out the data for each interface */
+
+lim = buf + needed;
+for (nextaddr = buf; nextaddr < lim; nextaddr += ifm->ifm_msglen)
+ {
+ ifm = (struct if_msghdr *)nextaddr;
+
+ if (ifm->ifm_type != RTM_IFINFO)
+ {
+ struct ifa_msghdr *ifam = (struct ifa_msghdr *)ifm;
+ struct sockaddr_in *mask = NULL, *addr = NULL;
+
+ if ((ifam->ifam_addrs & RTA_NETMASK) != 0)
+ mask = (struct sockaddr_in *)(ifam + 1);
+
+ if ((ifam->ifam_addrs & RTA_IFA) != 0)
+ {
+ char *cp = (char *)mask;
+ struct sockaddr *sa = (struct sockaddr *)mask;
+ ADVANCE(cp, sa);
+ addr = (struct sockaddr_in *)cp;
+ }
+
+ /* Create a data block for the address, fill in the data, and put it on
+ the chain. This data has to survive for ever, so use malloc. */
+
+ if (addr != NULL)
+ {
+ next = store_malloc(sizeof(ip_address_item));
+ next->next = NULL;
+ next->port = 0;
+ (void)host_ntoa(-1, addr, next->address, NULL);
+
+ if (yield == NULL) yield = last = next; else
+ {
+ last->next = next;
+ last = next;
+ }
+
+ DEBUG(D_interface) debug_printf("Actual local interface address is %s\n",
+ last->address);
+ }
+ }
+ }
+
+return yield;
+}
+
+#endif /* FIND_RUNNING_INTERFACES */
+
+/* End of os.c-IRIX */
diff --git a/src/OS/os.c-IRIX65 b/src/OS/os.c-IRIX65
new file mode 100644
index 000000000..b6e3d66a0
--- /dev/null
+++ b/src/OS/os.c-IRIX65
@@ -0,0 +1,120 @@
+/* $Cambridge: exim/src/OS/os.c-IRIX65,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Copyright (c) University of Cambridge 2001 */
+/* See the file NOTICE for conditions of use and distribution. */
+
+/* Irix-specific code. This is concatenated onto the generic src/os.c file.
+Irix has a unique way of finding all the network interfaces, so we provide a
+unique function here, and define FIND_RUNNING_INTERFACES to stop src/os.c
+trying to provide the function. The macro may be set initially anyway, when
+compiling os. for utilities that don't want this function. */
+
+#ifndef FIND_RUNNING_INTERFACES
+#define FIND_RUNNING_INTERFACES
+
+/* This is the special form of the function using sysctl() which is the only
+form that returns all the aliases on IRIX systems. This code has its origins
+in a sample program that came from within SGI. */
+
+#include <sys/sysctl.h>
+#include <net/if_dl.h>
+#include <net/if_types.h>
+#include <net/soioctl.h>
+#include <net/route.h>
+
+#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) -1))) \
+ : sizeof(__uint64_t))
+#ifdef _HAVE_SA_LEN
+#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
+#else
+#define ADVANCE(x, n) (x += ROUNDUP(_FAKE_SA_LEN_DST(n)))
+#endif
+
+
+ip_address_item *
+os_find_running_interfaces(void)
+{
+ip_address_item *yield = NULL;
+ip_address_item *last = NULL;
+ip_address_item *next;
+
+size_t needed;
+int mib[6];
+char *buf, *nextaddr, *lim;
+register struct if_msghdr *ifm;
+
+mib[0] = CTL_NET;
+mib[1] = PF_ROUTE;
+mib[2] = 0;
+mib[3] = 0;
+mib[4] = NET_RT_IFLIST;
+mib[5] = 0;
+
+/* Get an estimate of the amount of store needed, then get the store and
+get the data into it. Any error causes a panic death. */
+
+if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
+ log_write(0, LOG_PANIC_DIE, "iflist-sysctl-estimate failed: %s",
+ strerror(errno));
+
+buf = store_get(needed);
+
+if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
+ log_write(0, LOG_PANIC_DIE, "sysctl of ifnet list failed: %s",
+ strerror(errno));
+
+/* Now fish out the data for each interface */
+
+lim = buf + needed;
+for (nextaddr = buf; nextaddr < lim; nextaddr += ifm->ifm_msglen)
+ {
+ ifm = (struct if_msghdr *)nextaddr;
+
+ if (ifm->ifm_type != RTM_IFINFO)
+ {
+ struct ifa_msghdr *ifam = (struct ifa_msghdr *)ifm;
+ struct sockaddr_in *mask = NULL, *addr = NULL;
+
+ if ((ifam->ifam_addrs & RTA_NETMASK) != 0)
+ mask = (struct sockaddr_in *)(ifam + 1);
+
+ if ((ifam->ifam_addrs & RTA_IFA) != 0)
+ {
+ char *cp = (char *)mask;
+ struct sockaddr *sa = (struct sockaddr *)mask;
+ ADVANCE(cp, sa);
+ addr = (struct sockaddr_in *)cp;
+ }
+
+ /* Create a data block for the address, fill in the data, and put it on
+ the chain. This data has to survive for ever, so use malloc. */
+
+ if (addr != NULL)
+ {
+ next = store_malloc(sizeof(ip_address_item));
+ next->next = NULL;
+ next->port = 0;
+ (void)host_ntoa(-1, addr, next->address, NULL);
+
+ if (yield == NULL) yield = last = next; else
+ {
+ last->next = next;
+ last = next;
+ }
+
+ DEBUG(D_interface) debug_printf("Actual local interface address is %s\n",
+ last->address);
+ }
+ }
+ }
+
+return yield;
+}
+
+#endif /* FIND_RUNNING_INTERFACES */
+
+/* End of os.c-IRIX */
diff --git a/src/OS/os.c-Linux b/src/OS/os.c-Linux
new file mode 100644
index 000000000..5589a015b
--- /dev/null
+++ b/src/OS/os.c-Linux
@@ -0,0 +1,155 @@
+/* $Cambridge: exim/src/OS/os.c-Linux,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Copyright (c) University of Cambridge 1997 - 2001 */
+/* See the file NOTICE for conditions of use and distribution. */
+
+/* Linux-specific code. This is concatenated onto the generic
+src/os.c file. */
+
+
+/*************************************************
+* Load average computation *
+*************************************************/
+
+/*Linux has an apparently unique way of getting the load average, so we provide
+a unique function here, and define OS_LOAD_AVERAGE to stop src/os.c trying to
+provide the function. However, when compiling os.c for utilities, we may not
+want this at all, so check that it isn't set first. */
+
+#ifndef OS_LOAD_AVERAGE
+#define OS_LOAD_AVERAGE
+
+/* Linux has 2 ways of returning load average:
+
+ (1) Do a read on /proc/loadavg
+ (2) Use the sysinfo library function and syscall
+
+The latter is simpler but in Linux 2.0 - 2.2 (and probably later releases) is
+exceptionally slow - 10-50ms per call is not unusual and about 100x slow the
+first method. This cripples high performance mail servers by increasing CPU
+utilisation by 3-5x.
+
+In Exim's very early days, it used the 1st method. Later, it switched to the
+2nd method. Now it tries the 1st method and falls back to the 2nd if /proc is
+unavailable. */
+
+#include <sys/sysinfo.h>
+
+static int
+linux_slow_getloadavg(void)
+{
+struct sysinfo s;
+double avg;
+if (sysinfo(&s) < 0) return -1;
+avg = (double) (s.loads[0]) / (1<<SI_LOAD_SHIFT);
+return (int)(avg * 1000.0);
+}
+
+int
+os_getloadavg(void)
+{
+char buffer[40];
+double avg;
+int count;
+int fd = open ("/proc/loadavg", O_RDONLY);
+if (fd == -1) return linux_slow_getloadavg();
+count = read (fd, buffer, sizeof(buffer));
+(void)close (fd);
+if (count <= 0) return linux_slow_getloadavg();
+count = sscanf (buffer, "%lf", &avg);
+if (count < 1) return linux_slow_getloadavg();
+return (int)(avg * 1000.0);
+}
+#endif /* OS_LOAD_AVERAGE */
+
+
+
+
+
+/*************************************************
+* Finding interface addresses *
+*************************************************/
+
+/* This function is not required for utilities; we cut it out if
+FIND_RUNNING_INTERFACES is already defined. */
+
+#ifndef FIND_RUNNING_INTERFACES
+
+/* This code, contributed by Jason Gunthorpe, appears to be the current
+way of finding IPv6 interfaces in Linux. It first calls the common function in
+order to find IPv4 interfaces, then grobbles around to find the others. Jason
+said, "This is so horrible, don't look. Slightly ripped from net-tools
+ifconfig." It gets called by virtue of os_find_running_interfaces being defined
+as a macro for os_find_running_interfaces_linux in the os.h-Linux file. */
+
+ip_address_item *
+os_find_running_interfaces_linux(void)
+{
+ip_address_item *yield = NULL;
+
+#if HAVE_IPV6
+ip_address_item *last = NULL;
+ip_address_item *next;
+char addr6p[8][5];
+unsigned int plen, scope, dad_status, if_idx;
+char devname[20];
+FILE *f;
+#endif
+
+yield = os_common_find_running_interfaces();
+
+#if HAVE_IPV6
+
+/* Open the /proc file; give up if we can't. */
+
+if ((f = fopen("/proc/net/if_inet6", "r")) == NULL) return yield;
+
+/* Pick out the data from within the file, and add it on to the chain */
+
+last = yield;
+if (last != NULL) while (last->next != NULL) last = last->next;
+
+while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
+ addr6p[0], addr6p[1], addr6p[2], addr6p[3],
+ addr6p[4], addr6p[5], addr6p[6], addr6p[7],
+ &if_idx, &plen, &scope, &dad_status, devname) != EOF)
+ {
+ struct sockaddr_in6 addr;
+
+ /* This data has to survive for ever, so use malloc. */
+
+ next = store_malloc(sizeof(ip_address_item));
+ next->next = NULL;
+ next->port = 0;
+ sprintf(CS next->address, "%s:%s:%s:%s:%s:%s:%s:%s",
+ addr6p[0], addr6p[1], addr6p[2], addr6p[3],
+ addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
+
+ /* Normalize the representation */
+
+ inet_pton(AF_INET6, CS next->address, &addr.sin6_addr);
+ inet_ntop(AF_INET6, &addr.sin6_addr, CS next->address, sizeof(next->address));
+
+ if (yield == NULL) yield = last = next; else
+ {
+ last->next = next;
+ last = next;
+ }
+
+ DEBUG(D_interface)
+ debug_printf("Actual local interface address is %s (%s)\n", last->address,
+ devname);
+ }
+fclose(f);
+#endif /* HAVE_IPV6 */
+
+return yield;
+}
+
+#endif /* FIND_RUNNING_INTERFACES */
+
+/* End of os.c-Linux */
diff --git a/src/OS/os.c-Linux-libc5 b/src/OS/os.c-Linux-libc5
new file mode 100644
index 000000000..cbda9e6fa
--- /dev/null
+++ b/src/OS/os.c-Linux-libc5
@@ -0,0 +1,39 @@
+/* $Cambridge: exim/src/OS/os.c-Linux-libc5,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Copyright (c) University of Cambridge 2001 */
+/* See the file NOTICE for conditions of use and distribution. */
+
+/* Linux-specific code. This is concatenated onto the generic src/os.c file.
+Linux has an apparently unique way of getting the load average, so we provide a
+unique function here, and define OS_LOAD_AVERAGE to stop src/os.c trying to
+provide the function. The macro may be set initially anyway, when compiling os.
+for utilities that don't want this function. */
+
+#ifndef OS_LOAD_AVERAGE
+#define OS_LOAD_AVERAGE
+
+int
+os_getloadavg(void)
+{
+char buffer[40];
+double avg;
+int count;
+int fd = open ("/proc/loadavg", O_RDONLY);
+if (fd == -1) return -1;
+count = read (fd, buffer, sizeof(buffer));
+(void)close (fd);
+if (count <= 0) return -1;
+count = sscanf (buffer, "%lf", &avg);
+if (count < 1) return -1;
+
+return (int)(avg * 1000.0);
+}
+
+#endif /* OS_LOAD_AVERAGE */
+
+/* End of os.c-Linux */
+
diff --git a/src/OS/os.c-OSF1 b/src/OS/os.c-OSF1
new file mode 100644
index 000000000..eb5032eaf
--- /dev/null
+++ b/src/OS/os.c-OSF1
@@ -0,0 +1,38 @@
+/* $Cambridge: exim/src/OS/os.c-OSF1,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Copyright (c) University of Cambridge 2001 */
+/* See the file NOTICE for conditions of use and distribution. */
+
+/* OSF1-specific code. This is concatenated onto the generic src/os.c file.
+OSF1 has an apparently unique way of getting the load average, so we provide a
+unique function here, and define OS_LOAD_AVERAGE to stop src/os.c trying to
+provide the function. The macro may be set initially anyway, when compiling os.
+for utilities that don't want this function. */
+
+#ifndef OS_LOAD_AVERAGE
+#define OS_LOAD_AVERAGE
+
+#include <sys/table.h>
+
+int
+os_getloadavg(void)
+{
+double avg;
+struct tbl_loadavg load_avg;
+
+table (TBL_LOADAVG, 0, &load_avg, 1, sizeof (load_avg));
+
+avg = (load_avg.tl_lscale == 0)?
+ load_avg.tl_avenrun.d[0] :
+ (load_avg.tl_avenrun.l[0] / (double)load_avg.tl_lscale);
+
+return (int)(avg * 1000.0);
+}
+
+#endif /* OS_LOAD_AVERAGE */
+
+/* End of os.c-OSF1 */
diff --git a/src/OS/os.c-cygwin b/src/OS/os.c-cygwin
new file mode 100644
index 000000000..739605590
--- /dev/null
+++ b/src/OS/os.c-cygwin
@@ -0,0 +1,652 @@
+/* $Cambridge: exim/src/OS/os.c-cygwin,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Cygwin-specific code. December 2002
+ This is concatenated onto the generic src/os.c file.
+
+ This code was supplied by Pierre A. Humblet <Pierre.Humblet@ieee.org>
+*/
+
+/* We need a special mkdir that
+ allows names starting with // */
+#undef mkdir
+int cygwin_mkdir( const char *path, mode_t mode )
+{
+ const char * p = path;
+ if (*p == '/') while(*(p+1) == '/') p++;
+ return mkdir(p, mode);
+}
+
+/* We have strsignal but cannot use #define
+ because types don't match */
+#define OS_STRSIGNAL /* src/os.c need not provide it */
+char * os_strsignal(int sig)
+{
+ return (char *) strsignal(sig);
+}
+
+#ifndef COMPILE_UTILITY /* Utilities don't need special code */
+#ifdef INCLUDE_MINIRES
+#include "../minires/minires.c"
+#include "../minires/os-interface.c"
+#endif
+
+#ifdef INCLUDE_PAM
+#include "../pam/pam.c"
+#endif
+
+unsigned int cygwin_WinVersion;
+
+/* Conflict between Windows definitions and others */
+#ifdef NOERROR
+#undef NOERROR
+#endif
+#ifdef DELETE
+#undef DELETE
+#endif
+
+#include <windows.h>
+#include <sys/cygwin.h>
+
+/* Special static variables */
+static BOOL cygwin_debug = FALSE;
+static int privileged = 1; /* when not privileged, setuid = noop */
+
+#undef setuid
+int cygwin_setuid(uid_t uid )
+{
+ int res;
+ if (privileged <= 0) return 0;
+ else {
+ res = setuid(uid);
+ if (cygwin_debug)
+ fprintf(stderr, "setuid %lu %lu %d pid: %d\n",
+ uid, getuid(),res, getpid());
+ }
+ return res;
+}
+
+#undef setgid
+int cygwin_setgid(gid_t gid )
+{
+ int res;
+ if (privileged <= 0) return 0;
+ else {
+ res = setgid(gid);
+ if (cygwin_debug)
+ fprintf(stderr, "setgid %lu %lu %d pid: %d\n",
+ gid, getgid(), res, getpid());
+ }
+ return res;
+}
+
+/* Background processes run at lower priority */
+static void setpriority()
+{
+ if (!SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS))
+ SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
+ return;
+}
+
+
+/* GetVersion()
+ MSB: 1 for 95/98/ME; Next 7: build number, except for 95/98/ME
+ Next byte: 0
+ Next byte: minor version of OS
+ Low byte: major version of OS (3 or 4 for for NT, 5 for 2000 and XP) */
+#define VERSION_IS_58M(x) (x & 0x80000000) /* 95, 98, Me */
+#define VERSION_IS_NT(x) ((x & 0XFF) < 5) /* NT 4 or 3.51 */
+
+/*
+ Routine to find if process or thread is privileged
+*/
+
+enum {
+ CREATE_BIT = 1,
+ RESTORE_BIT = 2
+};
+
+static DWORD get_privileges ()
+{
+ char buffer[1024];
+ DWORD i, length;
+ HANDLE hToken = NULL;
+ PTOKEN_PRIVILEGES privs;
+ LUID cluid, rluid;
+ DWORD ret = 0;
+
+ privs = (PTOKEN_PRIVILEGES) buffer;
+
+ if (OpenProcessToken (GetCurrentProcess(), TOKEN_QUERY, &hToken)
+ && LookupPrivilegeValue (NULL, SE_CREATE_TOKEN_NAME, &cluid)
+ && LookupPrivilegeValue(NULL, SE_RESTORE_NAME, &rluid)
+ && (GetTokenInformation( hToken, TokenPrivileges,
+ privs, sizeof (buffer), &length)
+ || (GetLastError () == ERROR_INSUFFICIENT_BUFFER
+ && (privs = (PTOKEN_PRIVILEGES) alloca (length))
+ && GetTokenInformation(hToken, TokenPrivileges,
+ privs, length, &length)))) {
+ for (i = 0; i < privs->PrivilegeCount; i++) {
+ if (privs->Privileges[i].Luid.QuadPart == cluid.QuadPart)
+ ret |= CREATE_BIT;
+ else if (privs->Privileges[i].Luid.QuadPart == rluid.QuadPart)
+ ret |= RESTORE_BIT;
+ else continue;
+ if (ret == (CREATE_BIT | RESTORE_BIT))
+ break;
+ }
+ }
+ else
+ fprintf(stderr, "has_create_token_privilege %ld\n", GetLastError());
+
+ if (hToken)
+ CloseHandle(hToken);
+
+ return ret;
+}
+
+/* We use a special routine to initialize
+ cygwin_init is called from the OS_INIT macro in main(). */
+
+void cygwin_init(int argc, char ** argv, void * rup,
+ void * eup, void * egp, void * cup)
+{
+ int i;
+ uid_t myuid, systemuid;
+ gid_t mygid, adminsgid;
+ struct passwd * pwp;
+ char *cygenv, win32_path[MAX_PATH];
+ SID(1, SystemSid, SECURITY_LOCAL_SYSTEM_RID);
+ SID(2, AdminsSid, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS);
+ DWORD priv_flags;
+
+ myuid = getuid();
+ mygid = getgid();
+ cygwin_WinVersion = GetVersion();
+ if ((cygenv = getenv("CYGWIN")) == NULL) cygenv = "";
+ /* Produce some debugging on stderr,
+ cannot yet use exim's debug functions.
+ Exim does not use -c and ignores -n.
+ Set lower priority for daemons */
+ for (i = 1; i < argc; i++) {
+ if (argv[i][0] == '-') {
+ if (argv[i][1] == 'c') {
+ argv[i][1] = 'n'; /* Replace -c by -n */
+ cygwin_debug = TRUE;
+ fprintf(stderr, "CYGWIN = \"%s\".", cygenv);
+ cygwin_conv_to_win32_path("/", win32_path);
+ fprintf(stderr, " Root / mapped to %s.\n", win32_path);
+ }
+ else if (argv[i][1] == 'b' && argv[i][2] == 'd')
+ setpriority();
+ }
+ }
+ if (VERSION_IS_58M(cygwin_WinVersion)) {
+ * (uid_t *) rup = myuid; /* Pretend we are root */
+ * (uid_t *) eup = myuid; /* ... and exim */
+ * (gid_t *) egp = mygid;
+ return;
+ }
+ /* Nt/2000/XP
+ We initially set the exim uid & gid to those of the "real exim",
+ or to the root uid (SYSTEM) and exim gid (ADMINS),
+ If privileged, we setuid to those.
+ We always set the configure uid to the system uid.
+ We always set the root uid to the real uid
+ to avoid useless execs following forks.
+ If not privileged and unable to chown,
+ we set the exim uid to our uid.
+ If unprivileged, we fake all subsequent setuid. */
+
+ priv_flags = get_privileges ();
+ privileged = !!(priv_flags & CREATE_BIT);
+
+ /* Get the system and admins uid from their sids,
+ or use the default values from the Makefile. */
+ if ((systemuid = cygwin_internal(CW_GET_UID_FROM_SID, & SystemSid)) == -1)
+ systemuid = * (uid_t *) eup;
+ if ((adminsgid = cygwin_internal(CW_GET_GID_FROM_SID, & AdminsSid)) == -1)
+ adminsgid = * (gid_t *) egp;
+
+ if ((pwp = getpwnam("exim")) != NULL) {
+ * (uid_t *) eup = pwp->pw_uid; /* Set it according to passwd */
+ * (gid_t *) egp = pwp->pw_gid;
+ }
+ else {
+ * (uid_t *) eup = systemuid;
+ * (gid_t *) egp = adminsgid;
+ }
+
+ /* Set the configuration uid to the system uid.
+ Note that exim uid is also accepted as owner of exim.conf. */
+ * (uid_t *) cup = systemuid;
+
+ if (privileged) { /* Can setuid */
+ if (cygwin_setgid(* (gid_t *) egp) /* Setuid to exim */
+ || cygwin_setuid(* (uid_t *) eup))
+ privileged = -1; /* Problem... Perhaps not in 544 */
+ }
+
+ /* Pretend we are root to avoid useless execs.
+ We are limited by file access rights */
+ * (uid_t *) rup = getuid ();
+
+ /* If we have not setuid to exim and cannot chown,
+ set the exim uid to our uid to avoid chown failures */
+ if (privileged <= 0 && !(priv_flags & RESTORE_BIT))
+ * (uid_t *) eup = * (uid_t *) rup;
+
+ if (cygwin_debug) {
+ fprintf(stderr, "Starting uid %ld, gid %ld, ntsec %lu, privileged %d.\n",
+ myuid, mygid, cygwin_internal(CW_CHECK_NTSEC, NULL), privileged);
+ fprintf(stderr, "root_uid %ld, exim_uid %ld, exim_gid %ld, config_uid %ld.\n",
+ * (uid_t *) rup, * (uid_t *) eup, * (gid_t *) egp, * (uid_t *) cup);
+ }
+ return;
+}
+
+/*****************************************************************
+ *
+ Functions for average load measurements
+
+ Obtaining statistics in Windows is done at a low level by
+ calling registry functions, in particular the key
+ HKEY_PERFORMANCE_DATA on NT and successors.
+ Something equivalent exists on Win95, see Microsoft article
+ HOWTO: Access the Performance Registry Under Windows 95 (Q174631)
+ but it is not implemented here.
+
+ The list of objects to be polled is specified in the string
+ passed to RegQueryValueEx in ReadStat() below.
+ On NT, all objects are polled even if info about only one is
+ required. This is fixed in Windows 2000. See articles
+ INFO: Perflib Calling Close Procedure in Windows 2000 (Q270127)
+ INFO: Performance Data Changes Between Windows NT 4.0 and Windows
+ 2000 (Q296523)
+
+ It is unclear to me how the counters are primarily identified.
+ Whether it's by name strings or by the offset of their strings
+ as mapped in X:\Winnt\system32\perfc009.dat [or equivalently as
+ reported by the registry functions in GetNameStrings( ) below].
+ Microsoft documentation seems to say that both methods should
+ work.
+
+ In the interest of speed and language independence, the main
+ code below relies on offsets. However if debug is enabled, the
+ code verifies that the names of the corresponding strings are
+ as expected.
+
+*****************************************************************/
+#ifndef OS_LOAD_AVERAGE /* Can be set on command line */
+#define OS_LOAD_AVERAGE /* src/os.c need not provide it */
+
+/* Object and counter indices and names */
+#define PROCESSOR_OBJECT_INDEX 238
+#define PROCESSOR_OBJECT_STRING "238"
+#define PROCESSOR_OBJECT_NAME "Processor"
+#define PROCESSOR_TIME_COUNTER 6
+#define PROCESSOR_TIME_NAME "% Processor Time"
+
+/* Structure to compute the load average efficiently */
+static struct {
+ long long Time100ns; /* Last measurement time */
+ long long IdleCount; /* Latest cumulative idle time */
+ long long LastCounter; /* Last measurement counter */
+ long long PerfFreq; /* Perf counter frequency */
+ PPERF_DATA_BLOCK PerfData; /* Pointer to a buffer to get the data */
+ DWORD BufferSize; /* Size of PerfData */
+ int LastLoad; /* Last reported load, or -1 */
+ LPSTR * NamesArray; /* Temporary (malloc) buffer for index */
+ BOOL Init; /* True if initialized */
+} cygwin_load = { 0, 0, 0, 0, NULL, 0, 0, NULL, FALSE};
+
+#define BYTEINCREMENT 800 /* Block to add to PerfData */
+
+/*****************************************************************
+ *
+ Macros to navigate through the performance data.
+
+ *****************************************************************/
+#define FirstObject(PerfData)\
+ ((PPERF_OBJECT_TYPE)((PBYTE)PerfData + PerfData->HeaderLength))
+#define NextObject(PerfObj)\
+ ((PPERF_OBJECT_TYPE)((PBYTE)PerfObj + PerfObj->TotalByteLength))
+#define ObjectCounterBlock(PerfObj)\
+ ((PPERF_COUNTER_BLOCK)(PBYTE)PerfObj + PerfObj->DefinitionLength )
+#define FirstInstance(PerfObj )\
+ ((PPERF_INSTANCE_DEFINITION)((PBYTE)PerfObj + PerfObj->DefinitionLength))
+#define InstanceCounterBlock(PerfInst)\
+ ((PPERF_COUNTER_BLOCK) ((PBYTE)PerfInst + PerfInst->ByteLength ))
+#define NextInstance(PerfInst )\
+ ((PPERF_INSTANCE_DEFINITION)((PBYTE)InstanceCounterBlock(PerfInst) + \
+ InstanceCounterBlock(PerfInst)->ByteLength) )
+#define FirstCounter(PerfObj)\
+ ((PPERF_COUNTER_DEFINITION) ((PBYTE)PerfObj + PerfObj->HeaderLength))
+#define NextCounter(PerfCntr)\
+ ((PPERF_COUNTER_DEFINITION)((PBYTE)PerfCntr + PerfCntr->ByteLength))
+
+/*****************************************************************
+ *
+ Load the counter and object names from the registry
+ to cygwin_load.NameStrings
+ and index them in cygwin_load.NamesArray
+
+ NameStrings seems to be taken from the file
+ X:\Winnt\system32\perfc009.dat
+
+ This is used only for name verification during initialization,
+ if DEBUG(D_load) is TRUE.
+
+*****************************************************************/
+static BOOL GetNameStrings( )
+{
+ HKEY hKeyPerflib; // handle to registry key
+ DWORD dwArraySize; // size for array
+ DWORD dwNamesSize; // size for strings
+ LPSTR lpCurrentString; // pointer for enumerating data strings
+ DWORD dwCounter; // current counter index
+ LONG res;
+
+ /* Get the number of Counter items into dwArraySize. */
+ if ((res = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib",
+ 0,
+ KEY_QUERY_VALUE, /* KEY_READ, */
+ &hKeyPerflib))
+ != ERROR_SUCCESS) {
+ DEBUG(D_load) debug_printf("RegOpenKeyEx (1): error %ld (Windows)\n", res);
+ return FALSE;
+ }
+ dwNamesSize = sizeof(dwArraySize); /* Temporary reuse */
+ if ((res = RegQueryValueEx( hKeyPerflib,
+ "Last Counter",
+ NULL,
+ NULL,
+ (LPBYTE) &dwArraySize,
+ &dwNamesSize ))
+ != ERROR_SUCCESS) {
+ DEBUG(D_load) debug_printf("RegQueryValueEx (1): error %ld (Windows)\n", res);
+ return FALSE;
+ }
+ RegCloseKey( hKeyPerflib );
+ /* Open the key containing the counter and object names. */
+ if ((res = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009",
+ 0,
+ KEY_READ,
+ &hKeyPerflib))
+ != ERROR_SUCCESS) {
+ DEBUG(D_load) debug_printf("RegOpenKeyEx (2): error %ld (Windows)\n", res);
+ return FALSE;
+ }
+ /* Get the size of the Counter value in the key
+ and then read the value in the tail of NamesArray */
+ dwNamesSize = 0;
+ lpCurrentString = NULL;
+ while (1) {
+ res = RegQueryValueEx( hKeyPerflib,
+ "Counter",
+ NULL,
+ NULL,
+ (unsigned char *) lpCurrentString,
+ &dwNamesSize);
+ if ((res == ERROR_SUCCESS) && /* Bug (NT 4.0): SUCCESS was returned on first call */
+ (cygwin_load.NamesArray != NULL)) break;
+ if ((res == ERROR_SUCCESS) || /* but cygwin_load.NamesArrays == NULL */
+ (res == ERROR_MORE_DATA)) {
+ /* Allocate memory BOTH for the names array and for the counter and object names */
+ if ((cygwin_load.NamesArray =
+ (LPSTR *) malloc( (dwArraySize + 1) * sizeof(LPSTR) + dwNamesSize * sizeof(CHAR)))
+ != NULL) {
+ /* Point to area for the counter and object names */
+ lpCurrentString = (LPSTR) & cygwin_load.NamesArray[dwArraySize + 1];
+ continue;
+ }
+ DEBUG(D_load) debug_printf("Malloc: errno %d (%s)\n", errno, strerror(errno));
+ }
+ else { /* Serious error */
+ DEBUG(D_load) debug_printf("RegQueryValueEx (2): error %ld (Windows)\n", res);
+ }
+ return FALSE;
+ }
+ RegCloseKey( hKeyPerflib );
+ /* Index the names into an array. */
+ while (*lpCurrentString) {
+ dwCounter = atol( lpCurrentString );
+ lpCurrentString += (lstrlen(lpCurrentString)+1);
+ cygwin_load.NamesArray[dwCounter] = lpCurrentString;
+ lpCurrentString += (strlen(lpCurrentString)+1);
+ }
+ return TRUE;
+}
+
+/*****************************************************************
+ *
+ Find the value of the Processor Time counter
+
+*****************************************************************/
+static BOOL ReadTimeCtr(PPERF_OBJECT_TYPE PerfObj,
+ PPERF_COUNTER_DEFINITION CurCntr,
+ PPERF_COUNTER_BLOCK PtrToCntr,
+ unsigned long long * TimePtr){
+ int j;
+ /* Scan all counters. */
+ for( j = 0; j < PerfObj->NumCounters; j++ ) {
+ if (CurCntr->CounterNameTitleIndex == PROCESSOR_TIME_COUNTER) {
+ /* Verify it is really the proc time counter */
+ if ((CurCntr->CounterType != PERF_100NSEC_TIMER_INV) || /* Wrong type */
+ ((cygwin_load.NamesArray != NULL) && /* Verify name */
+ (strcmp(cygwin_load.NamesArray[CurCntr->CounterNameTitleIndex],
+ PROCESSOR_TIME_NAME)))) {
+ log_write(0, LOG_MAIN|LOG_PANIC,
+ "Incorrect Perf counter type or name %x %s",
+ (unsigned) CurCntr->CounterType,
+ cygwin_load.NamesArray[CurCntr->CounterNameTitleIndex]);
+ return FALSE;
+ }
+ *TimePtr += *(unsigned long long int *) ((PBYTE) PtrToCntr + CurCntr->CounterOffset);
+ return TRUE; /* return TRUE as soon as we found the counter */
+ }
+ /* Get the next counter. */
+ CurCntr = NextCounter( CurCntr );
+ }
+ return FALSE;
+}
+/*****************************************************************
+ *
+ ReadStat()
+ Measures current Time100ns and IdleCount
+ Return TRUE if success.
+
+ *****************************************************************/
+static BOOL ReadStat(long long int *Time100nsPtr,
+ long long int * IdleCountPtr)
+{
+ PPERF_OBJECT_TYPE PerfObj;
+ PPERF_INSTANCE_DEFINITION PerfInst;
+ PPERF_COUNTER_DEFINITION PerfCntr;
+ PPERF_COUNTER_BLOCK PtrToCntr;
+ DWORD i, k, res;
+
+ /* Get the performance data for the Processor object
+ There is no need to open a key.
+ We may need to blindly increase the buffer size.
+ BufferSize does not return info but may be changed */
+ while (1) {
+ DWORD BufferSize = cygwin_load.BufferSize;
+ res = RegQueryValueEx( HKEY_PERFORMANCE_DATA,
+ PROCESSOR_OBJECT_STRING,
+ NULL,
+ NULL,
+ (LPBYTE) cygwin_load.PerfData,
+ &BufferSize );
+ if (res == ERROR_SUCCESS) break;
+ if (res == ERROR_MORE_DATA ) {
+ /* Increment if necessary to get a buffer that is big enough. */
+ cygwin_load.BufferSize += BYTEINCREMENT;
+ if ((cygwin_load.PerfData =
+ (PPERF_DATA_BLOCK) realloc( cygwin_load.PerfData, cygwin_load.BufferSize ))
+ != NULL) continue;
+ DEBUG(D_load) debug_printf("Malloc: errno %d (%s)\n", errno, strerror(errno));
+ }
+ else { /* Serious error */
+ DEBUG(D_load) debug_printf("RegQueryValueEx (3): error %ld (Windows)\n", res);
+ }
+ return FALSE;
+ }
+ /* Initialize the counters */
+ *Time100nsPtr = 0;
+ *IdleCountPtr = 0;
+ /* We should only have one object, but write general code just in case. */
+ PerfObj = FirstObject( cygwin_load.PerfData );
+ for( i = 0; i < cygwin_load.PerfData->NumObjectTypes; i++ ) {
+ /* We are only interested in the processor object */
+ if ( PerfObj->ObjectNameTitleIndex == PROCESSOR_OBJECT_INDEX) {
+ /* Possibly verify it is really the Processor object. */
+ if ((cygwin_load.NamesArray != NULL) &&
+ (strcmp(cygwin_load.NamesArray[PerfObj->ObjectNameTitleIndex],
+ PROCESSOR_OBJECT_NAME))) {
+ log_write(0, LOG_MAIN|LOG_PANIC,
+ "Incorrect Perf object name %s",
+ cygwin_load.NamesArray[PerfObj->ObjectNameTitleIndex]);
+ return FALSE;
+ }
+ /* Get the first counter */
+ PerfCntr = FirstCounter( PerfObj );
+ /* See if the object has instances.
+ It should, but write general code. */
+ if( PerfObj->NumInstances != PERF_NO_INSTANCES ) {
+ PerfInst = FirstInstance( PerfObj );
+ for( k = 0; k < PerfObj->NumInstances; k++ ) {
+ /* There can be several processors.
+ Accumulate both the Time100ns and the idle counter.
+ On Win 2000 I have seen an instance named "_Total".
+ Do not use it. We only use instances with a single
+ character in the name.
+ If we examine the object names, we also look at the instance
+ names and their lengths and issue reports */
+ if ( cygwin_load.NamesArray != NULL) {
+ CHAR ascii[30]; /* The name is in unicode */
+ wsprintf(ascii,"%.29lS",
+ (char *)((PBYTE)PerfInst + PerfInst->NameOffset));
+ log_write(0, LOG_MAIN,
+ "Perf: Found processor instance \"%s\", length %d",
+ ascii, PerfInst->NameLength);
+ if ((PerfInst->NameLength != 4) &&
+ (strcmp(ascii, "_Total") != 0)) {
+ log_write(0, LOG_MAIN|LOG_PANIC,
+ "Perf: WARNING: Unexpected processor instance name");
+ return FALSE;
+ }
+ }
+ if (PerfInst->NameLength == 4) {
+ *Time100nsPtr += cygwin_load.PerfData->PerfTime100nSec.QuadPart;
+ PtrToCntr = InstanceCounterBlock(PerfInst);
+ if (! ReadTimeCtr(PerfObj, PerfCntr, PtrToCntr, IdleCountPtr)) {
+ return FALSE;
+ }
+ }
+ PerfInst = NextInstance( PerfInst );
+ }
+ return (*Time100nsPtr != 0); /* Something was read */
+ }
+ else { /* No instance, just the counter data */
+ *Time100nsPtr = cygwin_load.PerfData->PerfTime100nSec.QuadPart;
+ PtrToCntr = ObjectCounterBlock(PerfObj);
+ return ReadTimeCtr(PerfObj, PerfCntr, PtrToCntr, IdleCountPtr);
+ }
+ }
+ PerfObj = NextObject( PerfObj );
+ }
+ return FALSE; /* Did not find the Processor object */
+}
+
+/*****************************************************************
+ *
+ InitLoadAvg()
+ Initialize the cygwin_load structure.
+ and set cygwin_load.Flag to TRUE if successful.
+ This is called the first time os_getloadavg is called
+ *****************************************************************/
+static void InitLoadAvg()
+{
+ BOOL success = TRUE;
+ cygwin_load.Init = TRUE; /* We have run */
+ /* Get perf frequency and counter */
+ QueryPerformanceFrequency((LARGE_INTEGER *)& cygwin_load.PerfFreq);
+ QueryPerformanceCounter((LARGE_INTEGER *)& cygwin_load.LastCounter);
+ DEBUG(D_load) {
+ /* Get the name strings through the registry
+ to verify that the object and counter numbers
+ have the names we expect */
+ success = GetNameStrings();
+ }
+ /* Get initial values for Time100ns and IdleCount
+ and possibly verify the names */
+ // success = success &&
+ success = ReadStat( & cygwin_load.Time100ns,
+ & cygwin_load.IdleCount);
+ /* If success, set the Load to 0, else to -1 */
+ if (success) cygwin_load.LastLoad = 0;
+ else {
+ log_write(0, LOG_MAIN, "Cannot obtain Load Average");
+ cygwin_load.LastLoad = -1;
+ }
+ /* Free the buffer created for debug name verification */
+ if (cygwin_load.NamesArray != NULL) {
+ free(cygwin_load.NamesArray);
+ cygwin_load.NamesArray = NULL;
+ }
+}
+/*****************************************************************
+ *
+ os_getloadavg()
+
+ Return -1 if not available;
+ Return the previous value if less than AVERAGING sec old.
+ else return the processor load on a [0 - 1000] scale.
+
+ The first time we are called we initialize the counts
+ and return 0 or -1.
+ The load cannot be measured because we use the processor 100%
+*****************************************************************/
+#define AVERAGING 10
+int os_getloadavg()
+{
+ long long Time100ns, IdleCount, CurrCounter;
+ int value;
+
+ if (! cygwin_load.Init) InitLoadAvg();
+ else if (cygwin_load.LastLoad >= 0) { /* Initialized OK */
+ /* Get the current time (PerfCounter) */
+ QueryPerformanceCounter((LARGE_INTEGER *)& CurrCounter);
+ /* Calls closer than AVERAGING sec apart use the previous value */
+ if (CurrCounter - cygwin_load.LastCounter >
+ AVERAGING * cygwin_load.PerfFreq) {
+ /* Get Time100ns and IdleCount */
+ if (ReadStat( & Time100ns, & IdleCount)) { /* Success */
+ /* Return processor load on 1000 scale */
+ value = 1000 - ((1000 * (IdleCount - cygwin_load.IdleCount)) /
+ (Time100ns - cygwin_load.Time100ns));
+ cygwin_load.Time100ns = Time100ns;
+ cygwin_load.IdleCount = IdleCount;
+ cygwin_load.LastCounter = CurrCounter;
+ cygwin_load.LastLoad = value;
+ }
+ else { /* Something bad happened.
+ Refuse to measure the load anymore
+ but don't bother releasing the buffer */
+ log_write(0, LOG_MAIN, "Cannot obtain Load Average");
+ cygwin_load.LastLoad = -1;
+ }
+ }
+ }
+ DEBUG(D_load)
+ debug_printf("Perf: load average = %d\n", cygwin_load.LastLoad);
+ return cygwin_load.LastLoad;
+}
+#endif /* OS_LOAD_AVERAGE */
+#endif /* COMPILE_UTILITY */
diff --git a/src/OS/os.h-AIX b/src/OS/os.h-AIX
new file mode 100644
index 000000000..29a2903a3
--- /dev/null
+++ b/src/OS/os.h-AIX
@@ -0,0 +1,25 @@
+/* $Cambridge: exim/src/OS/os.h-AIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for AIX */
+/* Written by Nick Waterman <nick@cimio.co.uk> */
+/* Modified by Philip Hazel with data from
+ Niels Provos <provos@wserver.physnet.uni-hamburg.de>
+ Juozas Simkevicius <juozas@omnitel.net> for load averages
+*/
+
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/unix"
+#define LOAD_AVG_TYPE int
+#define FSCALE 65536.0
+
+#define HAVE_SYS_VFS_H
+#define HAVE_SYS_STATFS_H
+
+/* Now tell AIX to emulate BSD as badly as it can. */
+
+#define _BSD 44
+
+typedef struct flock flock_t;
+
+/* End */
diff --git a/src/OS/os.h-BSDI b/src/OS/os.h-BSDI
new file mode 100644
index 000000000..09b646197
--- /dev/null
+++ b/src/OS/os.h-BSDI
@@ -0,0 +1,12 @@
+/* $Cambridge: exim/src/OS/os.h-BSDI,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for BSDI */
+
+#define HAVE_BSD_GETLOADAVG
+#define HAVE_MMAP
+#define HAVE_SYS_MOUNT_H
+#define SIOCGIFCONF_GIVES_ADDR
+
+typedef struct flock flock_t;
+
+/* End */
diff --git a/src/OS/os.h-DGUX b/src/OS/os.h-DGUX
new file mode 100644
index 000000000..4f9c6746f
--- /dev/null
+++ b/src/OS/os.h-DGUX
@@ -0,0 +1,27 @@
+/* $Cambridge: exim/src/OS/os.h-DGUX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for DGUX */
+
+/* Written by Ken Bailey (K.Bailey@rbgkew.org.uk) Feb 1998 */
+/* on dgux R4.11MU04 generic AViiON mc88100 */
+/* Modified Dec 1998 by PH after message from Ken. */
+
+#define HAVE_SYS_STATVFS_H
+#define F_FAVAIL f_favail
+
+#define NO_SYSEXITS /* DGUX doesn't ship sysexits.h */
+#define NO_IP_VAR_H /* DGUX has no netinet/ip_var.h */
+
+#define os_strsignal dg_strsignal
+#define OS_STRSIGNAL
+
+#define HAVE_MMAP
+
+/* The definition of ipoptions in netinet/in.h (masquerading as ip_opts) used
+in smtp_in.c is for Intel DG _IX86_ABI only. You may be able to get this to
+work on Intel DG but it's certainly easier to skip it on M88k. This means we
+forego the detection of some source-routing based IP attacks. */
+
+#define NO_IP_OPTIONS
+
+/* End */
diff --git a/src/OS/os.h-Darwin b/src/OS/os.h-Darwin
new file mode 100644
index 000000000..3a716376d
--- /dev/null
+++ b/src/OS/os.h-Darwin
@@ -0,0 +1,29 @@
+/* $Cambridge: exim/src/OS/os.h-Darwin,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for Darwin (Mac OS X) */
+
+/* #define CRYPT_H */ /* Apparently this isn't needed */
+
+#define HAVE_MMAP
+#define HAVE_SYS_MOUNT_H
+#define PAM_H_IN_PAM
+#define SIOCGIFCONF_GIVES_ADDR
+
+#define F_FREESP O_TRUNC
+typedef struct flock flock_t;
+
+#define BASE_62 36 /* HFS+ aliases lower and upper cases in filenames.
+ Consider reducing MAX_LOCALHOST_NUMBER */
+
+#ifndef _BSD_SOCKLEN_T_
+#define _BSD_SOCKLEN_T_ int32_t /* socklen_t (duh) */
+#endif
+
+/* Settings for handling IP options. There's no netinet/ip_var.h. The IP
+option handling is in the style of the later GLIBCs but the GLIBC macros
+aren't set, so we invent a new one. */
+
+#define NO_IP_VAR_H
+#define DARWIN_IP_OPTIONS
+
+/* End */
diff --git a/src/OS/os.h-FreeBSD b/src/OS/os.h-FreeBSD
new file mode 100644
index 000000000..9a2da7a5a
--- /dev/null
+++ b/src/OS/os.h-FreeBSD
@@ -0,0 +1,12 @@
+/* $Cambridge: exim/src/OS/os.h-FreeBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for FreeBSD */
+
+#define HAVE_BSD_GETLOADAVG
+#define HAVE_MMAP
+#define HAVE_SYS_MOUNT_H
+#define SIOCGIFCONF_GIVES_ADDR
+
+typedef struct flock flock_t;
+
+/* End */
diff --git a/src/OS/os.h-GNU b/src/OS/os.h-GNU
new file mode 100644
index 000000000..6d44d5a2d
--- /dev/null
+++ b/src/OS/os.h-GNU
@@ -0,0 +1,20 @@
+/* $Cambridge: exim/src/OS/os.h-GNU,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for GNU/Hurd */
+
+#define CRYPT_H
+#define HAVE_MMAP
+#define HAVE_SYS_VFS_H
+#define NO_IP_VAR_H
+#define NO_NET_IF_H
+#define NO_FIND_INTERFACES
+#define SETRLIMIT_NOT_SUPPORTED
+#define GLIBC_IP_OPTIONS
+
+#define F_FREESP O_TRUNC
+typedef struct flock flock_t;
+
+#define os_strsignal strsignal
+#define OS_STRSIGNAL
+
+/* End */
diff --git a/src/OS/os.h-HI-OSF b/src/OS/os.h-HI-OSF
new file mode 100644
index 000000000..82c077d69
--- /dev/null
+++ b/src/OS/os.h-HI-OSF
@@ -0,0 +1,11 @@
+/* $Cambridge: exim/src/OS/os.h-HI-OSF,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for HI-OSF/1-MJ and HI-UX/MPP */
+
+#define HAVE_SYS_MOUNT_H
+
+typedef struct flock flock_t;
+#define F_FREESP O_TRUNC
+#define DN_EXPAND_ARG4_TYPE u_char *
+
+/* End */
diff --git a/src/OS/os.h-HI-UX b/src/OS/os.h-HI-UX
new file mode 100644
index 000000000..e6f5fdf61
--- /dev/null
+++ b/src/OS/os.h-HI-UX
@@ -0,0 +1,20 @@
+/* $Cambridge: exim/src/OS/os.h-HI-UX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for HI-UX */
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE double
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/HI-UX"
+#define FSCALE 1.0
+
+#define HAVE_SYS_VFS_H
+
+#define SELECT_ARG2_TYPE int
+#define F_FREESP O_TRUNC
+#define NEED_H_ERRNO 1
+
+typedef struct flock flock_t;
+
+/* End */
diff --git a/src/OS/os.h-HP-UX b/src/OS/os.h-HP-UX
new file mode 100644
index 000000000..fda838de4
--- /dev/null
+++ b/src/OS/os.h-HP-UX
@@ -0,0 +1,19 @@
+/* $Cambridge: exim/src/OS/os.h-HP-UX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for HP-UX versions greater than 9 */
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE double
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/hp-ux"
+#define FSCALE 1.0
+
+#define HAVE_SYS_STATVFS_H
+
+#define F_FREESP O_TRUNC
+#define NEED_H_ERRNO 1
+
+typedef struct flock flock_t;
+
+/* End */
diff --git a/src/OS/os.h-HP-UX-9 b/src/OS/os.h-HP-UX-9
new file mode 100644
index 000000000..c7e3604c3
--- /dev/null
+++ b/src/OS/os.h-HP-UX-9
@@ -0,0 +1,22 @@
+/* $Cambridge: exim/src/OS/os.h-HP-UX-9,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for HP-UX version 9 */
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE double
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/hp-ux"
+#define FSCALE 1.0
+
+#define HAVE_SYS_VFS_H
+
+#define SELECT_ARG2_TYPE int
+#define F_FREESP O_TRUNC
+#define NEED_H_ERRNO 1
+
+#define killpg(pgid,sig) kill(-(pgid),sig)
+
+typedef struct flock flock_t;
+
+/* End */
diff --git a/src/OS/os.h-IRIX b/src/OS/os.h-IRIX
new file mode 100644
index 000000000..934fa315d
--- /dev/null
+++ b/src/OS/os.h-IRIX
@@ -0,0 +1,22 @@
+/* $Cambridge: exim/src/OS/os.h-IRIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for IRIX */
+
+#define DN_EXPAND_ARG4_TYPE u_char *
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE long
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/unix"
+#define FSCALE 1000.0
+
+#define HAVE_MMAP
+#define HAVE_SYS_STATVFS_H
+#define F_FAVAIL f_favail
+#define vfork fork
+
+/* Other OS have "const" in here */
+#define ICONV_ARG2_TYPE char **
+
+/* End */
diff --git a/src/OS/os.h-IRIX6 b/src/OS/os.h-IRIX6
new file mode 100644
index 000000000..b2d6306a4
--- /dev/null
+++ b/src/OS/os.h-IRIX6
@@ -0,0 +1,21 @@
+/* $Cambridge: exim/src/OS/os.h-IRIX6,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for IRIX */
+
+#define CRYPT_H
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE long
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/unix"
+#define FSCALE 1000.0
+
+#define HAVE_MMAP
+#define HAVE_SYS_STATVFS_H
+#define F_FAVAIL f_favail
+#define vfork fork
+
+/* Other OS have "const" in here */
+#define ICONV_ARG2_TYPE char **
+
+/* End */
diff --git a/src/OS/os.h-IRIX632 b/src/OS/os.h-IRIX632
new file mode 100644
index 000000000..f4d368482
--- /dev/null
+++ b/src/OS/os.h-IRIX632
@@ -0,0 +1,23 @@
+/* $Cambridge: exim/src/OS/os.h-IRIX632,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for IRIX */
+
+#define CRYPT_H
+#define DN_EXPAND_ARG4_TYPE u_char *
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE long
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/unix"
+#define FSCALE 1000.0
+
+#define HAVE_MMAP
+#define HAVE_SYS_STATVFS_H
+#define F_FAVAIL f_favail
+#define vfork fork
+
+/* Other OS have "const" in here */
+#define ICONV_ARG2_TYPE char **
+
+/* End */
diff --git a/src/OS/os.h-IRIX65 b/src/OS/os.h-IRIX65
new file mode 100644
index 000000000..6c08fd2d0
--- /dev/null
+++ b/src/OS/os.h-IRIX65
@@ -0,0 +1,21 @@
+/* $Cambridge: exim/src/OS/os.h-IRIX65,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for IRIX 6.5 */
+
+#define CRYPT_H
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE long
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/unix"
+#define FSCALE 1000.0
+
+#define HAVE_MMAP
+#define HAVE_SYS_STATVFS_H
+#define F_FAVAIL f_favail
+#define vfork fork
+
+/* Other OS have "const" in here */
+#define ICONV_ARG2_TYPE char **
+
+/* End */
diff --git a/src/OS/os.h-Linux b/src/OS/os.h-Linux
new file mode 100644
index 000000000..f89ea7adb
--- /dev/null
+++ b/src/OS/os.h-Linux
@@ -0,0 +1,39 @@
+/* $Cambridge: exim/src/OS/os.h-Linux,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for Linux */
+
+#define CRYPT_H
+#define GLIBC_IP_OPTIONS
+#define HAVE_MMAP
+#define HAVE_SYS_VFS_H
+#define NO_IP_VAR_H
+#define SIOCGIFCONF_GIVES_ADDR
+#define SIG_IGN_WORKS
+
+/* Some versions of Linux need explicit sync-ing of directories as well as
+files. This setting requests that. If the directory is on NFS, it may not
+be possible to sync it - in that case, Exim now should ignore the error. But
+if you have problems in that area, try undefining this. But be aware that you
+may be in a situation where files are not being properly "committed to stable
+storage" as quickly as Exim thinks they are. */
+
+#define NEED_SYNC_DIRECTORY
+
+/* Other OS have "const" in here */
+#define ICONV_ARG2_TYPE char **
+
+#define F_FREESP O_TRUNC
+typedef struct flock flock_t;
+
+#define os_strsignal strsignal
+#define OS_STRSIGNAL
+
+#define os_find_running_interfaces os_find_running_interfaces_linux
+
+/* Need a prototype for the Linux-specific function. The structure hasn't
+been defined yet, so we need to pre-declare it. */
+
+struct ip_address_item;
+extern struct ip_address_item *os_find_running_interfaces_linux(void);
+
+/* End */
diff --git a/src/OS/os.h-Linux-libc5 b/src/OS/os.h-Linux-libc5
new file mode 100644
index 000000000..56bbd50d1
--- /dev/null
+++ b/src/OS/os.h-Linux-libc5
@@ -0,0 +1,13 @@
+/* $Cambridge: exim/src/OS/os.h-Linux-libc5,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for Linux */
+
+#define HAVE_MMAP
+#define HAVE_SYS_VFS_H
+#define NO_IP_VAR_H
+#define GLIBC_IP_OPTIONS
+
+#define F_FREESP O_TRUNC
+typedef struct flock flock_t;
+
+/* End */
diff --git a/src/OS/os.h-NetBSD b/src/OS/os.h-NetBSD
new file mode 100644
index 000000000..e07186bf3
--- /dev/null
+++ b/src/OS/os.h-NetBSD
@@ -0,0 +1,15 @@
+/* $Cambridge: exim/src/OS/os.h-NetBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for NetBSD */
+
+#define HAVE_BSD_GETLOADAVG
+#define HAVE_MMAP
+#define HAVE_SYS_MOUNT_H
+#define SIOCGIFCONF_GIVES_ADDR
+
+typedef struct flock flock_t;
+
+#define os_strsignal strsignal
+#define OS_STRSIGNAL
+
+/* End */
diff --git a/src/OS/os.h-NetBSD-a.out b/src/OS/os.h-NetBSD-a.out
new file mode 100644
index 000000000..0c59d601c
--- /dev/null
+++ b/src/OS/os.h-NetBSD-a.out
@@ -0,0 +1,7 @@
+/* $Cambridge: exim/src/OS/os.h-NetBSD-a.out,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for NetBSD (a.out binary format) */
+
+#include "../OS/os.h-NetBSD" /* Same as for ELF format */
+
+/* End */
diff --git a/src/OS/os.h-OSF1 b/src/OS/os.h-OSF1
new file mode 100644
index 000000000..1aa4ff95d
--- /dev/null
+++ b/src/OS/os.h-OSF1
@@ -0,0 +1,13 @@
+/* $Cambridge: exim/src/OS/os.h-OSF1,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for OSF1 */
+
+#define HAVE_SYS_MOUNT_H
+#define HAVE_GETIPNODEBYNAME 1
+
+typedef struct flock flock_t;
+#define F_FREESP O_TRUNC
+
+#define SOCKLEN_T size_t
+
+/* End */
diff --git a/src/OS/os.h-OpenBSD b/src/OS/os.h-OpenBSD
new file mode 100644
index 000000000..60eceb285
--- /dev/null
+++ b/src/OS/os.h-OpenBSD
@@ -0,0 +1,15 @@
+/* $Cambridge: exim/src/OS/os.h-OpenBSD,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for OpenBSD */
+
+#define HAVE_BSD_GETLOADAVG
+#define HAVE_MMAP
+#define HAVE_SYS_MOUNT_H
+#define SIOCGIFCONF_GIVES_ADDR
+
+typedef struct flock flock_t;
+
+#define os_strsignal strsignal
+#define OS_STRSIGNAL
+
+/* End */
diff --git a/src/OS/os.h-OpenUNIX b/src/OS/os.h-OpenUNIX
new file mode 100644
index 000000000..30d10f9bf
--- /dev/null
+++ b/src/OS/os.h-OpenUNIX
@@ -0,0 +1,18 @@
+/* $Cambridge: exim/src/OS/os.h-OpenUNIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for OpenUNIX */
+
+#define NO_SYSEXITS
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE short
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/stand/unix"
+#define FSCALE 256
+
+#define HAVE_SYS_STATVFS_H
+#define _SVID3
+#define NEED_H_ERRNO
+
+/* End */
diff --git a/src/OS/os.h-QNX b/src/OS/os.h-QNX
new file mode 100644
index 000000000..96611880e
--- /dev/null
+++ b/src/OS/os.h-QNX
@@ -0,0 +1,23 @@
+/* $Cambridge: exim/src/OS/os.h-QNX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for QNX */
+/* Modified for QNX 6.2.0 with diffs from Samuli Tuomola. */
+
+#include <sys/select.h>
+
+/* This include is wrapped in an ifdef so as to be skipped for QNXRTP, which
+doesn't have/need this header file. From Karsten P. Hoffmann. */
+
+#ifdef __QNX__
+#include <unix.h>
+#endif
+
+#undef HAVE_STATFS
+#undef HAVE_VFS_H
+#undef HAVE_SYS_MOUNT_H
+
+#define NO_SYSEXITS
+
+extern int h_errno;
+
+/* End */
diff --git a/src/OS/os.h-SCO b/src/OS/os.h-SCO
new file mode 100644
index 000000000..1b7eb06e3
--- /dev/null
+++ b/src/OS/os.h-SCO
@@ -0,0 +1,20 @@
+/* $Cambridge: exim/src/OS/os.h-SCO,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for SCO */
+
+#define DN_EXPAND_ARG4_TYPE u_char *
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE short
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/unix"
+#define FSCALE 256
+#define SOCKLEN_T int
+
+#define HAVE_SYS_STATVFS_H
+#define F_FAVAIL f_favail
+#define _SVID3
+#define NEED_H_ERRNO
+
+/* End */
diff --git a/src/OS/os.h-SCO_SV b/src/OS/os.h-SCO_SV
new file mode 100644
index 000000000..76dc4020f
--- /dev/null
+++ b/src/OS/os.h-SCO_SV
@@ -0,0 +1,18 @@
+/* $Cambridge: exim/src/OS/os.h-SCO_SV,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for SCO_SV */
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE short
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/unix"
+#define FSCALE 256
+#define SOCKLEN_T int
+
+#define HAVE_SYS_STATVFS_H
+#define F_FAVAIL f_favail
+#define _SVID3
+#define NEED_H_ERRNO
+
+/* End */
diff --git a/src/OS/os.h-SunOS4 b/src/OS/os.h-SunOS4
new file mode 100644
index 000000000..cdb633ccc
--- /dev/null
+++ b/src/OS/os.h-SunOS4
@@ -0,0 +1,38 @@
+/* $Cambridge: exim/src/OS/os.h-SunOS4,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for SunOS4 */
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE long
+#define LOAD_AVG_SYMBOL "_avenrun"
+#define KERNEL_PATH "/vmunix"
+
+#define HAVE_MMAP
+#define HAVE_SYS_VFS_H
+
+#define F_FREESP O_TRUNC
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+typedef struct flock flock_t;
+
+#define STRERROR_FROM_ERRLIST
+#define memmove(a, b, c) bcopy(b, a, c)
+#define strtoul(str, ptr, base) ((unsigned int)strtol((str),(ptr),(base)))
+
+extern char *strerror(int);
+extern int sys_nerr;
+extern char *sys_errlist[];
+
+/* In ANSI C strtod() is defined in stdlib.h, but in SunOS4 it is defined in
+floatingpoint.h which is called from math.h, which Exim doesn't include. */
+
+extern double strtod(const char *, char **);
+
+/* SunOS4 seems to define getc, ungetc, feof and ferror as macros only, not
+as functions. We need to have them as assignable functions. Setting this
+flag causes this to get done in exim.h. */
+
+#define FUDGE_GETC_AND_FRIENDS
+
+/* End */
diff --git a/src/OS/os.h-SunOS5 b/src/OS/os.h-SunOS5
new file mode 100644
index 000000000..d0ffd57fd
--- /dev/null
+++ b/src/OS/os.h-SunOS5
@@ -0,0 +1,33 @@
+/* $Cambridge: exim/src/OS/os.h-SunOS5,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for SunOS5 aka Solaris */
+
+#define CRYPT_H
+#define HAVE_MMAP
+#define HAVE_SYS_STATVFS_H
+#define F_FAVAIL f_favail
+#define SIOCGIFCONF_GIVES_ADDR
+
+#define HAVE_GETIPNODEBYNAME 1
+#define HAVE_GETIPNODEBYADDR 1
+
+#define HAVE_KSTAT
+#define LOAD_AVG_KSTAT "system_misc"
+#define LOAD_AVG_KSTAT_MODULE "unix"
+#define LOAD_AVG_SYMBOL "avenrun_1min"
+#define LOAD_AVG_FIELD value.ui32
+
+#define os_strsignal strsignal
+#define OS_STRSIGNAL
+
+/* This is needed for some early Solaris releases, but causes trouble
+in the current ones, so it is out by default. */
+
+/* #define SOCKLEN_T size_t */
+
+/* This is different from Linux and all other PAM implementations,
+it seems. */
+
+#define PAM_CONVERSE_ARG2_TYPE struct pam_message
+
+/* End */
diff --git a/src/OS/os.h-SunOS5-hal b/src/OS/os.h-SunOS5-hal
new file mode 100644
index 000000000..9ba6d8a3c
--- /dev/null
+++ b/src/OS/os.h-SunOS5-hal
@@ -0,0 +1,13 @@
+/* $Cambridge: exim/src/OS/os.h-SunOS5-hal,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for SunOS5 on HAL */
+
+#define HAVE_MMAP
+
+#define HAVE_KSTAT
+#define LOAD_AVG_KSTAT "system_misc"
+#define LOAD_AVG_KSTAT_MODULE "unix"
+#define LOAD_AVG_SYMBOL "avenrun_1min"
+#define LOAD_AVG_FIELD value.ul
+
+/* End */
diff --git a/src/OS/os.h-ULTRIX b/src/OS/os.h-ULTRIX
new file mode 100644
index 000000000..5b3fde1ad
--- /dev/null
+++ b/src/OS/os.h-ULTRIX
@@ -0,0 +1,17 @@
+/* $Cambridge: exim/src/OS/os.h-ULTRIX,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for Ultrix */
+
+/* Well, it *does* have statfs(), but its structure is called something
+different, all the members have different names, and the function returns
+1 on success rather than 0. As this is for a minority function, and I think
+a minority operating system, easiest just to say "no" until someone asks. */
+
+#undef HAVE_STATFS
+
+#define F_FREESP O_TRUNC
+#define NEED_H_ERRNO
+#define NO_OPENLOG
+typedef struct flock flock_t;
+
+/* End */
diff --git a/src/OS/os.h-UNIX_SV b/src/OS/os.h-UNIX_SV
new file mode 100644
index 000000000..4beedbcc8
--- /dev/null
+++ b/src/OS/os.h-UNIX_SV
@@ -0,0 +1,24 @@
+/* $Cambridge: exim/src/OS/os.h-UNIX_SV,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for SCO SVR4.2 (and maybe Unixware) */
+
+/**
+*** Note that for SCO 5 the configuration file is called SCO_SV,
+*** and that Unixware7 has its own configuration. This is an old
+*** file that is retained for compatibility.
+**/
+
+#define NO_SYSEXITS
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE short
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/stand/unix"
+#define FSCALE 256
+
+#define HAVE_SYS_STATVFS_H
+#define _SVID3
+#define NEED_H_ERRNO
+
+/* End */
diff --git a/src/OS/os.h-USG b/src/OS/os.h-USG
new file mode 100644
index 000000000..5bf995139
--- /dev/null
+++ b/src/OS/os.h-USG
@@ -0,0 +1,18 @@
+/* $Cambridge: exim/src/OS/os.h-USG,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for Unixware 2.x */
+
+#define NO_SYSEXITS
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE short
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/stand/unix"
+#define FSCALE 256
+
+#define HAVE_SYS_STATVFS_H
+#define _SVID3
+#define NEED_H_ERRNO
+
+/* End */
diff --git a/src/OS/os.h-Unixware7 b/src/OS/os.h-Unixware7
new file mode 100644
index 000000000..618bac677
--- /dev/null
+++ b/src/OS/os.h-Unixware7
@@ -0,0 +1,21 @@
+/* $Cambridge: exim/src/OS/os.h-Unixware7,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for Unixware 7 */
+
+#define NO_SYSEXITS
+
+#define ICONV_ARG2_TYPE char **
+#define SOCKLEN_T size_t
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE short
+#define LOAD_AVG_SYMBOL "avenrun"
+#define KERNEL_PATH "/stand/unix"
+#define FSCALE 256
+
+#define HAVE_SYS_STATVFS_H
+#define _SVID3
+#define NEED_H_ERRNO
+
+/* End */
diff --git a/src/OS/os.h-cygwin b/src/OS/os.h-cygwin
new file mode 100644
index 000000000..ebd9c848b
--- /dev/null
+++ b/src/OS/os.h-cygwin
@@ -0,0 +1,53 @@
+/* $Cambridge: exim/src/OS/os.h-cygwin,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for Cygwin */
+
+/* This code was supplied by Pierre A. Humblet <Pierre.Humblet@ieee.org> */
+
+/* Define the OS_INIT macro that we insert in exim.c:main()
+ to set the root and exim uid depending on the system */
+/* We use a special routine to initialize */
+void cygwin_init(int, char **, void *, void *, void *, void *);
+#define OS_INIT\
+ cygwin_init(argc, (char **) argv, &root_uid, &exim_uid, &exim_gid, &config_uid);
+
+/* We need a special mkdir that
+ allows names starting with // */
+#include <sys/stat.h> /* Do not redefine mkdir in sys/stat.h */
+int cygwin_mkdir( const char *_path, mode_t __mode );
+#define mkdir cygwin_mkdir /* redefine mkdir elsewhere */
+
+/* Redefine the set*id calls to run when faking root */
+#include <unistd.h> /* Do not redefine in unitsd.h */
+int cygwin_setuid(uid_t uid );
+int cygwin_setgid(gid_t gid );
+#define setuid cygwin_setuid
+#define setgid cygwin_setgid
+
+extern unsigned int cygwin_WinVersion;
+
+#define BASE_62 36 /* Windows aliases lower and upper cases in filenames.
+ Consider reducing MAX_LOCALHOST_NUMBER */
+#define CRYPT_H
+#define HAVE_MMAP
+#define HAVE_SYS_VFS_H
+#define NO_IP_VAR_H
+#define NO_IP_OPTIONS
+#define F_FREESP O_TRUNC
+/* Defining LOAD_AVG_NEEDS_ROOT causes an initial
+ call to os_getloadavg. In our case this is beneficial
+ because it initializes the counts */
+#define LOAD_AVG_NEEDS_ROOT
+
+typedef struct flock flock_t;
+
+/* Macro to define variable length SID structures */
+#define SID(n, name, sid...) \
+struct { \
+ BYTE Revision; \
+ BYTE SubAuthorityCount; \
+ SID_IDENTIFIER_AUTHORITY IdentifierAuthority; \
+ DWORD SubAuthority[n]; \
+} name = { SID_REVISION, n, {SECURITY_NT_AUTHORITY}, {sid}}
+
+/* End */
diff --git a/src/OS/os.h-mips b/src/OS/os.h-mips
new file mode 100644
index 000000000..74abf5f2c
--- /dev/null
+++ b/src/OS/os.h-mips
@@ -0,0 +1,26 @@
+/* $Cambridge: exim/src/OS/os.h-mips,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
+
+/* Exim: OS-specific C header file for RiscOS4bsd */
+
+#define LOAD_AVG_NEEDS_ROOT
+#define HAVE_DEV_KMEM
+#define LOAD_AVG_TYPE long
+#define LOAD_AVG_SYMBOL "_avenrun"
+#define KERNEL_PATH "/unix"
+
+#define HAVE_MMAP
+#define HAVE_SYS_VFS_H
+
+#define F_FREESP O_TRUNC
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+typedef struct flock flock_t;
+
+#define STRERROR_FROM_ERRLIST
+#define memmove(a, b, c) bcopy(b, a, c)
+
+extern char *strerror(int);
+extern int sys_nerr;
+extern char *sys_errlist[];
+
+/* End */