From fdcfc97979f0ffb9b2f9185641b8e14220f1ddc3 Mon Sep 17 00:00:00 2001 From: Thomas Merkel Date: Wed, 24 Feb 2016 07:54:21 +0100 Subject: [PATCH] Buildfix for dma on SunOS To build dma on SunOS (tested on SmartOS) it's required to rename existing queue struct to dma_queue (or anything else). To decrease the warnings I also included strings.h for the bzero and bcopy function. The sys/sysmacros.h include is required for the roundup function. --- crypto.c | 1 + dma.c | 15 ++++++++------- dma.h | 16 ++++++++-------- dns.c | 5 +++++ local.c | 1 + mail.c | 7 ++++--- spool.c | 13 +++++++------ 7 files changed, 34 insertions(+), 24 deletions(-) diff --git a/crypto.c b/crypto.c index 897b55b..46c3b53 100644 --- a/crypto.c +++ b/crypto.c @@ -40,6 +40,7 @@ #include #include +#include #include #include "dma.h" diff --git a/dma.c b/dma.c index 94fc331..8711245 100644 --- a/dma.c +++ b/dma.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -94,7 +95,7 @@ sighup_handler(int signo) } static char * -set_from(struct queue *queue, const char *osender) +set_from(struct dma_queue *queue, const char *osender) { const char *addr; char *sender; @@ -153,7 +154,7 @@ read_aliases(void) } static int -do_alias(struct queue *queue, const char *addr) +do_alias(struct dma_queue *queue, const char *addr) { struct alias *al; struct stritem *sit; @@ -173,7 +174,7 @@ do_alias(struct queue *queue, const char *addr) } int -add_recp(struct queue *queue, const char *str, int expand) +add_recp(struct dma_queue *queue, const char *str, int expand) { struct qitem *it, *tit; struct passwd *pw; @@ -240,7 +241,7 @@ add_recp(struct queue *queue, const char *str, int expand) } static struct qitem * -go_background(struct queue *queue) +go_background(struct dma_queue *queue) { struct sigaction sa; struct qitem *it; @@ -372,7 +373,7 @@ deliver(struct qitem *it) } void -run_queue(struct queue *queue) +run_queue(struct dma_queue *queue) { struct qitem *it; @@ -385,7 +386,7 @@ run_queue(struct queue *queue) } static void -show_queue(struct queue *queue) +show_queue(struct dma_queue *queue) { struct qitem *it; int locked = 0; /* XXX */ @@ -421,7 +422,7 @@ main(int argc, char **argv) { struct sigaction act; char *sender = NULL; - struct queue queue; + struct dma_queue queue; int i, ch; int nodot = 0, showq = 0, queue_only = 0; int recp_from_header = 0; diff --git a/dma.h b/dma.h index acf5e44..1256ef5 100644 --- a/dma.h +++ b/dma.h @@ -118,7 +118,7 @@ struct qitem { }; LIST_HEAD(queueh, qitem); -struct queue { +struct dma_queue { struct queueh queue; char *id; FILE *mailf; @@ -205,16 +205,16 @@ int base64_decode(const char *, void *); /* dma.c */ #define EXPAND_ADDR 1 #define EXPAND_WILDCARD 2 -int add_recp(struct queue *, const char *, int); -void run_queue(struct queue *); +int add_recp(struct dma_queue *, const char *, int); +void run_queue(struct dma_queue *); /* spool.c */ -int newspoolf(struct queue *); -int linkspool(struct queue *); -int load_queue(struct queue *); +int newspoolf(struct dma_queue *); +int linkspool(struct dma_queue *); +int load_queue(struct dma_queue *); void delqueue(struct qitem *); int acquirespool(struct qitem *); -void dropspool(struct queue *, struct qitem *); +void dropspool(struct dma_queue *, struct qitem *); int flushqueue_since(unsigned int); int flushqueue_signal(void); @@ -223,7 +223,7 @@ int deliver_local(struct qitem *); /* mail.c */ void bounce(struct qitem *, const char *); -int readmail(struct queue *, int, int); +int readmail(struct dma_queue *, int, int); /* util.c */ const char *hostname(void); diff --git a/dns.c b/dns.c index dd9ebfc..cd20304 100644 --- a/dns.c +++ b/dns.c @@ -41,8 +41,13 @@ #include #include #include +#include #include +#if defined(__sun) +#include +#endif + #include "dma.h" static int diff --git a/local.c b/local.c index 94e2179..f979139 100644 --- a/local.c +++ b/local.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include "dma.h" diff --git a/mail.c b/mail.c index a6d11fc..828edd0 100644 --- a/mail.c +++ b/mail.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -44,7 +45,7 @@ void bounce(struct qitem *it, const char *reason) { - struct queue bounceq; + struct dma_queue bounceq; char line[1000]; size_t pos; int error; @@ -160,7 +161,7 @@ struct parse_state { * XXX local addresses will need treatment */ static int -parse_addrs(struct parse_state *ps, char *s, struct queue *queue) +parse_addrs(struct parse_state *ps, char *s, struct dma_queue *queue) { char *addr; @@ -342,7 +343,7 @@ parse_addrs(struct parse_state *ps, char *s, struct queue *queue) } int -readmail(struct queue *queue, int nodot, int recp_from_header) +readmail(struct dma_queue *queue, int nodot, int recp_from_header) { struct parse_state parse_state; char line[1000]; /* by RFC2822 */ diff --git a/spool.c b/spool.c index e9c9c43..8648971 100644 --- a/spool.c +++ b/spool.c @@ -46,6 +46,7 @@ #include #include #include +#include #include "dma.h" @@ -69,7 +70,7 @@ */ int -newspoolf(struct queue *queue) +newspoolf(struct dma_queue *queue) { char fn[PATH_MAX+1]; struct stat st; @@ -151,10 +152,10 @@ writequeuef(struct qitem *it) } static struct qitem * -readqueuef(struct queue *queue, char *queuefn) +readqueuef(struct dma_queue *queue, char *queuefn) { char line[1000]; - struct queue itmqueue; + struct dma_queue itmqueue; FILE *queuef = NULL; char *s; char *queueid = NULL, *sender = NULL, *addr = NULL; @@ -229,7 +230,7 @@ readqueuef(struct queue *queue, char *queuefn) } int -linkspool(struct queue *queue) +linkspool(struct dma_queue *queue) { struct stat st; struct qitem *it; @@ -276,7 +277,7 @@ linkspool(struct queue *queue) } int -load_queue(struct queue *queue) +load_queue(struct dma_queue *queue) { struct stat sb; struct qitem *it; @@ -382,7 +383,7 @@ acquirespool(struct qitem *it) } void -dropspool(struct queue *queue, struct qitem *keep) +dropspool(struct dma_queue *queue, struct qitem *keep) { struct qitem *it;