From a49d02b4e880c77c1c2a495ce20211f2311b0c3d Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Fri, 21 Dec 2007 10:14:08 +0000 Subject: [PATCH] fixes to allow SunOS compilation --- mbuni/ChangeLog | 2 ++ mbuni/configure.ac | 6 +++--- mbuni/mmlib/mms_queue.c | 5 ++++- mbuni/mmlib/mms_util.c | 20 ++++++++++++++++++-- mbuni/mmsbox/dlr.c | 6 +++++- mbuni/mmsbox/mmsbox.c | 6 ++++++ 6 files changed, 38 insertions(+), 7 deletions(-) diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index 89aa493..5e27685 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2007-12-21 P. A. Bagyenda + * Patches to permit compiling on SunOS 2007-12-15 P. A. Bagyenda * Added allowed-sender-prefix/denied-sender-prefix for mmsc group of mmsbox config * Added allowed-receiver-prefix/denied-receiver-prefix to mms-service group of mmsbox config diff --git a/mbuni/configure.ac b/mbuni/configure.ac index 1588c72..b2abc41 100644 --- a/mbuni/configure.ac +++ b/mbuni/configure.ac @@ -70,8 +70,8 @@ dnl Change a few things (a la kannel config) EXE_EXT="" LIB_EXT="a" case "$host" in - *-sun-solaris*) - CFLAGS="$CFLAGS -DSunOS=1" + *-sun-solaris* | *SunOS*) + CFLAGS="$CFLAGS -DSunOS=1 -D_POSIX_PTHREAD_SEMANTICS" ;; *-cygwin*) EXE_EXT=".exe" @@ -280,7 +280,7 @@ cat< #include #include - +#ifdef SunOS +#include +#include +#endif #include #include "mms_queue.h" diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index d05e8db..82d7fda 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -18,6 +18,10 @@ #include #include +#ifdef SunOS +#include +#endif + #include #include #include @@ -817,10 +821,22 @@ void mms_log(char *logmsg, Octstr *from, List *to, static int lockfile(int fd, int shouldblock) { int n, stop; +#ifdef SunOS + int flg = shouldblock ? F_SETLKW : F_SETLK; + flock_t lock; +#else unsigned flg = shouldblock ? 0 : LOCK_NB; - +#endif do { - n = flock(fd, LOCK_EX|flg); +#ifdef SunOS + lock.l_whence = SEEK_SET; + lock.l_start = 0; + lock.l_len = 0; + lock.l_type = F_WRLCK; + n = fcntl(fd, flg, &lock); +#else + n = flock(fd, LOCK_EX|flg); +#endif if (n < 0) { if (errno == EINTR) stop = 0; diff --git a/mbuni/mmsbox/dlr.c b/mbuni/mmsbox/dlr.c index c206790..dd51d12 100644 --- a/mbuni/mmsbox/dlr.c +++ b/mbuni/mmsbox/dlr.c @@ -3,7 +3,7 @@ * * MMSBox Dlr: Dlr storage for MMSBox * - * Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com + * Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com * * Paul Bagyenda * @@ -17,6 +17,10 @@ #include #include +#ifdef SunOS +#include +#endif + #include #include #include diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index 3f3f579..9be4aa1 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -16,6 +16,12 @@ #include #include #include + +#ifdef SunOS +#include +#include +#endif + #include "mms_queue.h" #include "mms_uaprof.h" #include "mmsbox.h"