From 8c51f383d77adbb27d2407359167bbce758541d9 Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Wed, 26 May 2010 10:36:27 +0000 Subject: [PATCH] *** empty log message *** --- mbuni/ChangeLog | 2 ++ mbuni/configure.ac | 2 +- mbuni/extras/pgsql-queue/mms_pgsql_queue.c | 2 +- mbuni/mmlib/mms_eventlogger.c | 12 ++++++------ mbuni/mmlib/mms_eventlogger.h | 16 ++++++++-------- mbuni/mmlib/mms_queue.c | 2 +- mbuni/mmlib/mms_queue.h | 4 +++- mbuni/mmsbox/bearerbox.c | 2 +- mbuni/mmsbox/mmsbox.c | 4 ++-- mbuni/mmsbox/mmsbox.h | 4 ++-- mbuni/mmsc/mmsc.h | 4 ++-- mbuni/mmsc/mmsglobalsender.c | 4 ++-- mbuni/mmsc/mmsmobilesender.c | 4 ++-- mbuni/mmsc/mmsproxy.c | 2 +- mbuni/mmsc/mmsrelay.c | 2 +- 15 files changed, 35 insertions(+), 31 deletions(-) diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index bfdeeff..d128d88 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2010-05-26 P. A. Bagyenda + * Misc. patches/cleanups thanks to SATOH Fumiyasu 2010-01-25 P. A. Bagyenda * SunOS locking fixes (thanks to Ian Donaldson (iand at ekit-inc.com) 2010-01-04 P. A. Bagyenda diff --git a/mbuni/configure.ac b/mbuni/configure.ac index 4f64efe..47dc750 100644 --- a/mbuni/configure.ac +++ b/mbuni/configure.ac @@ -72,7 +72,7 @@ EXE_EXT="" LIB_EXT="a" case "$host" in *-sun-solaris* | *SunOS* | *-pc-solaris*) - CFLAGS="$CFLAGS -DSunOS=1 -D_POSIX_PTHREAD_SEMANTICS" + CFLAGS="$CFLAGS -DSunOS=1 -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT" ;; *-cygwin*) EXE_EXT=".exe" diff --git a/mbuni/extras/pgsql-queue/mms_pgsql_queue.c b/mbuni/extras/pgsql-queue/mms_pgsql_queue.c index f2a161e..6ec4a48 100644 --- a/mbuni/extras/pgsql-queue/mms_pgsql_queue.c +++ b/mbuni/extras/pgsql-queue/mms_pgsql_queue.c @@ -1153,7 +1153,7 @@ static void pgdeliver(struct PGDeliverData_t *pgdata) #define MAX_QLEN 10 /* we don't allow more than this number pending per thread. */ static void pgq_queue_run(char *dir, int (*deliver)(MmsEnvelope *), - double sleepsecs, int num_threads, int *rstop) + double sleepsecs, int num_threads, volatile sig_atomic_t *rstop) { struct PGDeliverData_t pgdata; diff --git a/mbuni/mmlib/mms_eventlogger.c b/mbuni/mmlib/mms_eventlogger.c index 2af372b..4f9d645 100644 --- a/mbuni/mmlib/mms_eventlogger.c +++ b/mbuni/mmlib/mms_eventlogger.c @@ -19,7 +19,7 @@ static Octstr *shell_cmd; #undef error #undef warning #undef info -static void default_logger(enum mbuni_event_type_t type, const char *subtype, int level, const char *file, +static void default_logger(enum mbuni_event_type_t type, const char *subtype, int err, const char *file, int line, const char *function, const char *interface, Octstr *id, @@ -38,7 +38,7 @@ static void default_logger(enum mbuni_event_type_t type, const char *subtype, in break; } - f(level, "%s:%d <%s> [%s] [%s] %s", + f(err, "%s:%d <%s> [%s] [%s] %s", file, line, function, interface ? interface : "n/a", id ? octstr_get_cstr(id) : "n/a", @@ -46,7 +46,7 @@ static void default_logger(enum mbuni_event_type_t type, const char *subtype, in } -static void shell_logger(enum mbuni_event_type_t type, const char *subtype, int level, const char *file, +static void shell_logger(enum mbuni_event_type_t type, const char *subtype, int err, const char *file, int line, const char *function, const char *interface, Octstr *id, Octstr *msg) @@ -74,7 +74,7 @@ static void shell_logger(enum mbuni_event_type_t type, const char *subtype, int cmd = octstr_format("%S '%s' '%s' %d '%s' '%s' %d '%S' '%S'", - shell_cmd, xtype, subtype ? subtype : "", level, interface ? interface : "", file, line, xid ? xid : octstr_imm(""), msg); + shell_cmd, xtype, subtype ? subtype : "", err, interface ? interface : "", file, line, xid ? xid : octstr_imm(""), msg); system(octstr_get_cstr(cmd)); octstr_destroy(cmd); @@ -122,7 +122,7 @@ int mms_event_logger_init(MmsEventLoggerFuncs *funcs, Octstr *init_param) return -1; } -extern void mms_event_logger(enum mbuni_event_type_t type, const char *subtype, int level, const char *file, +extern void mms_event_logger(enum mbuni_event_type_t type, const char *subtype, int err, const char *file, int line, const char *function, char *interface, Octstr *id, char *fmt,...) { @@ -134,7 +134,7 @@ extern void mms_event_logger(enum mbuni_event_type_t type, const char *subtype, va_end(ap); - log_handler->log_event(type,subtype, level, file, line, function, interface, id, x); + log_handler->log_event(type,subtype, err, file, line, function, interface, id, x); octstr_destroy(x); } diff --git a/mbuni/mmlib/mms_eventlogger.h b/mbuni/mmlib/mms_eventlogger.h index d35bfb0..45b83a6 100644 --- a/mbuni/mmlib/mms_eventlogger.h +++ b/mbuni/mmlib/mms_eventlogger.h @@ -19,7 +19,7 @@ typedef enum mbuni_event_type_t {MBUNI_ERROR, MBUNI_INFO, MBUNI_WARNING} mbuni_event_type_t; typedef struct MmsEventLoggerFuncs { int (*init)(Octstr *init_param); - void (*log_event)(enum mbuni_event_type_t type, const char *subtype, int level, const char *file, + void (*log_event)(enum mbuni_event_type_t type, const char *subtype, int err, const char *file, int line, const char *function, const char *interface, Octstr *id, @@ -35,18 +35,18 @@ extern int mms_event_logger_init(MmsEventLoggerFuncs *funcs, Octstr *init_param) */ extern void mms_event_logger_cleanup(void); extern void mms_event_logger(enum mbuni_event_type_t type, const char *subtype, - int level, const char *file, + int err, const char *file, int line, const char *function, char *interface, Octstr *id, char *fmt,...); -#define mms_error(level,intf,id,fmt,...) mms_event_logger(MBUNI_ERROR, NULL, (level), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) -#define mms_info(level,intf,id,fmt,...) mms_event_logger(MBUNI_INFO, NULL, (level), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) -#define mms_warning(level,intf,id,fmt,...) mms_event_logger(MBUNI_WARNING, NULL, (level), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) +#define mms_error(err,intf,id,fmt,...) mms_event_logger(MBUNI_ERROR, NULL, (err), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) +#define mms_info(err,intf,id,fmt,...) mms_event_logger(MBUNI_INFO, NULL, (err), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) +#define mms_warning(err,intf,id,fmt,...) mms_event_logger(MBUNI_WARNING, NULL, (err), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) -#define mms_error_ex(subtype,level,intf,id,fmt,...) mms_event_logger(MBUNI_ERROR, (subtype), (level), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) -#define mms_info_ex(subtype,level,intf,id,fmt,...) mms_event_logger(MBUNI_INFO, (subtype), (level), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) -#define mms_warning_ex(subtype,level,intf,id,fmt,...) mms_event_logger(MBUNI_WARNING, (subtype), (level), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) +#define mms_error_ex(subtype,err,intf,id,fmt,...) mms_event_logger(MBUNI_ERROR, (subtype), (err), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) +#define mms_info_ex(subtype,err,intf,id,fmt,...) mms_event_logger(MBUNI_INFO, (subtype), (err), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) +#define mms_warning_ex(subtype,err,intf,id,fmt,...) mms_event_logger(MBUNI_WARNING, (subtype), (err), __FILE__, __LINE__,__FUNCTION__,(intf), (id),(fmt),##__VA_ARGS__) MmsEventLoggerFuncs shell_event_logger; /* For logging using a shell command. */ diff --git a/mbuni/mmlib/mms_queue.c b/mbuni/mmlib/mms_queue.c index bb22696..1a39d39 100644 --- a/mbuni/mmlib/mms_queue.c +++ b/mbuni/mmlib/mms_queue.c @@ -1127,7 +1127,7 @@ static int run_dir(char *topdir, char *dir, struct Qthread_t *tlist, int num_thr static void mms_queue_run(char *dir, int (*deliver)(MmsEnvelope *), - double sleepsecs, int num_threads, int *rstop) + double sleepsecs, int num_threads, volatile sig_atomic_t *rstop) { struct Qthread_t *tlist; int i, qstop = 0; diff --git a/mbuni/mmlib/mms_queue.h b/mbuni/mmlib/mms_queue.h index 1fbd2e8..0a14040 100644 --- a/mbuni/mmlib/mms_queue.h +++ b/mbuni/mmlib/mms_queue.h @@ -14,6 +14,8 @@ #ifndef _MMS_QUEUE_INCLUDED__ #define _MMS_QUEUE_INCLUDED__ +#include + #include "mms_msg.h" #include "mms_util.h" @@ -146,7 +148,7 @@ typedef struct MmsQueueHandlerFuncs { int (*deliver)(MmsEnvelope *), double sleepsecs, int num_threads, - int *rstop); + volatile sig_atomic_t *rstop); /* Get rid of memory used by this. Typically does internal cleanup then calls * the general structure free-ing function below. diff --git a/mbuni/mmsbox/bearerbox.c b/mbuni/mmsbox/bearerbox.c index 6deb11d..d7f8154 100644 --- a/mbuni/mmsbox/bearerbox.c +++ b/mbuni/mmsbox/bearerbox.c @@ -1554,7 +1554,7 @@ done2: return 1; /* always delete queue entry. */ } -void mmsbox_outgoing_queue_runner(int *rstop) +void mmsbox_outgoing_queue_runner(volatile sig_atomic_t *rstop) { qfs->mms_queue_run(octstr_get_cstr(outgoing_qdir), sendMsg, queue_interval, maxthreads, rstop); diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index fdb9a37..218ec92 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -28,7 +28,7 @@ /* XXX warning, do not octstr_destroy strings in HTTPCGIVar struct. They are destroyed by the http module! */ -int rstop = 0; +volatile sig_atomic_t rstop = 0; static void quit_now(int notused) { rstop = 1; @@ -1360,7 +1360,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, octstr_get_cstr(qdir), "MMSBox", NULL); - mms_info(2, "mmsbox", NULL,"MMSBox: Queued message from service [%s], [transid [%s]: %s", + mms_info(0, "mmsbox", NULL,"MMSBox: Queued message from service [%s], [transid [%s]: %s", octstr_get_cstr(svc_name), otransid ? octstr_get_cstr(otransid) : "", octstr_get_cstr(x)); diff --git a/mbuni/mmsbox/mmsbox.h b/mbuni/mmsbox/mmsbox.h index 7111fa8..31280f3 100644 --- a/mbuni/mmsbox/mmsbox.h +++ b/mbuni/mmsbox/mmsbox.h @@ -14,7 +14,7 @@ #define __MMSBOX_INCLUDED__ #include "mmsbox_cfg.h" -extern int rstop; +extern volatile sig_atomic_t rstop; void mms_dlr_url_put(Octstr *msgid, char *rtype, Octstr *mmc_gid, Octstr *dlr_url, Octstr *transid); int mms_dlr_url_get(Octstr *msgid, char *rtype, Octstr *mmc_gid, Octstr **dlr_url, Octstr **transid); void mms_dlr_url_remove(Octstr *msgid, char *rtype, Octstr *mmc_gid); @@ -25,7 +25,7 @@ Octstr *mmsbox_get_report_info(MmsMsg *m, MmscGrp *mmsc, Octstr *out_mmc_id, time_t uaprof_tstamp, Octstr *msgid); void mmsc_receive_func(MmscGrp *m); -void mmsbox_outgoing_queue_runner(int *rstop); +void mmsbox_outgoing_queue_runner(volatile sig_atomic_t *rstop); /* Just a convenience, should go away in future! */ #define mmsbox_url_fetch_content mms_url_fetch_content diff --git a/mbuni/mmsc/mmsc.h b/mbuni/mmsc/mmsc.h index 3580400..930b601 100644 --- a/mbuni/mmsc/mmsc.h +++ b/mbuni/mmsc/mmsc.h @@ -21,8 +21,8 @@ int mmsrelay(void); int stop_mmsrelay(void); -extern void mbuni_global_queue_runner(int *stopflag); -extern void mbuni_mm1_queue_runner(int *stopflag); +extern void mbuni_global_queue_runner(volatile sig_atomic_t *stopflag); +extern void mbuni_mm1_queue_runner(volatile sig_atomic_t *stopflag); extern MmscSettings *settings; extern List *proxyrelays; diff --git a/mbuni/mmsc/mmsglobalsender.c b/mbuni/mmsc/mmsglobalsender.c index 425a99f..db34a15 100644 --- a/mbuni/mmsc/mmsglobalsender.c +++ b/mbuni/mmsc/mmsglobalsender.c @@ -457,7 +457,7 @@ static int sendMsg(MmsEnvelope *e) settings->qfs->mms_queue_free_env(e); } - mms_info(3, "MMSC.global", NULL, "Processed in %d secs", (int)(time(NULL) - tstart)); /* report processing time. */ + mms_info(0, "MMSC.global", NULL, "Processed in %d secs", (int)(time(NULL) - tstart)); /* report processing time. */ return 1; /* Always deletes the queue entry. */ } @@ -474,7 +474,7 @@ static void cdr_thread(void *unused) } } -void mbuni_global_queue_runner(int *rstop) +void mbuni_global_queue_runner(volatile sig_atomic_t *rstop) { long cdr_thid; mms_setmobile_queuedir(octstr_get_cstr(settings->mm1_queuedir)); diff --git a/mbuni/mmsc/mmsmobilesender.c b/mbuni/mmsc/mmsmobilesender.c index 27cbf7d..7ceb47c 100644 --- a/mbuni/mmsc/mmsmobilesender.c +++ b/mbuni/mmsc/mmsmobilesender.c @@ -363,7 +363,7 @@ static int sendNotify(MmsEnvelope *e) } /* Write to log */ - mms_info(2, "MM1", NULL, "%s Mobile Queue MMS Send Notify: From=%s, to=%s, msgsize=%d, reason=%s. Processed in %d secs", + mms_info(0, "MM1", NULL, "%s Mobile Queue MMS Send Notify: From=%s, to=%s, msgsize=%d, reason=%s. Processed in %d secs", SEND_ERROR_STR(res), octstr_get_cstr(from), octstr_get_cstr(to), msize, err ? octstr_get_cstr(err) : "", @@ -399,7 +399,7 @@ static int sendNotify(MmsEnvelope *e) return 1; /* Tell caller we dealt with envelope */ } -void mbuni_mm1_queue_runner(int *rstop) +void mbuni_mm1_queue_runner(volatile sig_atomic_t *rstop) { settings->qfs->mms_queue_run(octstr_get_cstr(settings->mm1_queuedir), sendNotify, settings->mm1_queue_interval, settings->maxthreads, rstop); diff --git a/mbuni/mmsc/mmsproxy.c b/mbuni/mmsc/mmsproxy.c index 60fe16c..295afdf 100644 --- a/mbuni/mmsc/mmsproxy.c +++ b/mbuni/mmsc/mmsproxy.c @@ -40,7 +40,7 @@ typedef struct MmsHTTPClientInfo { } MmsHTTPClientInfo; static long mm7_thread = -1; -static int rstop = 0; +static volatile sig_atomic_t rstop = 0; static void free_clientInfo(MmsHTTPClientInfo *h, int freeh); static void fetchmms_proxy(MmsHTTPClientInfo *h); diff --git a/mbuni/mmsc/mmsrelay.c b/mbuni/mmsc/mmsrelay.c index 2145a59..8a1e069 100644 --- a/mbuni/mmsc/mmsrelay.c +++ b/mbuni/mmsc/mmsrelay.c @@ -15,7 +15,7 @@ static long qthread = -1; -static int rstop = 0; /* Set to 1 to stop relay. */ +static volatile sig_atomic_t rstop = 0; /* Set to 1 to stop relay. */ int mmsrelay() {