From: <n-...@us...> - 2012-10-27 17:30:56
|
Revision: 6962 http://gfarm.svn.sourceforge.net/gfarm/?rev=6962&view=rev Author: n-soda Date: 2012-10-27 17:30:47 +0000 (Sat, 27 Oct 2012) Log Message: ----------- split definitions about gflog_reduced_*() from gfutil.h to gflog_reduced.h, to avoid the following warning in multiple files on Linux: gfutil.h:36: error: expected specifier-qualifier-list before 'time_t' this warning was introduced in r6951 as follows: move the reduced log function to libgfarm as a preparation to fix #504 - gfsd stops to work with a message "<err> ![1000551] cannot set canonical hostname of this node", when gfmd is overloaded Revision Links: -------------- http://gfarm.svn.sourceforge.net/gfarm/?rev=6951&view=rev Modified Paths: -------------- gfarm_v2/trunk/lib/libgfarm/gfutil/Makefile gfarm_v2/trunk/lib/libgfarm/gfutil/gfutil.h gfarm_v2/trunk/lib/libgfarm/gfutil/logutil.c gfarm_v2/trunk/server/gfmd/Makefile gfarm_v2/trunk/server/gfmd/gfmd.c gfarm_v2/trunk/server/gfsd/Makefile gfarm_v2/trunk/server/gfsd/gfsd.c Added Paths: ----------- gfarm_v2/trunk/lib/libgfarm/gfutil/gflog_reduced.h Modified: gfarm_v2/trunk/lib/libgfarm/gfutil/Makefile =================================================================== --- gfarm_v2/trunk/lib/libgfarm/gfutil/Makefile 2012-10-27 16:43:54 UTC (rev 6961) +++ gfarm_v2/trunk/lib/libgfarm/gfutil/Makefile 2012-10-27 17:30:47 UTC (rev 6962) @@ -70,7 +70,7 @@ hash.lo: gfutil.h hash.h hash_strptr.lo: hash.h limit.lo: gfutil.h -logutil.lo: gfutil.h +logutil.lo: gfutil.h gflog_reduced.h lru_cache.lo: lru_cache.h nanosec.lo: nanosec.h random.lo: thrsubr.h Added: gfarm_v2/trunk/lib/libgfarm/gfutil/gflog_reduced.h =================================================================== --- gfarm_v2/trunk/lib/libgfarm/gfutil/gflog_reduced.h (rev 0) +++ gfarm_v2/trunk/lib/libgfarm/gfutil/gflog_reduced.h 2012-10-27 17:30:47 UTC (rev 6962) @@ -0,0 +1,38 @@ +struct gflog_reduced_state { + int reduced_mode; + time_t stat_start, log_time; + long stat_count, log_count; + + /* configuration constants per each log type */ + int trigger; /* check reduced mode, if count exceeds this */ + int threshold; /* reduce, if rate exceeds threshold/duration */ + int duration; /* seconds: see above */ + int log_interval; /* seconds: interval of reduced log */ +}; + +#define GFLOG_REDUCED_STATE_INITIALIZER( \ + trigger, threshold, duration, log_interval) \ + { \ + 0, 0, 0, 0, 0, \ + trigger, threshold, duration, log_interval \ + } + +void gflog_reduced_message(int, int, const char *, int, const char *, + struct gflog_reduced_state *, + const char *, ...) GFLOG_PRINTF_ARG(7, 8); + +#define gflog_reduced_error(msg_no, state, ...) \ + gflog_reduced_message(msg_no, LOG_ERR,\ + __FILE__, __LINE__, __func__, state, __VA_ARGS__) +#define gflog_reduced_warning(msg_no, state, ...) \ + gflog_reduced_message(msg_no, LOG_WARNING,\ + __FILE__, __LINE__, __func__, state, __VA_ARGS__) +#define gflog_reduced_notice(msg_no, state, ...) \ + gflog_reduced_message(msg_no, LOG_NOTICE,\ + __FILE__, __LINE__, __func__, state, __VA_ARGS__) +#define gflog_reduced_info(msg_no, state, ...) \ + gflog_reduced_message(msg_no, LOG_INFO,\ + __FILE__, __LINE__, __func__, state, __VA_ARGS__) +#define gflog_reduced_debug(msg_no, state, ...) \ + gflog_reduced_message(msg_no, LOG_DEBUG,\ + __FILE__, __LINE__, __func__, state, __VA_ARGS__) Modified: gfarm_v2/trunk/lib/libgfarm/gfutil/gfutil.h =================================================================== --- gfarm_v2/trunk/lib/libgfarm/gfutil/gfutil.h 2012-10-27 16:43:54 UTC (rev 6961) +++ gfarm_v2/trunk/lib/libgfarm/gfutil/gfutil.h 2012-10-27 17:30:47 UTC (rev 6962) @@ -29,49 +29,6 @@ void gflog_set_fatal_action(int); int gflog_fatal_action_name_to_number(const char *); -#ifdef GFLOG_PRINTF_ARG /* export this only if <gfarm/gflog.h> is included */ - -struct gflog_reduced_state { - int reduced_mode; - time_t stat_start, log_time; - long stat_count, log_count; - - /* configuration constants per each log type */ - int trigger; /* check reduced mode, if count exceeds this */ - int threshold; /* reduce, if rate exceeds threshold/duration */ - int duration; /* seconds: see above */ - int log_interval; /* seconds: interval of reduced log */ -}; - -#define GFLOG_REDUCED_STATE_INITIALIZER( \ - trigger, threshold, duration, log_interval) \ - { \ - 0, 0, 0, 0, 0, \ - trigger, threshold, duration, log_interval \ - } - -void gflog_reduced_message(int, int, const char *, int, const char *, - struct gflog_reduced_state *, - const char *, ...) GFLOG_PRINTF_ARG(7, 8); - -#define gflog_reduced_error(msg_no, state, ...) \ - gflog_reduced_message(msg_no, LOG_ERR,\ - __FILE__, __LINE__, __func__, state, __VA_ARGS__) -#define gflog_reduced_warning(msg_no, state, ...) \ - gflog_reduced_message(msg_no, LOG_WARNING,\ - __FILE__, __LINE__, __func__, state, __VA_ARGS__) -#define gflog_reduced_notice(msg_no, state, ...) \ - gflog_reduced_message(msg_no, LOG_NOTICE,\ - __FILE__, __LINE__, __func__, state, __VA_ARGS__) -#define gflog_reduced_info(msg_no, state, ...) \ - gflog_reduced_message(msg_no, LOG_INFO,\ - __FILE__, __LINE__, __func__, state, __VA_ARGS__) -#define gflog_reduced_debug(msg_no, state, ...) \ - gflog_reduced_message(msg_no, LOG_DEBUG,\ - __FILE__, __LINE__, __func__, state, __VA_ARGS__) - -#endif /* GFLOG_PRINTF_ARG */ - /* random */ long gfarm_random(void); Modified: gfarm_v2/trunk/lib/libgfarm/gfutil/logutil.c =================================================================== --- gfarm_v2/trunk/lib/libgfarm/gfutil/logutil.c 2012-10-27 16:43:54 UTC (rev 6961) +++ gfarm_v2/trunk/lib/libgfarm/gfutil/logutil.c 2012-10-27 17:30:47 UTC (rev 6962) @@ -16,6 +16,7 @@ #include "thrsubr.h" #include "gfutil.h" +#include "gflog_reduced.h" #define LOG_LENGTH_MAX 2048 Modified: gfarm_v2/trunk/server/gfmd/Makefile =================================================================== --- gfarm_v2/trunk/server/gfmd/Makefile 2012-10-27 16:43:54 UTC (rev 6961) +++ gfarm_v2/trunk/server/gfmd/Makefile 2012-10-27 17:30:47 UTC (rev 6962) @@ -59,6 +59,7 @@ $(OBJS): $(DEPGFARMINC) \ $(GFUTIL_SRCDIR)/gfutil.h \ + $(GFUTIL_SRCDIR)/gflog_reduced.h \ $(GFUTIL_SRCDIR)/hash.h \ $(GFUTIL_SRCDIR)/id_table.h \ $(GFUTIL_SRCDIR)/tree.h \ Modified: gfarm_v2/trunk/server/gfmd/gfmd.c =================================================================== --- gfarm_v2/trunk/server/gfmd/gfmd.c 2012-10-27 16:43:54 UTC (rev 6961) +++ gfarm_v2/trunk/server/gfmd/gfmd.c 2012-10-27 17:30:47 UTC (rev 6962) @@ -31,6 +31,7 @@ #include <gfarm/gfarm_iostat.h> #include "gfutil.h" +#include "gflog_reduced.h" #include "thrsubr.h" #include "context.h" Modified: gfarm_v2/trunk/server/gfsd/Makefile =================================================================== --- gfarm_v2/trunk/server/gfsd/Makefile 2012-10-27 16:43:54 UTC (rev 6961) +++ gfarm_v2/trunk/server/gfsd/Makefile 2012-10-27 17:30:47 UTC (rev 6962) @@ -27,6 +27,7 @@ $(OBJS): $(DEPGFARMINC) \ $(GFUTIL_SRCDIR)/gfutil.h \ + $(GFUTIL_SRCDIR)/gflog_reduced.h \ $(GFUTIL_SRCDIR)/hash.h \ $(GFUTIL_SRCDIR)/timer.h \ $(GFARMLIB_SRCDIR)/context.h \ Modified: gfarm_v2/trunk/server/gfsd/gfsd.c =================================================================== --- gfarm_v2/trunk/server/gfsd/gfsd.c 2012-10-27 16:43:54 UTC (rev 6961) +++ gfarm_v2/trunk/server/gfsd/gfsd.c 2012-10-27 17:30:47 UTC (rev 6962) @@ -49,6 +49,7 @@ #include <gfarm/gfarm_iostat.h> #include "gfutil.h" +#include "gflog_reduced.h" #include "hash.h" #include "timer.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |