From dd51f9ea18a14d867f73dfa5f8b07ebcb529e5e2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 8 Apr 2004 08:15:23 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=3232 --- aclocal.m4 | 2 +- checkin_notes | 24 +++++ client/Makefile.am | 5 +- client/Makefile.in | 113 ++++++++------------ client/app.C | 11 +- client/{client_messages.C => client_msgs.C} | 37 +++++-- client/{message.h => client_msgs.h} | 32 +++--- client/client_state.C | 9 +- client/client_state.h | 2 +- client/client_types.C | 2 +- client/cpu_benchmark.C | 2 +- client/cs_account.C | 7 +- client/cs_apps.C | 3 +- client/cs_benchmark.C | 3 +- client/cs_cmdline.C | 1 + client/cs_files.C | 7 +- client/cs_prefs.C | 1 + client/cs_scheduler.C | 4 +- client/cs_statefile.C | 7 +- client/file_names.C | 2 +- client/file_xfer.C | 4 +- client/gui_rpc_server.C | 2 + client/hostinfo.C | 2 +- client/http.C | 10 +- client/log_flags.C | 2 +- client/main.C | 4 +- client/message.C | 2 +- client/net_stats.C | 2 +- client/net_xfer.C | 8 +- client/pers_file_xfer.C | 16 +-- client/prefs.C | 2 +- client/proxy.C | 4 +- client/scheduler_op.C | 13 +-- client/time_stats.C | 2 +- doc/translations.php | 62 ++++++----- lib/{messages.C => msg_log.C} | 78 +++++++------- lib/{messages.h => msg_log.h} | 26 ++--- sched/Makefile.am | 4 +- sched/Makefile.in | 59 +++++----- sched/assimilate_handler.C | 15 +-- sched/assimilator.C | 15 +-- sched/db_dump.C | 14 +-- sched/feeder.C | 41 +++---- sched/file_deleter.C | 19 ++-- sched/file_upload_handler.C | 41 +++---- sched/handle_request.C | 63 +++++------ sched/main.C | 27 ++--- sched/make_work.C | 29 ++--- sched/{sched_messages.C => sched_msgs.C} | 9 +- sched/sched_msgs.h | 17 +++ sched/sched_send.C | 51 ++++----- sched/sched_util.C | 15 +-- sched/sched_util.h | 19 ---- sched/server_types.C | 13 +-- sched/start_servers.C | 8 +- sched/transitioner.C | 47 ++++---- sched/trickle_handler.C | 11 +- sched/update_stats.C | 25 ++--- sched/validate.C | 47 ++++---- sched/validate_test.C | 5 +- sched/validate_util.C | 14 +-- 61 files changed, 595 insertions(+), 526 deletions(-) rename client/{client_messages.C => client_msgs.C} (70%) rename client/{message.h => client_msgs.h} (77%) rename lib/{messages.C => msg_log.C} (64%) rename lib/{messages.h => msg_log.h} (73%) rename sched/{sched_messages.C => sched_msgs.C} (85%) create mode 100644 sched/sched_msgs.h diff --git a/aclocal.m4 b/aclocal.m4 index 867138154d..076c280818 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1104,7 +1104,7 @@ AC_DEFUN([SAH_HEADER_STDCXX],[ # # Revision Log: # $Log$ -# Revision 1.80 2004/04/07 06:51:37 davea +# Revision 1.81 2004/04/08 08:14:50 davea # *** empty log message *** # # Revision 1.1 2003/12/11 18:38:24 korpela diff --git a/checkin_notes b/checkin_notes index fc0392b013..daf34a2e58 100755 --- a/checkin_notes +++ b/checkin_notes @@ -11427,3 +11427,27 @@ David April 7 2004 client_types.C,h cs_apps.C cs_scheduler.C + +David April 8 2004 + - Clarify distinction between log messages (debugging) + and user messages (shown to user) in the client + and put both in one place (client_msgs.C,h) + - rename ClientMessages to CLIENT_MSG_LOG + - rename SchedMessages to SCHED_MSG_LOG + - rename Messages to MSG_LOG + - rename ScopeMessages to SCOPE_MSG_LOG + + client/ + Makefile.am + *.C + client_messages.C (removed) + message.h (removed) + client_msgs.C,h (new) + lib/ + messages.C,h (removed) + msg_log.C,h (new) + sched/ + Makefile.am + *.C + sched_messages.C (removed) + sched_msgs.C,h (new) diff --git a/client/Makefile.am b/client/Makefile.am index 607f6d6948..53d6340f73 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -12,7 +12,7 @@ EXTRA_PROGRAMS = cpu_benchmark boinc_client_SOURCES = \ app.C \ check_state.C \ - client_messages.C \ + client_msgs.C \ client_state.C \ client_types.C \ cpu_benchmark.C \ @@ -32,7 +32,6 @@ boinc_client_SOURCES = \ http.C \ log_flags.C \ main.C \ - message.C \ net_stats.C \ net_xfer.C \ pers_file_xfer.C \ @@ -49,7 +48,7 @@ boinc_client_SOURCES = \ ../lib/language.C \ ../lib/md5_file.C \ ../lib/md5.c \ - ../lib/messages.C \ + ../lib/msg_log.C \ ../lib/parse.C \ ../lib/shmem.C \ ../lib/synch.C \ diff --git a/client/Makefile.in b/client/Makefile.in index acade9bd3a..ae580a431a 100644 --- a/client/Makefile.in +++ b/client/Makefile.in @@ -180,7 +180,7 @@ EXTRA_PROGRAMS = cpu_benchmark boinc_client_SOURCES = \ app.C \ check_state.C \ - client_messages.C \ + client_msgs.C \ client_state.C \ client_types.C \ cpu_benchmark.C \ @@ -200,7 +200,6 @@ boinc_client_SOURCES = \ http.C \ log_flags.C \ main.C \ - message.C \ net_stats.C \ net_xfer.C \ pers_file_xfer.C \ @@ -217,7 +216,7 @@ boinc_client_SOURCES = \ ../lib/language.C \ ../lib/md5_file.C \ ../lib/md5.c \ - ../lib/messages.C \ + ../lib/msg_log.C \ ../lib/parse.C \ ../lib/shmem.C \ ../lib/synch.C \ @@ -257,7 +256,7 @@ PROGRAMS = $(bin_PROGRAMS) am_boinc_client_OBJECTS = boinc_client-app.$(OBJEXT) \ boinc_client-check_state.$(OBJEXT) \ - boinc_client-client_messages.$(OBJEXT) \ + boinc_client-client_msgs.$(OBJEXT) \ boinc_client-client_state.$(OBJEXT) \ boinc_client-client_types.$(OBJEXT) \ boinc_client-cpu_benchmark.$(OBJEXT) \ @@ -274,8 +273,7 @@ am_boinc_client_OBJECTS = boinc_client-app.$(OBJEXT) \ boinc_client-hostinfo.$(OBJEXT) \ boinc_client-hostinfo_unix.$(OBJEXT) \ boinc_client-http.$(OBJEXT) boinc_client-log_flags.$(OBJEXT) \ - boinc_client-main.$(OBJEXT) boinc_client-message.$(OBJEXT) \ - boinc_client-net_stats.$(OBJEXT) \ + boinc_client-main.$(OBJEXT) boinc_client-net_stats.$(OBJEXT) \ boinc_client-net_xfer.$(OBJEXT) \ boinc_client-pers_file_xfer.$(OBJEXT) \ boinc_client-prefs.$(OBJEXT) boinc_client-proxy.$(OBJEXT) \ @@ -286,7 +284,7 @@ am_boinc_client_OBJECTS = boinc_client-app.$(OBJEXT) \ boinc_client-diagnostics.$(OBJEXT) \ boinc_client-exception.$(OBJEXT) boinc_client-filesys.$(OBJEXT) \ boinc_client-language.$(OBJEXT) boinc_client-md5_file.$(OBJEXT) \ - boinc_client-md5.$(OBJEXT) boinc_client-messages.$(OBJEXT) \ + boinc_client-md5.$(OBJEXT) boinc_client-msg_log.$(OBJEXT) \ boinc_client-parse.$(OBJEXT) boinc_client-shmem.$(OBJEXT) \ boinc_client-synch.$(OBJEXT) boinc_client-util.$(OBJEXT) boinc_client_OBJECTS = $(am_boinc_client_OBJECTS) @@ -303,7 +301,7 @@ am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/boinc_client-app.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-app_ipc.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-check_state.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-client_messages.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-client_msgs.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-client_state.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-client_types.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-cpu_benchmark.Po \ @@ -330,8 +328,7 @@ am__depfiles_maybe = depfiles @AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-main.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-md5.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-md5_file.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-message.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-messages.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-msg_log.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-net_stats.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-net_xfer.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/boinc_client-parse.Po \ @@ -394,7 +391,7 @@ clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) boinc_client-app.$(OBJEXT): app.C boinc_client-check_state.$(OBJEXT): check_state.C -boinc_client-client_messages.$(OBJEXT): client_messages.C +boinc_client-client_msgs.$(OBJEXT): client_msgs.C boinc_client-client_state.$(OBJEXT): client_state.C boinc_client-client_types.$(OBJEXT): client_types.C boinc_client-cpu_benchmark.$(OBJEXT): cpu_benchmark.C @@ -414,7 +411,6 @@ boinc_client-hostinfo_unix.$(OBJEXT): hostinfo_unix.C boinc_client-http.$(OBJEXT): http.C boinc_client-log_flags.$(OBJEXT): log_flags.C boinc_client-main.$(OBJEXT): main.C -boinc_client-message.$(OBJEXT): message.C boinc_client-net_stats.$(OBJEXT): net_stats.C boinc_client-net_xfer.$(OBJEXT): net_xfer.C boinc_client-pers_file_xfer.$(OBJEXT): pers_file_xfer.C @@ -431,7 +427,7 @@ boinc_client-filesys.$(OBJEXT): ../lib/filesys.C boinc_client-language.$(OBJEXT): ../lib/language.C boinc_client-md5_file.$(OBJEXT): ../lib/md5_file.C boinc_client-md5.$(OBJEXT): ../lib/md5.c -boinc_client-messages.$(OBJEXT): ../lib/messages.C +boinc_client-msg_log.$(OBJEXT): ../lib/msg_log.C boinc_client-parse.$(OBJEXT): ../lib/parse.C boinc_client-shmem.$(OBJEXT): ../lib/shmem.C boinc_client-synch.$(OBJEXT): ../lib/synch.C @@ -452,7 +448,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-app.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-app_ipc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-check_state.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-client_messages.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-client_msgs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-client_state.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-client_types.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-cpu_benchmark.Po@am__quote@ @@ -479,8 +475,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-md5.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-md5_file.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-message.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-messages.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-msg_log.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-net_stats.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-net_xfer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boinc_client-parse.Po@am__quote@ @@ -564,27 +559,27 @@ boinc_client-check_state.obj: check_state.C @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-check_state.obj `if test -f 'check_state.C'; then $(CYGPATH_W) 'check_state.C'; else $(CYGPATH_W) '$(srcdir)/check_state.C'` -boinc_client-client_messages.o: client_messages.C -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-client_messages.o -MD -MP -MF "$(DEPDIR)/boinc_client-client_messages.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o boinc_client-client_messages.o `test -f 'client_messages.C' || echo '$(srcdir)/'`client_messages.C; \ -@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-client_messages.Tpo" "$(DEPDIR)/boinc_client-client_messages.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-client_messages.Tpo"; exit 1; \ +boinc_client-client_msgs.o: client_msgs.C +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-client_msgs.o -MD -MP -MF "$(DEPDIR)/boinc_client-client_msgs.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o boinc_client-client_msgs.o `test -f 'client_msgs.C' || echo '$(srcdir)/'`client_msgs.C; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-client_msgs.Tpo" "$(DEPDIR)/boinc_client-client_msgs.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-client_msgs.Tpo"; exit 1; \ @am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='client_messages.C' object='boinc_client-client_messages.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-client_messages.Po' tmpdepfile='$(DEPDIR)/boinc_client-client_messages.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='client_msgs.C' object='boinc_client-client_msgs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-client_msgs.Po' tmpdepfile='$(DEPDIR)/boinc_client-client_msgs.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-client_messages.o `test -f 'client_messages.C' || echo '$(srcdir)/'`client_messages.C +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-client_msgs.o `test -f 'client_msgs.C' || echo '$(srcdir)/'`client_msgs.C -boinc_client-client_messages.obj: client_messages.C -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-client_messages.obj -MD -MP -MF "$(DEPDIR)/boinc_client-client_messages.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o boinc_client-client_messages.obj `if test -f 'client_messages.C'; then $(CYGPATH_W) 'client_messages.C'; else $(CYGPATH_W) '$(srcdir)/client_messages.C'`; \ -@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-client_messages.Tpo" "$(DEPDIR)/boinc_client-client_messages.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-client_messages.Tpo"; exit 1; \ +boinc_client-client_msgs.obj: client_msgs.C +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-client_msgs.obj -MD -MP -MF "$(DEPDIR)/boinc_client-client_msgs.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o boinc_client-client_msgs.obj `if test -f 'client_msgs.C'; then $(CYGPATH_W) 'client_msgs.C'; else $(CYGPATH_W) '$(srcdir)/client_msgs.C'`; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-client_msgs.Tpo" "$(DEPDIR)/boinc_client-client_msgs.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-client_msgs.Tpo"; exit 1; \ @am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='client_messages.C' object='boinc_client-client_messages.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-client_messages.Po' tmpdepfile='$(DEPDIR)/boinc_client-client_messages.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='client_msgs.C' object='boinc_client-client_msgs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-client_msgs.Po' tmpdepfile='$(DEPDIR)/boinc_client-client_msgs.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-client_messages.obj `if test -f 'client_messages.C'; then $(CYGPATH_W) 'client_messages.C'; else $(CYGPATH_W) '$(srcdir)/client_messages.C'` +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-client_msgs.obj `if test -f 'client_msgs.C'; then $(CYGPATH_W) 'client_msgs.C'; else $(CYGPATH_W) '$(srcdir)/client_msgs.C'` boinc_client-client_state.o: client_state.C @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-client_state.o -MD -MP -MF "$(DEPDIR)/boinc_client-client_state.Tpo" \ @@ -1004,28 +999,6 @@ boinc_client-main.obj: main.C @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-main.obj `if test -f 'main.C'; then $(CYGPATH_W) 'main.C'; else $(CYGPATH_W) '$(srcdir)/main.C'` -boinc_client-message.o: message.C -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-message.o -MD -MP -MF "$(DEPDIR)/boinc_client-message.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o boinc_client-message.o `test -f 'message.C' || echo '$(srcdir)/'`message.C; \ -@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-message.Tpo" "$(DEPDIR)/boinc_client-message.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-message.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='message.C' object='boinc_client-message.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-message.Po' tmpdepfile='$(DEPDIR)/boinc_client-message.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-message.o `test -f 'message.C' || echo '$(srcdir)/'`message.C - -boinc_client-message.obj: message.C -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-message.obj -MD -MP -MF "$(DEPDIR)/boinc_client-message.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o boinc_client-message.obj `if test -f 'message.C'; then $(CYGPATH_W) 'message.C'; else $(CYGPATH_W) '$(srcdir)/message.C'`; \ -@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-message.Tpo" "$(DEPDIR)/boinc_client-message.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-message.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='message.C' object='boinc_client-message.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-message.Po' tmpdepfile='$(DEPDIR)/boinc_client-message.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-message.obj `if test -f 'message.C'; then $(CYGPATH_W) 'message.C'; else $(CYGPATH_W) '$(srcdir)/message.C'` - boinc_client-net_stats.o: net_stats.C @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-net_stats.o -MD -MP -MF "$(DEPDIR)/boinc_client-net_stats.Tpo" \ @am__fastdepCXX_TRUE@ -c -o boinc_client-net_stats.o `test -f 'net_stats.C' || echo '$(srcdir)/'`net_stats.C; \ @@ -1356,27 +1329,27 @@ boinc_client-md5_file.obj: ../lib/md5_file.C @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-md5_file.obj `if test -f '../lib/md5_file.C'; then $(CYGPATH_W) '../lib/md5_file.C'; else $(CYGPATH_W) '$(srcdir)/../lib/md5_file.C'` -boinc_client-messages.o: ../lib/messages.C -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-messages.o -MD -MP -MF "$(DEPDIR)/boinc_client-messages.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o boinc_client-messages.o `test -f '../lib/messages.C' || echo '$(srcdir)/'`../lib/messages.C; \ -@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-messages.Tpo" "$(DEPDIR)/boinc_client-messages.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-messages.Tpo"; exit 1; \ +boinc_client-msg_log.o: ../lib/msg_log.C +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-msg_log.o -MD -MP -MF "$(DEPDIR)/boinc_client-msg_log.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o boinc_client-msg_log.o `test -f '../lib/msg_log.C' || echo '$(srcdir)/'`../lib/msg_log.C; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-msg_log.Tpo" "$(DEPDIR)/boinc_client-msg_log.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-msg_log.Tpo"; exit 1; \ @am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../lib/messages.C' object='boinc_client-messages.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-messages.Po' tmpdepfile='$(DEPDIR)/boinc_client-messages.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../lib/msg_log.C' object='boinc_client-msg_log.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-msg_log.Po' tmpdepfile='$(DEPDIR)/boinc_client-msg_log.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-messages.o `test -f '../lib/messages.C' || echo '$(srcdir)/'`../lib/messages.C +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-msg_log.o `test -f '../lib/msg_log.C' || echo '$(srcdir)/'`../lib/msg_log.C -boinc_client-messages.obj: ../lib/messages.C -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-messages.obj -MD -MP -MF "$(DEPDIR)/boinc_client-messages.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o boinc_client-messages.obj `if test -f '../lib/messages.C'; then $(CYGPATH_W) '../lib/messages.C'; else $(CYGPATH_W) '$(srcdir)/../lib/messages.C'`; \ -@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-messages.Tpo" "$(DEPDIR)/boinc_client-messages.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-messages.Tpo"; exit 1; \ +boinc_client-msg_log.obj: ../lib/msg_log.C +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-msg_log.obj -MD -MP -MF "$(DEPDIR)/boinc_client-msg_log.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o boinc_client-msg_log.obj `if test -f '../lib/msg_log.C'; then $(CYGPATH_W) '../lib/msg_log.C'; else $(CYGPATH_W) '$(srcdir)/../lib/msg_log.C'`; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/boinc_client-msg_log.Tpo" "$(DEPDIR)/boinc_client-msg_log.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/boinc_client-msg_log.Tpo"; exit 1; \ @am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../lib/messages.C' object='boinc_client-messages.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-messages.Po' tmpdepfile='$(DEPDIR)/boinc_client-messages.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../lib/msg_log.C' object='boinc_client-msg_log.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/boinc_client-msg_log.Po' tmpdepfile='$(DEPDIR)/boinc_client-msg_log.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-messages.obj `if test -f '../lib/messages.C'; then $(CYGPATH_W) '../lib/messages.C'; else $(CYGPATH_W) '$(srcdir)/../lib/messages.C'` +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o boinc_client-msg_log.obj `if test -f '../lib/msg_log.C'; then $(CYGPATH_W) '../lib/msg_log.C'; else $(CYGPATH_W) '$(srcdir)/../lib/msg_log.C'` boinc_client-parse.o: ../lib/parse.C @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(boinc_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT boinc_client-parse.o -MD -MP -MF "$(DEPDIR)/boinc_client-parse.Tpo" \ diff --git a/client/app.C b/client/app.C index 94371b6452..6f536b49b1 100644 --- a/client/app.C +++ b/client/app.C @@ -77,6 +77,7 @@ #include "shmem.h" #include "util.h" +#include "client_msgs.h" #include "app.h" // value for setpriority(2) @@ -87,11 +88,11 @@ static const int PROCESS_IDLE_PRIORITY = 19; static int debug_print_argv(char** argv) { int i; - log_messages.printf(ClientMessages::DEBUG_TASK, "Arguments:"); + log_messages.printf(CLIENT_MSG_LOG::DEBUG_TASK, "Arguments:"); ++log_messages; for (i=0; argv[i]; i++) { log_messages.printf( - ClientMessages::DEBUG_TASK, + CLIENT_MSG_LOG::DEBUG_TASK, "argv[%d]: %s\n", i, argv[i] ); } @@ -258,7 +259,7 @@ int ACTIVE_TASK::start(bool first_time) { GRAPHICS_INFO gi; APP_INIT_DATA aid; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_TASK); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_TASK); scope_messages.printf("ACTIVE_TASK::start(first_time=%d)\n", first_time); if (first_time) { @@ -639,7 +640,7 @@ bool ACTIVE_TASK::finish_file_present() { bool ACTIVE_TASK_SET::check_app_exited() { ACTIVE_TASK* atp; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_TASK); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_TASK); #ifdef _WIN32 unsigned long exit_code; @@ -1139,7 +1140,7 @@ int ACTIVE_TASK_SET::restart_tasks() { RESULT* result; int retval; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_TASK); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_TASK); iter = active_tasks.begin(); while (iter != active_tasks.end()) { diff --git a/client/client_messages.C b/client/client_msgs.C similarity index 70% rename from client/client_messages.C rename to client/client_msgs.C index 551000ad37..ce77150f83 100644 --- a/client/client_messages.C +++ b/client/client_msgs.C @@ -20,14 +20,16 @@ #ifdef _WIN32 #include "stdafx.h" #endif +#ifndef _WIN32 +#include +#endif -#include "message.h" #include "log_flags.h" +#include "client_msgs.h" -ClientMessages log_messages; +CLIENT_MSG_LOG log_messages; -const char* ClientMessages::v_format_kind(int kind) const -{ +const char* CLIENT_MSG_LOG::v_format_kind(int kind) const { switch(kind) { case DEBUG_STATE: return "DEBUG_STATE "; case DEBUG_TASK: return "DEBUG_TASK "; @@ -43,8 +45,7 @@ const char* ClientMessages::v_format_kind(int kind) const } } -bool ClientMessages::v_message_wanted(int kind) const -{ +bool CLIENT_MSG_LOG::v_message_wanted(int kind) const { switch (kind) { case DEBUG_STATE: return log_flags.state_debug; case DEBUG_TASK: return log_flags.task_debug; @@ -59,3 +60,27 @@ bool ClientMessages::v_message_wanted(int kind) const default: return false; } } + + +vector message_descs; + +// Takes a printf style formatted string, inserts the proper values, +// and passes it to show_message +// TODO: add translation functionality +// +void msg_printf(PROJECT *p, int priority, char *fmt, ...) { + char buf[512]; + va_list ap; + + if (fmt == NULL) return; + + // Since Windows doesn't support vsnprintf, we have to do a + // workaround to prevent buffer overruns + // + if (strlen(fmt) > 512) fmt[511] = '\0'; + va_start(ap, fmt); // Parses string for variables + vsprintf(buf, fmt, ap); // And convert symbols To actual numbers + va_end(ap); // Results are stored in text + + show_message(p, buf, priority); +} diff --git a/client/message.h b/client/client_msgs.h similarity index 77% rename from client/message.h rename to client/client_msgs.h index d1c1d54fbd..3401ac39ac 100644 --- a/client/message.h +++ b/client/client_msgs.h @@ -17,12 +17,22 @@ // Contributor(s): // -#ifndef MESSAGE_H -#define MESSAGE_H +#ifndef CLIENT_MSG_LOG_H +#define CLIENT_MSG_LOG_H + +// Two types of messages are used in the BOINC client: +// +// - Log messages +// Debugging messages, not intended to be seen by users +// Write these using the log_messages object. +// +// - User messages +// Message intended for users, displayed in the Messages tab of the GUI +// Write these using the msg_printf() function #include -#include "messages.h" +#include "msg_log.h" #include "client_types.h" // Show a message, preceded by timestamp and project name @@ -37,6 +47,8 @@ #define MSG_WARNING 3 // deprecated - do not use +// the following stores a message in memory, where it can be retrieved via RPC +// struct MESSAGE_DESC { PROJECT* project; int priority; @@ -48,10 +60,11 @@ extern vector message_descs; extern void show_message(class PROJECT *p, char* message, int priority); -class ClientMessages : public Messages { +class CLIENT_MSG_LOG : public MSG_LOG { int debug_level; const char* v_format_kind(int kind) const; bool v_message_wanted(int kind) const; + public: enum Kind { DEBUG_STATE, // changes to CLIENT_STATE structure @@ -65,17 +78,10 @@ public: DEBUG_MEASUREMENT, // host measurement notices DEBUG_POLL, // show what polls are responding }; - ClientMessages(): Messages(stdout) {} + CLIENT_MSG_LOG(): MSG_LOG(stdout) {} }; -extern ClientMessages log_messages; - -// the __attribute((format...)) tags are GCC extensions that let the compiler -// do like-checking on printf-like arguments -// -#if !defined(__GNUC__) && !defined(__attribute__) -#define __attribute__(x) /*nothing*/ -#endif +extern CLIENT_MSG_LOG log_messages; extern void msg_printf(PROJECT *p, int priority, char *fmt, ...) __attribute__ ((format (printf, 3, 4))); diff --git a/client/client_state.C b/client/client_state.C index 8103a354d9..ad12036611 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -55,6 +55,7 @@ #include "hostinfo.h" #include "http.h" #include "log_flags.h" +#include "client_msgs.h" #include "client_state.h" CLIENT_STATE gstate; @@ -298,7 +299,7 @@ int CLIENT_STATE::init() { // This is inefficient but not a problem (I guess) // int CLIENT_STATE::net_sleep(double x) { - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_NET_XFER); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_NET_XFER); scope_messages.printf("CLIENT_STATE::net_sleep(%f)\n", x); if (activities_suspended || network_suspended) { boinc_sleep(x); @@ -321,7 +322,7 @@ int CLIENT_STATE::net_sleep(double x) { // bool CLIENT_STATE::do_something() { int actions = 0, reason, retval; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_POLL); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_POLL); check_suspend_activities(reason); if (reason) { @@ -619,7 +620,7 @@ void CLIENT_STATE::print_summary() { int t; if (!log_flags.state_debug) return; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_STATE); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_STATE); scope_messages.printf("CLIENT_STATE::print_summary(): Client state summary:\n"); ++log_messages; scope_messages.printf("%d projects:\n", (int)projects.size()); @@ -675,7 +676,7 @@ bool CLIENT_STATE::garbage_collect() { string error_msgs; PROJECT* project; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_STATE); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_STATE); // zero references counts on WUs, FILE_INFOs and APP_VERSIONs diff --git a/client/client_state.h b/client/client_state.h index 72aa6feaa3..afeb44aaac 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -32,7 +32,7 @@ #include "hostinfo.h" #include "http.h" #include "language.h" -#include "message.h" +//#include "message.h" #include "net_stats.h" #include "net_xfer.h" #include "pers_file_xfer.h" diff --git a/client/client_types.C b/client/client_types.C index 42ae851bdf..ed9e993dba 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -31,7 +31,7 @@ #include "error_numbers.h" #include "file_names.h" #include "filesys.h" -#include "message.h" +#include "client_msgs.h" #include "log_flags.h" #include "parse.h" #include "util.h" diff --git a/client/cpu_benchmark.C b/client/cpu_benchmark.C index 6d408e4a44..291f70e59a 100755 --- a/client/cpu_benchmark.C +++ b/client/cpu_benchmark.C @@ -35,7 +35,7 @@ #endif #include "error_numbers.h" -#include "message.h" +#include "client_msgs.h" #include "cpu_benchmark.h" diff --git a/client/cs_account.C b/client/cs_account.C index 23c387ad5d..6eda528933 100644 --- a/client/cs_account.C +++ b/client/cs_account.C @@ -26,11 +26,12 @@ #include #endif -#include "client_state.h" -#include "error_numbers.h" -#include "file_names.h" #include "filesys.h" #include "util.h" +#include "client_state.h" +#include "client_msgs.h" +#include "error_numbers.h" +#include "file_names.h" static inline string filename_to_project_dirname(const string& filename) { assert(starts_with(filename, "account_")); diff --git a/client/cs_apps.C b/client/cs_apps.C index 714bd601f0..82b5d9d434 100644 --- a/client/cs_apps.C +++ b/client/cs_apps.C @@ -39,6 +39,7 @@ #include "filesys.h" #include "shmem.h" #include "log_flags.h" +#include "client_msgs.h" #include "client_state.h" // Make a directory for each available slot @@ -160,7 +161,7 @@ bool CLIENT_STATE::handle_finished_apps() { ACTIVE_TASK* atp; bool action = false; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_TASK); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_TASK); for (i=0; i #endif -#include "message.h" +//#include "client_msgs.h" vector message_descs; diff --git a/client/net_stats.C b/client/net_stats.C index 2ba987218c..945f32bc68 100644 --- a/client/net_stats.C +++ b/client/net_stats.C @@ -40,7 +40,7 @@ #include "util.h" #include "error_numbers.h" -#include "message.h" +#include "client_msgs.h" #include "net_stats.h" diff --git a/client/net_xfer.C b/client/net_xfer.C index 8343f471b1..efc8e38142 100644 --- a/client/net_xfer.C +++ b/client/net_xfer.C @@ -74,7 +74,7 @@ #include "util.h" #include "client_types.h" #include "client_state.h" -#include "message.h" +#include "client_msgs.h" #if defined(_WIN32) typedef int socklen_t; @@ -366,7 +366,7 @@ int NET_XFER_SET::do_select(double& bytes_transferred, double timeout) { NET_XFER *nxp; struct timeval tv; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_NET_XFER); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_NET_XFER); // if a second has gone by, do rate-limit accounting // @@ -512,7 +512,7 @@ int NET_XFER::do_xfer(int& nbytes_transferred) { nbytes_transferred = 0; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_NET_XFER); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_NET_XFER); if (want_download) { #ifdef WIN32 @@ -606,7 +606,7 @@ void NET_XFER::got_error() { error = ERR_IO; io_done = true; log_messages.printf( - ClientMessages::DEBUG_NET_XFER, "IO error on socket %d\n", socket + CLIENT_MSG_LOG::DEBUG_NET_XFER, "IO error on socket %d\n", socket ); } diff --git a/client/pers_file_xfer.C b/client/pers_file_xfer.C index 4fbc292607..d0a3292ee9 100644 --- a/client/pers_file_xfer.C +++ b/client/pers_file_xfer.C @@ -28,16 +28,18 @@ #include #endif -#include "client_state.h" -#include "client_types.h" #include "error_numbers.h" -#include "file_names.h" #include "md5_file.h" #include "parse.h" #include "util.h" -#include "log_flags.h" #include "filesys.h" +#include "log_flags.h" +#include "file_names.h" +#include "client_state.h" +#include "client_types.h" +#include "client_msgs.h" + // PERS_FILE_XFER represents a persistent file transfer. // A set of URLs is given. // @@ -79,7 +81,7 @@ int PERS_FILE_XFER::start_xfer() { FILE_XFER *file_xfer; int retval; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_FILE_XFER); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_FILE_XFER); // Decide whether to start a new file transfer // @@ -165,7 +167,7 @@ int PERS_FILE_XFER::start_xfer() { bool PERS_FILE_XFER::poll(time_t now) { int retval; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_FILE_XFER); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_FILE_XFER); if (xfer_done) { return false; @@ -292,7 +294,7 @@ void PERS_FILE_XFER::retry_or_backoff() { time_t now; int backoff = 0; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_FILE_XFER); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_FILE_XFER); now = time(0); // newtime = localtime(&now); diff --git a/client/prefs.C b/client/prefs.C index 1ecb7996aa..e3897b46c1 100644 --- a/client/prefs.C +++ b/client/prefs.C @@ -32,7 +32,7 @@ #include "parse.h" #include "error_numbers.h" -#include "message.h" +#include "client_msgs.h" #include "file_names.h" #include "client_state.h" diff --git a/client/proxy.C b/client/proxy.C index 3980582993..0f8620c368 100644 --- a/client/proxy.C +++ b/client/proxy.C @@ -45,7 +45,7 @@ #include "error_numbers.h" #include "filesys.h" #include "util.h" -#include "message.h" +#include "client_msgs.h" #include "parse.h" #include "proxy.h" @@ -386,7 +386,7 @@ bool PROXY::proxy_poll() { bool action = false; char buf[256]; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_PROXY); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_PROXY); switch(proxy_state) { case PROXY_STATE_CONNECTING: diff --git a/client/scheduler_op.C b/client/scheduler_op.C index 79afadb2b0..7c183e343b 100644 --- a/client/scheduler_op.C +++ b/client/scheduler_op.C @@ -34,6 +34,7 @@ #include "client_state.h" #include "client_types.h" +#include "client_msgs.h" #include "file_names.h" #include "log_flags.h" #include "scheduler_op.h" @@ -114,7 +115,7 @@ int SCHEDULER_OP::init_op_project(double ns) { int retval; char err_msg[256]; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_SCHED_OP); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_SCHED_OP); scope_messages.printf("SCHEDULER_OP::init_op_project(): starting op for %s\n", project->master_url); @@ -152,7 +153,7 @@ int SCHEDULER_OP::set_min_rpc_time(PROJECT* p) { int n = p->nrpc_failures; if (n > gstate.retry_cap) n = gstate.retry_cap; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_SCHED_OP); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_SCHED_OP); // we've hit the limit on master_url fetches // @@ -203,7 +204,7 @@ void SCHEDULER_OP::backoff(PROJECT* p, char *error_msg ) { int SCHEDULER_OP::start_rpc() { int retval; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_SCHED_OP); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_SCHED_OP); safe_strcpy(scheduler_url, project->scheduler_urls[url_index].text); if (log_flags.sched_ops) { @@ -233,7 +234,7 @@ int SCHEDULER_OP::start_rpc() { int SCHEDULER_OP::init_master_fetch(PROJECT* p) { int retval; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_SCHED_OP); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_SCHED_OP); project = p; scope_messages.printf("SCHEDULER_OP::init_master_fetch(): Fetching master file for %s\n", project->master_url); @@ -272,7 +273,7 @@ int SCHEDULER_OP::parse_master_file(vector &urls) { STRING256 str; FILE* f; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_SCHED_OP); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_SCHED_OP); f = fopen(MASTER_FILE_NAME, "r"); if (!f) { @@ -335,7 +336,7 @@ bool SCHEDULER_OP::poll() { bool action = false, err = false; char err_msg[256], *err_url=NULL; - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_SCHED_OP); + SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_SCHED_OP); switch(state) { case SCHEDULER_OP_STATE_GET_MASTER: diff --git a/client/time_stats.C b/client/time_stats.C index 40cbfc1780..6438383ea2 100644 --- a/client/time_stats.C +++ b/client/time_stats.C @@ -30,7 +30,7 @@ #include "parse.h" #include "util.h" #include "error_numbers.h" -#include "message.h" +#include "client_msgs.h" #include "time_stats.h" diff --git a/doc/translations.php b/doc/translations.php index ba38303e2b..64ec260d7d 100644 --- a/doc/translations.php +++ b/doc/translations.php @@ -3,30 +3,44 @@ require_once("docutil.php"); page_head("Non-English pages about BOINC"); echo " Information about BOINC is available in the following languages: - +"; +list_start(); +list_item("Chinese", + "www.equn.com/boinchina" +); +list_item("Estonian", + "boinc.tmac.pri.ee" +); +list_item("Danish", + "www.boinc.dk +
www.setihome.dk" +); +list_item("Dutch", + "www.seti-nl.org" +); +list_item("Finnish", + "Universe Examiners" +); +list_item("French", + "www.boinc-fr.net" +); +list_item("German", + "www.boinc.de" +); +list_item("Italian", + "boinc.homeunix.org" +); +list_item("Japanese", + "fortunecity.com (by Komori Hitoshi)" +); +list_item("Russian", + "www.boinc.narod.ru" +); +list_item("Turkish", + "www.turksetiteam.org" +); +list_end(); +echo " If you'd like to add a web site to this list, please contact us. "; diff --git a/lib/messages.C b/lib/msg_log.C similarity index 64% rename from lib/messages.C rename to lib/msg_log.C index 1962b4c23d..312541c5ac 100644 --- a/lib/messages.C +++ b/lib/msg_log.C @@ -30,46 +30,45 @@ using namespace std; #endif #include "util.h" -#include "messages.h" +#include "msg_log.h" -////////////////////////////////////////////////////////////////////// +// MSG_LOG is a base class for writing messages not intended for the end user. +// This includes all server messages and client debugging messages. +// SCHED_MSG_LOG (in sched/sched_msg_log.C) decides which scheduler messages +// to print and formats the "kind" keyword; +// CLIENT_MSG_LOG does the same thing for client debugging output. // -// Messages is a base class for writing messages not intended for the end -// user. This includes all server messages and client debugging messages. -// SchedMessages (in sched/sched_messages.C) decides which scheduler messages -// to print and formats the "kind" keyword; ClientMessages does the same thing -// for client debugging output. -// -// Messages has an "indent_level" state for how many spaces to indent output. -// This corresponds in general to the function-call recursion level. Call -// Messages::enter_level() to increase by 1 level and leave_level() to -// decrease by 1 level. The ScopeMessages class takes care of calling -// leave_level() for you. Create a ScopeMessages object on the stack at the -// beginning of a function; it will increment the level by 1 on construction, -// and decrement the level by 1 on destruction at end of scope. This way you -// don't have to worry about decrementing before mid-function returns, -// exceptions, etc. +// MSG_LOG has an "indent_level" state for how many spaces to indent output. +// This corresponds in general to the function-call recursion level. +// Call MSG_LOG::enter_level() to increase by 1 level +// and leave_level() to decrease by 1 level. +// The SCOPE_MSG_LOG class takes care of calling leave_level() for you. +// Create a SCOPE_MSG_LOG object on the stack at the beginning of a function; +// it will increment the level by 1 on construction, +// and decrement the level by 1 on destruction at end of scope. +// This way you don't have to worry about decrementing +// before mid-function returns, exceptions, etc. // Each [v]printf* function prints the timestamp, the formatted KIND string, -// indentation level, then the specified string. The string to print can be -// a one-line string (including the trailing \n), a multi-line string (it's -// broken up into lines to get the prefix on each line), or a file (also -// broken up into lines). +// indentation level, then the specified string. +// The string to print can be a one-line string (including the trailing \n), +// a multi-line string (it's broken up into lines +// to get the prefix on each line), or a file (also broken up into lines). -// Scheduler functions should use "log_messages" which is an instance of -// SchedMessages. Client functions should use "log_messages" (also) which is -// an instance of ClientMessages. +// Scheduler functions should use "sched_messages" which is an instance of +// SCHED_MSG_LOG. Client functions should use "client_messages", +// which is an instance of CLIENT_MSG_LOG. -// See sched/sched_messages.C and client/client_messages.C for those classes. +// See sched/sched_msg_log.C and client/client_msg_log.C for those classes. -Messages::Messages(FILE* output_) { +MSG_LOG::MSG_LOG(FILE* output_) { output = output_; indent_level = 0; spaces[0] = 0; strcpy(spaces+1, " "); } -void Messages::enter_level(int diff) { +void MSG_LOG::enter_level(int diff) { assert (indent_level >= 0); spaces[indent_level] = ' '; indent_level += diff*2; @@ -77,7 +76,7 @@ void Messages::enter_level(int diff) { assert (indent_level >= 0); } -void Messages::vprintf(int kind, const char* format, va_list va) { +void MSG_LOG::vprintf(int kind, const char* format, va_list va) { const char* now_timestamp = time_to_string(time(0)); if (!v_message_wanted(kind)) return; fprintf(output, "%s [%s]%s ", now_timestamp, v_format_kind(kind), spaces); @@ -85,7 +84,7 @@ void Messages::vprintf(int kind, const char* format, va_list va) { } // break a multi-line string into lines (so that we show prefix on each line) -void Messages::vprintf_multiline( +void MSG_LOG::vprintf_multiline( int kind, const char* str, const char* prefix_format, va_list va ) { if (!v_message_wanted(kind)) return; @@ -113,7 +112,7 @@ void Messages::vprintf_multiline( } } -void Messages::vprintf_file( +void MSG_LOG::vprintf_file( int kind, const char* filename, const char* prefix_format, va_list va ) { if (!v_message_wanted(kind)) return; @@ -134,14 +133,14 @@ void Messages::vprintf_file( } } -void Messages::printf(int kind, const char* format, ...) { +void MSG_LOG::printf(int kind, const char* format, ...) { va_list va; va_start(va, format); vprintf(kind, format, va); va_end(va); } -void Messages::printf_multiline( +void MSG_LOG::printf_multiline( int kind, const char* str, const char* prefix_format, ... ) { va_list va; @@ -150,7 +149,7 @@ void Messages::printf_multiline( va_end(va); } -void Messages::printf_file( +void MSG_LOG::printf_file( int kind, const char* filename, const char* prefix_format, ... ) { va_list va; @@ -159,19 +158,18 @@ void Messages::printf_file( va_end(va); } -////////////////////////////////////////////////////////////////////// -// These ScopeMessages functions are utility functions that call their -// corresponding Messages functions with the same name, passing the KIND that -// was specified on creation of the ScopeMessages object. +// These SCOPE_MSG_LOG functions are utility functions that call their +// corresponding MSG_LOG functions with the same name, passing the KIND that +// was specified on creation of the SCOPE_MSG_LOG object. -void ScopeMessages::printf(const char* format, ...) { +void SCOPE_MSG_LOG::printf(const char* format, ...) { va_list va; va_start(va, format); messages.vprintf(kind, format, va); va_end(va); } -void ScopeMessages::printf_multiline( +void SCOPE_MSG_LOG::printf_multiline( const char* str, const char* prefix_format, ... ) { va_list va; @@ -180,7 +178,7 @@ void ScopeMessages::printf_multiline( va_end(va); } -void ScopeMessages::printf_file( +void SCOPE_MSG_LOG::printf_file( const char* filename, const char* prefix_format, ... ) { va_list va; diff --git a/lib/messages.h b/lib/msg_log.h similarity index 73% rename from lib/messages.h rename to lib/msg_log.h index 8672e2ae19..3b5301e3b4 100644 --- a/lib/messages.h +++ b/lib/msg_log.h @@ -3,22 +3,23 @@ // the __attribute((format...)) tags are GCC extensions that let the compiler // do like-checking on printf-like arguments +// #if !defined(__GNUC__) && !defined(__attribute__) #define __attribute__(x) /*nothing*/ #endif -class Messages { +class MSG_LOG { int debug_level; int indent_level; char spaces[80]; FILE* output; public: - Messages(FILE* output); + MSG_LOG(FILE* output); void enter_level(int = 1); void leave_level() { enter_level(-1); } - Messages& operator++() { enter_level(); return *this; } - Messages& operator--() { leave_level(); return *this; } + MSG_LOG& operator++() { enter_level(); return *this; } + MSG_LOG& operator--() { leave_level(); return *this; } void printf(int kind, const char* format, ...) __attribute__ ((format (printf, 3, 4))); void printf_multiline(int kind, const char* str, const char* prefix_format, ...) __attribute__ ((format (printf, 4, 5))); @@ -33,17 +34,18 @@ protected: virtual bool v_message_wanted(int kind) const = 0; }; -// automatically ++/--Messages on scope entry / exit. See lib/messages.C for commentary -class ScopeMessages -{ - Messages& messages; +// automatically ++/--MSG_LOG on scope entry / exit. +// See lib/msg_log.C for commentary +// +class SCOPE_MSG_LOG { + MSG_LOG& messages; int kind; public: - ScopeMessages(Messages& messages_, int kind_) : messages(messages_), kind(kind_) + SCOPE_MSG_LOG(MSG_LOG& messages_, int kind_) : messages(messages_), kind(kind_) { ++messages; } - ~ScopeMessages() { --messages; } - ScopeMessages& operator++() { ++messages; return *this; } - ScopeMessages& operator--() { --messages; return *this; } + ~SCOPE_MSG_LOG() { --messages; } + SCOPE_MSG_LOG& operator++() { ++messages; return *this; } + SCOPE_MSG_LOG& operator--() { --messages; return *this; } void printf(const char* format, ...) __attribute__ ((format (printf, 2, 3))); void printf_multiline(const char* str, const char* prefix_format, ...) __attribute__ ((format (printf, 3, 4))); diff --git a/sched/Makefile.am b/sched/Makefile.am index 6baa477928..55b179a788 100644 --- a/sched/Makefile.am +++ b/sched/Makefile.am @@ -33,7 +33,7 @@ libsched_a_SOURCES = \ sched_shmem.C \ sched_util.C \ sched_config.C \ - sched_messages.C \ + sched_msgs.C \ ../db/boinc_db.C \ ../db/db_base.C \ ../lib/util.C \ @@ -44,7 +44,7 @@ libsched_a_SOURCES = \ ../lib/shmem.C \ ../lib/md5.c \ ../lib/md5_file.C \ - ../lib/messages.C \ + ../lib/msg_log.C \ ../tools/process_result_template.C \ ../tools/backend_lib.C \ sched_config.h \ diff --git a/sched/Makefile.in b/sched/Makefile.in index 13b849dace..00c8b332a2 100644 --- a/sched/Makefile.in +++ b/sched/Makefile.in @@ -202,7 +202,7 @@ libsched_a_SOURCES = \ sched_shmem.C \ sched_util.C \ sched_config.C \ - sched_messages.C \ + sched_msgs.C \ ../db/boinc_db.C \ ../db/db_base.C \ ../lib/util.C \ @@ -213,7 +213,7 @@ libsched_a_SOURCES = \ ../lib/shmem.C \ ../lib/md5.c \ ../lib/md5_file.C \ - ../lib/messages.C \ + ../lib/msg_log.C \ ../tools/process_result_template.C \ ../tools/backend_lib.C \ sched_config.h \ @@ -291,12 +291,12 @@ LIBRARIES = $(noinst_LIBRARIES) libsched_a_AR = $(AR) cru libsched_a_LIBADD = am_libsched_a_OBJECTS = sched_shmem.$(OBJEXT) sched_util.$(OBJEXT) \ - sched_config.$(OBJEXT) sched_messages.$(OBJEXT) \ - boinc_db.$(OBJEXT) db_base.$(OBJEXT) util.$(OBJEXT) \ - crypt.$(OBJEXT) filesys.$(OBJEXT) parse.$(OBJEXT) \ - base64.$(OBJEXT) shmem.$(OBJEXT) md5.$(OBJEXT) \ - md5_file.$(OBJEXT) messages.$(OBJEXT) \ - process_result_template.$(OBJEXT) backend_lib.$(OBJEXT) + sched_config.$(OBJEXT) sched_msgs.$(OBJEXT) boinc_db.$(OBJEXT) \ + db_base.$(OBJEXT) util.$(OBJEXT) crypt.$(OBJEXT) \ + filesys.$(OBJEXT) parse.$(OBJEXT) base64.$(OBJEXT) \ + shmem.$(OBJEXT) md5.$(OBJEXT) md5_file.$(OBJEXT) \ + msg_log.$(OBJEXT) process_result_template.$(OBJEXT) \ + backend_lib.$(OBJEXT) libsched_a_OBJECTS = $(am_libsched_a_OBJECTS) EXTRA_PROGRAMS = fcgi$(EXEEXT) noinst_PROGRAMS = assimilator$(EXEEXT) cgi$(EXEEXT) feeder$(EXEEXT) \ @@ -389,12 +389,11 @@ am__depfiles_maybe = depfiles @AMDEP_TRUE@ ./$(DEPDIR)/filesys.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/handle_request.Po ./$(DEPDIR)/main.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/make_work.Po ./$(DEPDIR)/md5.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/md5_file.Po ./$(DEPDIR)/messages.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/md5_file.Po ./$(DEPDIR)/msg_log.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/parse.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/process_result_template.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/sched_config.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/sched_messages.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/sched_send.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/sched_msgs.Po ./$(DEPDIR)/sched_send.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/sched_shmem.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/sched_util.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/server_types.Po ./$(DEPDIR)/shmem.Po \ @@ -452,7 +451,7 @@ base64.$(OBJEXT): ../lib/base64.C shmem.$(OBJEXT): ../lib/shmem.C md5.$(OBJEXT): ../lib/md5.c md5_file.$(OBJEXT): ../lib/md5_file.C -messages.$(OBJEXT): ../lib/messages.C +msg_log.$(OBJEXT): ../lib/msg_log.C process_result_template.$(OBJEXT): ../tools/process_result_template.C backend_lib.$(OBJEXT): ../tools/backend_lib.C libsched.a: $(libsched_a_OBJECTS) $(libsched_a_DEPENDENCIES) @@ -558,11 +557,11 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/make_work.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5_file.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/messages.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msg_log.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/process_result_template.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_config.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_messages.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_msgs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_send.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_shmem.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_util.Po@am__quote@ @@ -803,27 +802,27 @@ md5_file.obj: ../lib/md5_file.C @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o md5_file.obj `if test -f '../lib/md5_file.C'; then $(CYGPATH_W) '../lib/md5_file.C'; else $(CYGPATH_W) '$(srcdir)/../lib/md5_file.C'` -messages.o: ../lib/messages.C -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT messages.o -MD -MP -MF "$(DEPDIR)/messages.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o messages.o `test -f '../lib/messages.C' || echo '$(srcdir)/'`../lib/messages.C; \ -@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/messages.Tpo" "$(DEPDIR)/messages.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/messages.Tpo"; exit 1; \ +msg_log.o: ../lib/msg_log.C +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT msg_log.o -MD -MP -MF "$(DEPDIR)/msg_log.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o msg_log.o `test -f '../lib/msg_log.C' || echo '$(srcdir)/'`../lib/msg_log.C; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/msg_log.Tpo" "$(DEPDIR)/msg_log.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/msg_log.Tpo"; exit 1; \ @am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../lib/messages.C' object='messages.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/messages.Po' tmpdepfile='$(DEPDIR)/messages.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../lib/msg_log.C' object='msg_log.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/msg_log.Po' tmpdepfile='$(DEPDIR)/msg_log.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o messages.o `test -f '../lib/messages.C' || echo '$(srcdir)/'`../lib/messages.C +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o msg_log.o `test -f '../lib/msg_log.C' || echo '$(srcdir)/'`../lib/msg_log.C -messages.obj: ../lib/messages.C -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT messages.obj -MD -MP -MF "$(DEPDIR)/messages.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o messages.obj `if test -f '../lib/messages.C'; then $(CYGPATH_W) '../lib/messages.C'; else $(CYGPATH_W) '$(srcdir)/../lib/messages.C'`; \ -@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/messages.Tpo" "$(DEPDIR)/messages.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/messages.Tpo"; exit 1; \ +msg_log.obj: ../lib/msg_log.C +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT msg_log.obj -MD -MP -MF "$(DEPDIR)/msg_log.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o msg_log.obj `if test -f '../lib/msg_log.C'; then $(CYGPATH_W) '../lib/msg_log.C'; else $(CYGPATH_W) '$(srcdir)/../lib/msg_log.C'`; \ +@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/msg_log.Tpo" "$(DEPDIR)/msg_log.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/msg_log.Tpo"; exit 1; \ @am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../lib/messages.C' object='messages.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/messages.Po' tmpdepfile='$(DEPDIR)/messages.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../lib/msg_log.C' object='msg_log.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/msg_log.Po' tmpdepfile='$(DEPDIR)/msg_log.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o messages.obj `if test -f '../lib/messages.C'; then $(CYGPATH_W) '../lib/messages.C'; else $(CYGPATH_W) '$(srcdir)/../lib/messages.C'` +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o msg_log.obj `if test -f '../lib/msg_log.C'; then $(CYGPATH_W) '../lib/msg_log.C'; else $(CYGPATH_W) '$(srcdir)/../lib/msg_log.C'` process_result_template.o: ../tools/process_result_template.C @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT process_result_template.o -MD -MP -MF "$(DEPDIR)/process_result_template.Tpo" \ diff --git a/sched/assimilate_handler.C b/sched/assimilate_handler.C index b508b33ac6..02a643ce18 100644 --- a/sched/assimilate_handler.C +++ b/sched/assimilate_handler.C @@ -1,33 +1,34 @@ #include #include "boinc_db.h" -#include "assimilate_handler.h" +#include "sched_msgs.h" #include "sched_util.h" +#include "assimilate_handler.h" void assimilate_handler( WORKUNIT& wu, vector& results, RESULT& canonical_result ) { - ScopeMessages scope_messages(log_messages, SchedMessages::NORMAL); + SCOPE_MSG_LOG scope_messages(log_messages, SCHED_MSG_LOG::NORMAL); scope_messages.printf("[%s] Assimilating\n", wu.name); if (wu.canonical_resultid) { scope_messages.printf("[%s] Found canonical result\n", wu.name); log_messages.printf_multiline( - SchedMessages::DEBUG, canonical_result.xml_doc_out, + SCHED_MSG_LOG::DEBUG, canonical_result.xml_doc_out, "[%s] canonical result", wu.name ); } else { scope_messages.printf("[%s] No canonical result\n", wu.name); } if (wu.error_mask&WU_ERROR_COULDNT_SEND_RESULT) { - log_messages.printf(SchedMessages::CRITICAL, "[%s] Error: couldn't send a result\n", wu.name); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[%s] Error: couldn't send a result\n", wu.name); } if (wu.error_mask&WU_ERROR_TOO_MANY_ERROR_RESULTS) { - log_messages.printf(SchedMessages::CRITICAL, "[%s] Error: too many error results\n", wu.name); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[%s] Error: too many error results\n", wu.name); } if (wu.error_mask&WU_ERROR_TOO_MANY_TOTAL_RESULTS) { - log_messages.printf(SchedMessages::CRITICAL, "[%s] Error: too many total results\n", wu.name); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[%s] Error: too many total results\n", wu.name); } if (wu.error_mask&WU_ERROR_TOO_MANY_SUCCESS_RESULTS) { - log_messages.printf(SchedMessages::CRITICAL, "[%s] Error: too many success results\n", wu.name); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[%s] Error: too many success results\n", wu.name); } } diff --git a/sched/assimilator.C b/sched/assimilator.C index 130faf59bd..e7872cbd0b 100644 --- a/sched/assimilator.C +++ b/sched/assimilator.C @@ -28,6 +28,7 @@ #include "util.h" #include "sched_config.h" #include "sched_util.h" +#include "sched_msgs.h" #include "assimilate_handler.h" #define LOCKFILE "assimilator.out" @@ -53,7 +54,7 @@ bool do_pass(APP& app) { vector results; // must be inside while()! did_something = true; - log_messages.printf(SchedMessages::DEBUG, + log_messages.printf(SCHED_MSG_LOG::DEBUG, "[%s] assimilating; state=%d\n", wu.name, wu.assimilate_state ); @@ -92,13 +93,13 @@ int main(int argc, char** argv) { } else if (!strcmp(argv[i], "-app")) { strcpy(app.name, argv[++i]); } else { - log_messages.printf(SchedMessages::CRITICAL, "Unrecognized arg: %s\n", argv[i]); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Unrecognized arg: %s\n", argv[i]); } } retval = config.parse_file(".."); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "Can't parse config file\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't parse config file\n"); exit(1); } @@ -110,21 +111,21 @@ int main(int argc, char** argv) { // // Call lock_file after fork(), because file locks are not always inherited // if (lock_file(LOCKFILE)) { - // log_messages.printf(SchedMessages::NORMAL, "Another copy of assimilator is already running\n"); + // log_messages.printf(SCHED_MSG_LOG::NORMAL, "Another copy of assimilator is already running\n"); // exit(1); // } // write_pid_file(PIDFILE); - log_messages.printf(SchedMessages::NORMAL, "Starting\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Starting\n"); retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "Can't open DB\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't open DB\n"); exit(1); } sprintf(buf, "where name='%s'", app.name); retval = app.lookup(buf); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "Can't find app\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't find app\n"); exit(1); } install_stop_signal_handler(); diff --git a/sched/db_dump.C b/sched/db_dump.C index f2436f1295..fae3172024 100644 --- a/sched/db_dump.C +++ b/sched/db_dump.C @@ -61,9 +61,11 @@ #include "boinc_db.h" #include "util.h" +#include "parse.h" + #include "sched_config.h" #include "sched_util.h" -#include "parse.h" +#include "sched_msgs.h" #define LOCKFILE "db_dump.out" @@ -645,24 +647,24 @@ int main(int argc, char** argv) { } if (nrecs_per_file_summary <= 0 || nrecs_per_file_detail <= 0) { - log_messages.printf(SchedMessages::NORMAL, "Too few records per file.\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Too few records per file.\n"); exit(1); } if (lock_file(LOCKFILE)) { - log_messages.printf(SchedMessages::NORMAL, "Another copy of db_dump is already running\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Another copy of db_dump is already running\n"); exit(1); } - log_messages.printf(SchedMessages::NORMAL, "Starting\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Starting\n"); retval = config.parse_file(".."); if (retval) { - log_messages.printf(SchedMessages::NORMAL, "Can't parse config file\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Can't parse config file\n"); exit(1); } retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd); if (retval) { - log_messages.printf(SchedMessages::NORMAL, "Can't open DB\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Can't open DB\n"); exit(1); } diff --git a/sched/feeder.C b/sched/feeder.C index 67159cafaa..74bbe453b4 100644 --- a/sched/feeder.C +++ b/sched/feeder.C @@ -92,6 +92,7 @@ #include "sched_config.h" #include "sched_shmem.h" #include "sched_util.h" +#include "sched_msgs.h" #define REREAD_DB_FILENAME "reread_db" #define LOCKFILE "feeder.out" @@ -133,7 +134,7 @@ static int remove_infeasible(int i) { wu = wu_result.workunit; log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[%s] declaring result as unsendable; infeasible count %d\n", result.name, wu_result.infeasible_count ); @@ -143,7 +144,7 @@ static int remove_infeasible(int i) { retval = result.update(); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[%s]: can't update: %d\n", result.name, retval ); @@ -153,7 +154,7 @@ static int remove_infeasible(int i) { retval = wu.update(); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[%s]: can't update: %d\n", wu.name, retval ); @@ -192,7 +193,7 @@ try_again: // there's no point in doing it again. // if (restarted_enum) { - log_messages.printf(SchedMessages::DEBUG, + log_messages.printf(SCHED_MSG_LOG::DEBUG, "already restarted enum on this array scan\n" ); break; @@ -202,11 +203,11 @@ try_again: // restarted_enum = true; retval = result.enumerate(clause); - log_messages.printf(SchedMessages::DEBUG, + log_messages.printf(SCHED_MSG_LOG::DEBUG, "restarting enumeration\n" ); if (retval) { - log_messages.printf(SchedMessages::DEBUG, + log_messages.printf(SCHED_MSG_LOG::DEBUG, "enumeration restart returned nothing\n" ); no_wus = true; @@ -220,14 +221,14 @@ try_again: // retval = result.lookup_id(result.id); if (retval) { - log_messages.printf(SchedMessages::NORMAL, + log_messages.printf(SCHED_MSG_LOG::NORMAL, "[%s] can't reread result: %d\n", result.name, retval ); goto try_again; } if (result.server_state != RESULT_SERVER_STATE_UNSENT) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[%s] RESULT STATE CHANGED\n", result.name ); @@ -245,14 +246,14 @@ try_again: } if (!collision) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[%s] adding result in slot %d\n", result.name, i ); retval = wu.lookup_id(result.workunitid); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[%s] can't read workunit #%d: %d\n", result.name, result.workunitid, retval ); @@ -319,17 +320,17 @@ void feeder_loop() { } #endif if (nadditions == 0) { - log_messages.printf(SchedMessages::DEBUG, "No results added; sleeping 1 sec\n"); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "No results added; sleeping 1 sec\n"); sleep(1); } else { - log_messages.printf(SchedMessages::DEBUG, "Added %d results to array\n", nadditions); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "Added %d results to array\n", nadditions); } if (no_wus) { - log_messages.printf(SchedMessages::DEBUG, "No results available; sleeping 5 sec\n"); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "No results available; sleeping 5 sec\n"); sleep(5); } if (ncollisions) { - log_messages.printf(SchedMessages::DEBUG, "Some results already in array - sleeping 5 sec\n"); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "Some results already in array - sleeping 5 sec\n"); sleep(5); } fflush(stdout); @@ -348,7 +349,7 @@ int main(int argc, char** argv) { retval = config.parse_file(".."); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't parse config file\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't parse config file\n"); exit(1); } @@ -366,7 +367,7 @@ int main(int argc, char** argv) { } } - log_messages.printf(SchedMessages::NORMAL, "Starting\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Starting\n"); get_project_dir(path, sizeof(path)); get_key(path, 'a', sema_key); @@ -375,12 +376,12 @@ int main(int argc, char** argv) { retval = destroy_shmem(config.shmem_key); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't destroy shmem\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't destroy shmem\n"); exit(1); } retval = create_shmem(config.shmem_key, sizeof(SCHED_SHMEM), &p); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't create shmem\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't create shmem\n"); exit(1); } ssp = (SCHED_SHMEM*)p; @@ -391,13 +392,13 @@ int main(int argc, char** argv) { retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "boinc_db.open: %d; %s\n", retval, boinc_db.error_string()); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "boinc_db.open: %d; %s\n", retval, boinc_db.error_string()); exit(1); } ssp->scan_tables(); log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "feeder: read " "%d platforms, " "%d apps, " diff --git a/sched/file_deleter.C b/sched/file_deleter.C index 49fd1633ce..853be39a46 100644 --- a/sched/file_deleter.C +++ b/sched/file_deleter.C @@ -30,6 +30,7 @@ #include "util.h" #include "sched_config.h" #include "sched_util.h" +#include "sched_msgs.h" #define LOCKFILE "file_deleter.out" #define PIDFILE "file_deleter.pid" @@ -56,14 +57,14 @@ int wu_delete_files(WORKUNIT& wu) { } else if (match_tag(p, "")) { if (!no_delete) { sprintf(pathname, "%s/%s", config.download_dir, filename); - log_messages.printf(SchedMessages::NORMAL, "[%s] deleting download/%s\n", wu.name, filename); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "[%s] deleting download/%s\n", wu.name, filename); unlink(pathname); ++count_deleted; } } p = strtok(0, "\n"); } - log_messages.printf(SchedMessages::DEBUG, "[%s] deleted %d file(s)\n", wu.name, count_deleted); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "[%s] deleted %d file(s)\n", wu.name, count_deleted); return 0; } @@ -87,7 +88,7 @@ int result_delete_files(RESULT& result) { sprintf(pathname, "%s/%s", config.upload_dir, filename); retval = unlink(pathname); ++count_deleted; - log_messages.printf(SchedMessages::NORMAL, + log_messages.printf(SCHED_MSG_LOG::NORMAL, "[%s] unlinked %s; retval %d\n", result.name, filename, retval ); @@ -96,7 +97,7 @@ int result_delete_files(RESULT& result) { p = strtok(0, "\n"); } - log_messages.printf(SchedMessages::DEBUG, + log_messages.printf(SCHED_MSG_LOG::DEBUG, "[%s] deleted %d file(s)\n", result.name, count_deleted ); return 0; @@ -144,13 +145,13 @@ int main(int argc, char** argv) { } else if (!strcmp(argv[i], "-d")) { log_messages.set_debug_level(atoi(argv[++i])); } else { - log_messages.printf(SchedMessages::CRITICAL, "Unrecognized arg: %s\n", argv[i]); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Unrecognized arg: %s\n", argv[i]); } } retval = config.parse_file(".."); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "Can't parse config file\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't parse config file\n"); exit(1); } @@ -162,15 +163,15 @@ int main(int argc, char** argv) { // // Call lock_file after fork(), because file locks are not always inherited // if (lock_file(LOCKFILE)) { - // log_messages.printf(SchedMessages::NORMAL, "Another copy of file deleter is running\n"); + // log_messages.printf(SCHED_MSG_LOG::NORMAL, "Another copy of file deleter is running\n"); // exit(1); // } // write_pid_file(PIDFILE); - log_messages.printf(SchedMessages::NORMAL, "Starting\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Starting\n"); retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't open DB\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't open DB\n"); exit(1); } install_stop_signal_handler(); diff --git a/sched/file_upload_handler.C b/sched/file_upload_handler.C index 0b7426f912..ebb2ec7716 100644 --- a/sched/file_upload_handler.C +++ b/sched/file_upload_handler.C @@ -22,6 +22,9 @@ // Revision History: // // $Log$ +// Revision 1.56 2004/04/08 08:15:20 davea +// *** empty log message *** +// // Revision 1.55 2004/01/22 01:35:09 boincadm // *** empty log message *** // @@ -46,18 +49,20 @@ #include #endif +#include "crypt.h" #include "parse.h" #include "util.h" + #include "sched_config.h" #include "sched_util.h" -#include "crypt.h" +#include "sched_msgs.h" SCHED_CONFIG config; #define ERR_TRANSIENT true #define ERR_PERMANENT false -#define DEBUG_LEVEL SchedMessages::NORMAL +#define DEBUG_LEVEL SCHED_MSG_LOG::NORMAL void get_log_path(char* p) { char buf[256]; @@ -80,7 +85,7 @@ int FILE_INFO::parse(FILE* in) { memset(this, 0, sizeof(FILE_INFO)); signed_xml = strdup(""); while (fgets(buf, 256, in)) { - log_messages.printf(SchedMessages::DEBUG, buf, "FILE_INFO::parse: "); + log_messages.printf(SCHED_MSG_LOG::DEBUG, buf, "FILE_INFO::parse: "); if (match_tag(buf, "")) return 0; else if (match_tag(buf, "")) { retval = dup_element_contents(in, "", &xml_signature); @@ -93,7 +98,7 @@ int FILE_INFO::parse(FILE* in) { if (match_tag(buf, "")) continue; if (match_tag(buf, "")) continue; if (match_tag(buf, "")) continue; - log_messages.printf(SchedMessages::NORMAL, "FILE_INFO::parse: unrecognized: %s \n", buf); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "FILE_INFO::parse: unrecognized: %s \n", buf); } return 1; } @@ -122,7 +127,7 @@ int return_error(bool transient, const char* message, ...) { va_end(va); log_messages.printf( - SchedMessages::NORMAL, "Returning error to client %s: %s (%s)\n", + SCHED_MSG_LOG::NORMAL, "Returning error to client %s: %s (%s)\n", get_remote_addr(), buf, transient?"transient":"permanent" ); @@ -170,7 +175,7 @@ int copy_socket_to_file(FILE* in, char* path, double offset, double nbytes) { bytes_left = nbytes - offset; if (bytes_left == 0) { fclose(out); - log_messages.printf(SchedMessages::DEBUG, "offset == nbytes: %f\n", nbytes); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "offset == nbytes: %f\n", nbytes); return return_success(0); } @@ -225,12 +230,12 @@ int handle_file_upload(FILE* in, R_RSA_PUBLIC_KEY& key) { file_info.signed_xml, file_info.xml_signature, key, is_valid ); if (retval || !is_valid) { - log_messages.printf(SchedMessages::CRITICAL, + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "verify_string() = %d, is_valid = %d\n", retval, is_valid ); - log_messages.printf(SchedMessages::NORMAL, file_info.signed_xml, "signed xml: "); - log_messages.printf(SchedMessages::NORMAL, file_info.xml_signature, "signature: "); + log_messages.printf(SCHED_MSG_LOG::NORMAL, file_info.signed_xml, "signed xml: "); + log_messages.printf(SCHED_MSG_LOG::NORMAL, file_info.xml_signature, "signature: "); return return_error(ERR_PERMANENT, "invalid signature"); } continue; @@ -264,7 +269,7 @@ int handle_file_upload(FILE* in, R_RSA_PUBLIC_KEY& key) { sprintf(path, "%s/%s", config.upload_dir, file_info.name); log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "Handling upload of %s from %s [offset=%.0f, nbytes=%.0f]\n", file_info.name, get_remote_addr(), @@ -272,14 +277,14 @@ int handle_file_upload(FILE* in, R_RSA_PUBLIC_KEY& key) { ); if (offset >= nbytes) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "ERROR: offset >= nbytes!!\n" ); return return_success(0); } return copy_socket_to_file(in, path, offset, nbytes); } else { - log_messages.printf(SchedMessages::CRITICAL, + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "unrecognized: %s", buf ); } @@ -300,14 +305,14 @@ int handle_get_file_size(char* file_name) { sprintf(path, "%s/%s", config.upload_dir, file_name ); retval = stat( path, &sbuf ); if (retval && errno != ENOENT) { - log_messages.printf(SchedMessages::DEBUG, "handle_get_file_size(): [%s] returning error\n", file_name); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "handle_get_file_size(): [%s] returning error\n", file_name); return return_error(ERR_TRANSIENT, "cannot open file" ); } else if (retval) { - log_messages.printf(SchedMessages::DEBUG, "handle_get_file_size(): [%s] returning zero\n", file_name); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "handle_get_file_size(): [%s] returning zero\n", file_name); return return_success("0"); } else { log_messages.printf( - SchedMessages::DEBUG, "handle_get_file_size(): [%s] returning %d\n", + SCHED_MSG_LOG::DEBUG, "handle_get_file_size(): [%s] returning %d\n", file_name, (int)sbuf.st_size ); sprintf(buf, "%d", (int)sbuf.st_size); @@ -326,7 +331,7 @@ int handle_request(FILE* in, R_RSA_PUBLIC_KEY& key) { bool did_something = false; while (fgets(buf, 256, in)) { - log_messages.printf(SchedMessages::DEBUG, buf, "handle_request: "); + log_messages.printf(SCHED_MSG_LOG::DEBUG, buf, "handle_request: "); if (parse_int(buf, "", major)) { if (major != MAJOR_VERSION) { retval = return_error(ERR_PERMANENT, @@ -357,11 +362,11 @@ int handle_request(FILE* in, R_RSA_PUBLIC_KEY& key) { did_something = true; break; } else { - log_messages.printf(SchedMessages::DEBUG, "handle_request: unrecognized %s\n", buf); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "handle_request: unrecognized %s\n", buf); } } if (!did_something) { - log_messages.printf(SchedMessages::CRITICAL, "handle_request: no command\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "handle_request: no command\n"); return return_error(ERR_PERMANENT, "no command"); } diff --git a/sched/handle_request.C b/sched/handle_request.C index c6928a3f1e..5c5a58e3ff 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -40,6 +40,7 @@ using namespace std; #include "sched_util.h" #include "main.h" #include "handle_request.h" +#include "sched_msgs.h" #include "sched_send.h" const double COBBLESTONE_FACTOR = 300.0; @@ -61,7 +62,7 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { strcpy(reply.message, "Can't find host record"); strcpy(reply.message_priority, "low"); log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[HOST#%d?] can't find host\n", sreq.hostid ); @@ -79,7 +80,7 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { reply.request_delay = 120; reply.nucleus_only = true; log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[HOST#%d] [USER#%d?] can't find user record\n", host.id, reply.host.userid ); @@ -95,7 +96,7 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { reply.request_delay = 120; reply.nucleus_only = true; log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[HOST#%d] [USER#%d] Bad authenticator '%s'\n", host.id, user.id, sreq.authenticator ); @@ -108,7 +109,7 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { if (sreq.rpc_seqno < reply.host.rpc_seqno) { sreq.hostid = 0; log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[HOST#%d] [USER#%d] RPC seqno %d less than expected %d; creating new host\n", reply.host.id, user.id, sreq.rpc_seqno, reply.host.rpc_seqno ); @@ -134,7 +135,7 @@ lookup_user_and_make_new_host: strcpy(reply.message_priority, "low"); reply.request_delay = 120; log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[HOST#] Bad authenticator '%s'\n", sreq.authenticator ); @@ -156,7 +157,7 @@ make_new_host: strcpy(reply.message, "Couldn't create host record in database"); strcpy(reply.message_priority, "low"); boinc_db.print_error("host.insert()"); - log_messages.printf(SchedMessages::CRITICAL, "host.insert() failed\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "host.insert() failed\n"); return retval; } host.id = boinc_db.insert_id(); @@ -223,7 +224,7 @@ int update_host_record(SCHEDULER_REQUEST& sreq, HOST& xhost) { retval = host.update(); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "host.update() failed: %d\n", retval); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "host.update() failed: %d\n", retval); } return 0; } @@ -288,7 +289,7 @@ int handle_results( retval = result.lookup(buf); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[HOST#%d] [RESULT#? %s] can't find result\n", host.id, rp->name ); @@ -296,13 +297,13 @@ int handle_results( } log_messages.printf( - SchedMessages::NORMAL, "[HOST#%d] [RESULT#%d %s] got result\n", + SCHED_MSG_LOG::NORMAL, "[HOST#%d] [RESULT#%d %s] got result\n", host.id, result.id, result.name ); if (result.server_state == RESULT_SERVER_STATE_UNSENT) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[HOST#%d] [RESULT#%d %s] got unexpected result: server state is %d\n", host.id, result.id, result.name, result.server_state ); @@ -311,7 +312,7 @@ int handle_results( if (result.received_time) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[HOST#%d] [RESULT#%d %s] got result twice\n", host.id, result.id, result.name ); @@ -320,7 +321,7 @@ int handle_results( if (result.hostid != sreq.hostid) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[HOST#%d] [RESULT#%d %s] got result from wrong host; expected [HOST#%d]\n", host.id, result.id, result.name, result.hostid ); @@ -329,21 +330,21 @@ int handle_results( if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[RESULT#%d %s] Can't lookup [HOST#%d]\n", result.id, result.name, result.hostid ); continue; } else if (result_host.userid != host.userid) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[USER#%d] [HOST#%d] [RESULT#%d %s] Not even the same user; expected [USER#%d]\n", host.userid, host.id, result.id, result.name, result_host.userid ); continue; } else { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[HOST#%d] [RESULT#%d %s] Allowing result because same USER#%d\n", host.id, result.id, result.name, host.userid ); @@ -371,12 +372,12 @@ int handle_results( if ((result.client_state == RESULT_FILES_UPLOADED) && (result.exit_status == 0)) { result.outcome = RESULT_OUTCOME_SUCCESS; - log_messages.printf(SchedMessages::DEBUG, + log_messages.printf(SCHED_MSG_LOG::DEBUG, "[RESULT#%d %s]: setting outcome SUCCESS\n", result.id, result.name ); } else { - log_messages.printf(SchedMessages::DEBUG, + log_messages.printf(SCHED_MSG_LOG::DEBUG, "[RESULT#%d %s]: client_state %d exit_status %d; setting outcome ERROR\n", result.id, result.name, result.client_state, result.exit_status ); @@ -388,7 +389,7 @@ int handle_results( retval = result.update(); if (retval) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[HOST#%d] [RESULT#%d %s] can't update result: %s\n", host.id, result.id, result.name, boinc_db.error_string() ); @@ -399,7 +400,7 @@ int handle_results( retval = wu.lookup_id(result.workunitid); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[HOST#%d] [RESULT#%d %s] Can't find [WU#%d] for result\n", host.id, result.id, result.name, result.workunitid ); @@ -408,7 +409,7 @@ int handle_results( retval = wu.update(); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[HOST#%d] [RESULT#%d %s] Can't update [WU#%d %s]\n", host.id, result.id, result.name, wu.id, wu.name ); @@ -431,7 +432,7 @@ void send_code_sign_key( if (strlen(sreq.code_sign_key)) { if (strcmp(sreq.code_sign_key, code_sign_key)) { - log_messages.printf(SchedMessages::NORMAL, "received old code sign key\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "received old code sign key\n"); // look for a signature file // @@ -483,7 +484,7 @@ bool wrong_major_version(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { ); strcpy(reply.message_priority, "low"); log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[HOST#%d] [auth %s] Wrong major version from user: wanted %d, got %d\n", sreq.hostid, sreq.authenticator, MAJOR_VERSION, sreq.core_client_major_version @@ -512,14 +513,14 @@ void handle_trickle_ups(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { retval = result.lookup(buf); if (retval) continue; if (reply.user.id != result.userid) { - log_messages.printf(SchedMessages::NORMAL, + log_messages.printf(SCHED_MSG_LOG::NORMAL, "[HOST#%d] trickle up: wrong user ID %d, %d\n", sreq.host.id, reply.user.id, result.userid ); continue; } if (sreq.host.id != result.hostid) { - log_messages.printf(SchedMessages::NORMAL, + log_messages.printf(SCHED_MSG_LOG::NORMAL, "[HOST#%d] trickle up: wrong host ID %d\n", sreq.host.id, result.hostid ); @@ -533,7 +534,7 @@ void handle_trickle_ups(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { safe_strcpy(trickle.xml, td.trickle_text.c_str()); retval = trickle.insert(); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[HOST#%d] trickle insert failed: %d\n", sreq.host.id, retval ); @@ -568,7 +569,7 @@ void process_request( retval = authenticate_user(sreq, reply); if (retval) return; if (reply.user.id == 0) { - log_messages.printf(SchedMessages::CRITICAL, "No user ID!\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "No user ID!\n"); } last_rpc_time = reply.host.rpc_time; @@ -582,14 +583,14 @@ void process_request( sprintf(reply.message, "platform '%s' not found", sreq.platform_name); strcpy(reply.message_priority, "low"); log_messages.printf( - SchedMessages::CRITICAL, "[HOST#%d] platform '%s' not found\n", + SCHED_MSG_LOG::CRITICAL, "[HOST#%d] platform '%s' not found\n", reply.host.id, sreq.platform_name ); return; } log_messages.printf( - SchedMessages::NORMAL, "Processing request from [USER#%d] [HOST#%d] [IP %s] [RPC#%d] core client version %d.%02d\n", + SCHED_MSG_LOG::NORMAL, "Processing request from [USER#%d] [HOST#%d] [IP %s] [RPC#%d] core client version %d.%02d\n", reply.user.id, reply.host.id, get_remote_addr(), sreq.rpc_seqno, @@ -608,7 +609,7 @@ void process_request( if (diff < config.min_sendwork_interval) { ok_to_send = false; log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "Not sending work - last RPC too recent: %f\n", diff ); sprintf(reply.message, @@ -640,14 +641,14 @@ void handle_request( if (sreq.parse(fin) == 0){ log_messages.printf( - SchedMessages::NORMAL, "Handling request: IP %s, auth %s, platform %s, version %d.%d\n", + SCHED_MSG_LOG::NORMAL, "Handling request: IP %s, auth %s, platform %s, version %d.%d\n", get_remote_addr(), sreq.authenticator, sreq.platform_name, sreq.core_client_major_version, sreq.core_client_minor_version ); process_request(sreq, sreply, ss, code_sign_key); } else { log_messages.printf( - SchedMessages::NORMAL, "Incomplete request received from IP %s, auth %s, platform %s, version %d.%d\n", + SCHED_MSG_LOG::NORMAL, "Incomplete request received from IP %s, auth %s, platform %s, version %d.%d\n", get_remote_addr(), sreq.authenticator, sreq.platform_name, sreq.core_client_major_version, sreq.core_client_minor_version ); diff --git a/sched/main.C b/sched/main.C index 8222262f89..6401c6f170 100644 --- a/sched/main.C +++ b/sched/main.C @@ -39,8 +39,9 @@ using namespace std; #include "sched_config.h" #include "server_types.h" #include "handle_request.h" -#include "main.h" #include "sched_util.h" +#include "sched_msgs.h" +#include "main.h" #define DEBUG_LEVEL 999 @@ -93,14 +94,14 @@ int main() { retval = config.parse_file(".."); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "Can't parse config file\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't parse config file\n"); exit(1); } sprintf(path, "%s/code_sign_public", config.key_dir); retval = read_file_malloc(path, code_sign_key); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't read code sign key file (%s)\n", path ); exit(1); @@ -111,7 +112,7 @@ int main() { retval = attach_shmem(config.shmem_key, &p); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't attach shmem (feeder not running?)\n" ); project_stopped = true; @@ -119,7 +120,7 @@ int main() { ssp = (SCHED_SHMEM*)p; retval = ssp->verify(); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "shmem has wrong struct sizes - recompile\n" ); exit(1); @@ -127,18 +128,18 @@ int main() { for (i=0; i<10; i++) { if (ssp->ready) break; - log_messages.printf(SchedMessages::DEBUG, "waiting for ready flag\n"); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "waiting for ready flag\n"); sleep(1); } if (!ssp->ready) { - log_messages.printf(SchedMessages::CRITICAL, "feeder doesn't seem to be running\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "feeder doesn't seem to be running\n"); exit(1); } } retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't open database\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't open database\n"); project_stopped = true; } else { found = false; @@ -146,7 +147,7 @@ int main() { found = true; } if (!found) { - log_messages.printf(SchedMessages::CRITICAL, "can't find project\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't find project\n"); exit(1); } } @@ -172,19 +173,19 @@ int main() { sprintf(reply_path, "%s%d_%u", REPLY_FILE_PREFIX, pid, counter); fout = fopen(req_path, "w"); if (!fout) { - log_messages.printf(SchedMessages::CRITICAL, "can't write request file\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't write request file\n"); exit(1); } copy_stream(stdin, fout); fclose(fout); fin = fopen(req_path, "r"); if (!fin) { - log_messages.printf(SchedMessages::CRITICAL, "can't read request file\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't read request file\n"); exit(1); } fout = fopen(reply_path, "w"); if (!fout) { - log_messages.printf(SchedMessages::CRITICAL, "can't write reply file\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't write reply file\n"); exit(1); } handle_request(fin, fout, *ssp, code_sign_key); @@ -192,7 +193,7 @@ int main() { fclose(fout); fin = fopen(reply_path, "r"); if (!fin) { - log_messages.printf(SchedMessages::CRITICAL, "can't read reply file\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't read reply file\n"); exit(1); } copy_stream(fin, stdout); diff --git a/sched/make_work.C b/sched/make_work.C index b4814f3632..841a95e34f 100644 --- a/sched/make_work.C +++ b/sched/make_work.C @@ -46,6 +46,7 @@ #include "sched_config.h" #include "parse.h" #include "sched_util.h" +#include "sched_msgs.h" #define LOCKFILE "make_work.out" #define PIDFILE "make_work.pid" @@ -98,7 +99,7 @@ int count_results(char* query) { DB_RESULT result; int retval = result.count(n, query); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't count results\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't count results\n"); exit(1); } return n; @@ -109,7 +110,7 @@ int count_workunits(const char* query="") { DB_WORKUNIT workunit; int retval = workunit.count(n, const_cast(query)); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't count workunits\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't count workunits\n"); exit(1); } return n; @@ -129,20 +130,20 @@ void make_work() { retval = config.parse_file(".."); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't read config file\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't read config file\n"); exit(1); } retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't open db\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't open db\n"); exit(1); } sprintf(buf, "where name='%s'", wu_name); retval = wu.lookup(buf); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't find wu %s\n", wu_name); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't find wu %s\n", wu_name); exit(1); } @@ -151,13 +152,13 @@ void make_work() { sprintf(keypath, "%s/upload_private", config.key_dir); retval = read_key_file(keypath, key); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't read key\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't read key\n"); exit(1); } retval = read_filename(result_template_file, result_template); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't open result template\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't open result template\n"); exit(1); } while (1) { @@ -170,7 +171,7 @@ void make_work() { int unsent_results = count_results(buf); int total_wus = count_workunits(); if (max_wus && total_wus >= max_wus) { - log_messages.printf(SchedMessages::NORMAL, "Reached max_wus = %d\n", max_wus); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Reached max_wus = %d\n", max_wus); exit(0); } if (unsent_results > cushion) { @@ -194,11 +195,11 @@ void make_work() { new_pathname, "%s/%s",config.download_dir, new_file_name ); sprintf(command,"ln %s %s", pathname, new_pathname); - log_messages.printf(SchedMessages::DEBUG, "executing command: %s\n", command); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "executing command: %s\n", command); retval = system(command); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, "system() error %d\n", retval + SCHED_MSG_LOG::CRITICAL, "system() error %d\n", retval ); perror(command); exit(1); @@ -233,13 +234,13 @@ void make_work() { process_result_template_upload_url_only(wu.result_template, config.upload_url); retval = wu.insert(); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Failed to created WU, error %d; exiting\n", retval ); exit(retval); } wu.id = boinc_db.insert_id(); - log_messages.printf(SchedMessages::DEBUG, "[%s] Created new WU\n", wu.name); + log_messages.printf(SCHED_MSG_LOG::DEBUG, "[%s] Created new WU\n", wu.name); } } @@ -289,12 +290,12 @@ int main(int argc, char** argv) { // // Call lock_file after fork(), because file locks are not always inherited // if (lock_file(LOCKFILE)) { - // log_messages.printf(SchedMessages::NORMAL, "Another copy of make_work is already running\n"); + // log_messages.printf(SCHED_MSG_LOG::NORMAL, "Another copy of make_work is already running\n"); // exit(1); // } // write_pid_file(PIDFILE); log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "Starting: min_quorum=%d target_nresults=%d max_error_results=%d max_total_results=%d max_success_results=%d\n", min_quorum, target_nresults, max_error_results, max_total_results, max_success_results ); diff --git a/sched/sched_messages.C b/sched/sched_msgs.C similarity index 85% rename from sched/sched_messages.C rename to sched/sched_msgs.C index 2bc1009e40..81eae03d69 100644 --- a/sched/sched_messages.C +++ b/sched/sched_msgs.C @@ -17,12 +17,11 @@ // Contributor(s): // -#include "sched_util.h" -#include +#include "sched_msgs.h" -SchedMessages log_messages; +SCHED_MSG_LOG log_messages; -const char* SchedMessages::v_format_kind(int kind) const { +const char* SCHED_MSG_LOG::v_format_kind(int kind) const { switch(kind) { case CRITICAL: return "CRITICAL"; case NORMAL: return "normal "; @@ -31,6 +30,6 @@ const char* SchedMessages::v_format_kind(int kind) const { } } -bool SchedMessages::v_message_wanted(int kind) const { +bool SCHED_MSG_LOG::v_message_wanted(int kind) const { return ( kind <= debug_level ); } diff --git a/sched/sched_msgs.h b/sched/sched_msgs.h new file mode 100644 index 0000000000..8baf0e144c --- /dev/null +++ b/sched/sched_msgs.h @@ -0,0 +1,17 @@ +#include "msg_log.h" + +class SCHED_MSG_LOG : public MSG_LOG { + int debug_level; + const char* v_format_kind(int kind) const; + bool v_message_wanted(int kind) const; +public: + enum Kind { + CRITICAL, + NORMAL, + DEBUG + }; + SCHED_MSG_LOG(): MSG_LOG(stderr) {} + void set_debug_level(int new_level) { debug_level = new_level; } +}; + +extern SCHED_MSG_LOG log_messages; diff --git a/sched/sched_send.C b/sched/sched_send.C index 3a1b91ec1b..77c9ac9dc3 100644 --- a/sched/sched_send.C +++ b/sched/sched_send.C @@ -31,6 +31,7 @@ using namespace std; #include "sched_config.h" #include "sched_util.h" #include "main.h" +#include "sched_msgs.h" #include "sched_send.h" const int MIN_SECONDS_TO_SEND = 0; @@ -98,18 +99,18 @@ double max_allowable_disk(SCHEDULER_REQUEST& req) { x = min(x1, min(x2, x3)); if (x < 0) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "disk_max_used_gb %f disk_max_used_pct %f disk_min_free_gb %f\n", prefs.disk_max_used_gb, prefs.disk_max_used_pct, prefs.disk_min_free_gb ); log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "req.total_disk_usage %f host.d_total %f host.d_free %f\n", req.total_disk_usage, host.d_total, host.d_free ); log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "x1 %f x2 %f x3 %f x %f\n", x1, x2, x3, x ); @@ -149,7 +150,7 @@ bool wu_is_feasible(WORKUNIT& wu, HOST& host, WORK_REQ& wreq) { if (wu.rsc_memory_bound > m_nbytes) { log_messages.printf( - SchedMessages::DEBUG, "[WU#%d %s] needs %f mem; [HOST#%d] has %f\n", + SCHED_MSG_LOG::DEBUG, "[WU#%d %s] needs %f mem; [HOST#%d] has %f\n", wu.id, wu.name, wu.rsc_memory_bound, host.id, m_nbytes ); wreq.insufficient_mem = true; @@ -161,7 +162,7 @@ bool wu_is_feasible(WORKUNIT& wu, HOST& host, WORK_REQ& wreq) { if (host_remaining_time + wu_wallclock_time > wu.delay_bound) { log_messages.printf( - SchedMessages::DEBUG, "[WU#%d %s] needs requires %d seconds on [HOST#%d]; delay_bound is %d\n", + SCHED_MSG_LOG::DEBUG, "[WU#%d %s] needs requires %d seconds on [HOST#%d]; delay_bound is %d\n", wu.id, wu.name, (int)wu_wallclock_time, host.id, wu.delay_bound ); wreq.insufficient_speed = true; @@ -178,12 +179,12 @@ int insert_after(char* buffer, char* after, char* text) { char temp[MEDIUM_BLOB_SIZE]; if (strlen(buffer) + strlen(text) > MEDIUM_BLOB_SIZE-1) { - log_messages.printf(SchedMessages::NORMAL, "insert_after: overflow\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "insert_after: overflow\n"); return ERR_BUFFER_OVERFLOW; } p = strstr(buffer, after); if (!p) { - log_messages.printf(SchedMessages::CRITICAL, "insert_after: %s not found in %s\n", after, buffer); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "insert_after: %s not found in %s\n", after, buffer); return ERR_NULL; } p += strlen(after); @@ -226,14 +227,14 @@ bool find_app_version( app = ss.lookup_app(wu.appid); if (!app) { log_messages.printf( - SchedMessages::CRITICAL, "Can't find APP#%d\n", wu.appid + SCHED_MSG_LOG::CRITICAL, "Can't find APP#%d\n", wu.appid ); return false; } avp = ss.lookup_app_version(app->id, platform.id, app->min_version); if (!avp) { log_messages.printf( - SchedMessages::DEBUG, + SCHED_MSG_LOG::DEBUG, "no app version available: APP#%d PLATFORM#%d min_version %d\n", app->id, platform.id, app->min_version ); @@ -249,7 +250,7 @@ bool app_core_compatible(WORK_REQ& wreq, APP_VERSION& av) { if (wreq.core_client_version < av.min_core_version) { #if 0 log_messages.printf( - SchedMessages::DEBUG, + SCHED_MSG_LOG::DEBUG, "Outdated core version: wanted %d, got %d\n", av.min_core_version, wreq.core_client_version ); @@ -278,7 +279,7 @@ int add_wu_to_reply( reply.insert_app_unique(*app); reply.insert_app_version_unique(*avp); log_messages.printf( - SchedMessages::DEBUG, + SCHED_MSG_LOG::DEBUG, "[HOST#%d] Sending app_version %s %s %d\n", reply.host.id, app->name, platform.name, avp->version_num ); @@ -289,7 +290,7 @@ int add_wu_to_reply( wu2 = wu; // make copy since we're going to modify its XML field retval = insert_wu_tags(wu2, *app); if (retval) { - log_messages.printf(SchedMessages::NORMAL, "insert_wu_tags failed\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "insert_wu_tags failed\n"); return retval; } reply.insert_workunit_unique(wu2); @@ -416,7 +417,7 @@ static void scan_work_array( wu = wu_result.workunit; if (!wu_is_feasible(wu, reply.host, wreq)) { log_messages.printf( - SchedMessages::DEBUG, "[HOST#%d] [WU#%d %s] WU is infeasible\n", + SCHED_MSG_LOG::DEBUG, "[HOST#%d] [WU#%d %s] WU is infeasible\n", reply.host.id, wu.id, wu.name ); wu_result.infeasible_count++; @@ -460,7 +461,7 @@ static void scan_work_array( retval = result.count(n, buf); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "send_work: can't get result count (%d)\n", retval ); goto dont_send; @@ -468,7 +469,7 @@ static void scan_work_array( if (n>0) { #if 0 log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "send_work: user %d already has %d result(s) for WU %d\n", reply.user.id, n, wu_result.workunit.id ); @@ -490,14 +491,14 @@ static void scan_work_array( // retval = result.lookup_id(result.id); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[RESULT#%d] result.lookup_id() failed %d\n", wu_result.result.id, retval ); goto done; } if (result.server_state != RESULT_SERVER_STATE_UNSENT) { - log_messages.printf(SchedMessages::DEBUG, + log_messages.printf(SCHED_MSG_LOG::DEBUG, "[RESULT#%d] expected to be unsent; instead, state is %d\n", wu_result.result.id, result.server_state ); @@ -523,7 +524,7 @@ static void scan_work_array( wu_seconds_filled = estimate_cpu_duration(wu, reply.host); log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[HOST#%d] Sending [RESULT#%d %s] (fills %d seconds)\n", reply.host.id, result.id, result.name, int(wu_seconds_filled) ); @@ -531,7 +532,7 @@ static void scan_work_array( retval = update_wu_transition_time(wu, result.report_deadline); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "send_work: can't update WU transition time\n" ); } @@ -542,13 +543,13 @@ static void scan_work_array( retval = insert_name_tags(result, wu); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, "send_work: can't insert name tags\n" + SCHED_MSG_LOG::CRITICAL, "send_work: can't insert name tags\n" ); } retval = insert_deadline_tag(result); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "send_work: can't insert deadline tag\n" ); } @@ -586,7 +587,7 @@ int send_work( wreq.nresults = 0; log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[HOST#%d] got request for %d seconds of work; available disk %f GB\n", reply.host.id, sreq.work_req_seconds, wreq.disk_available/1e9 ); @@ -610,7 +611,7 @@ int send_work( scan_work_array(wreq, sreq, reply, platform, ss); log_messages.printf( - SchedMessages::NORMAL, "[HOST#%d] Sent %d results\n", + SCHED_MSG_LOG::NORMAL, "[HOST#%d] Sent %d results\n", reply.host.id, wreq.nresults ); @@ -641,7 +642,7 @@ int send_work( " (your core client is out of date - please upgrade)" ); log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "Not sending work because core client is outdated\n" ); } @@ -649,7 +650,7 @@ int send_work( reply.request_delay = 10; log_messages.printf( - SchedMessages::NORMAL, "[HOST#%d] %s\n", + SCHED_MSG_LOG::NORMAL, "[HOST#%d] %s\n", reply.host.id, reply.message ); } diff --git a/sched/sched_util.C b/sched/sched_util.C index 1d3e2f3f08..a65f1223db 100644 --- a/sched/sched_util.C +++ b/sched/sched_util.C @@ -19,17 +19,12 @@ using namespace std; -#include +#include #include -#include #include -#include -#include "parse.h" -#include "util.h" -#include "main.h" +#include "sched_msgs.h" #include "sched_util.h" -#include "server_types.h" const char* STOP_TRIGGER_FILENAME = "../stop_servers"; // NOTE: this be the same name as used by the "start" script @@ -39,7 +34,7 @@ const int STOP_SIGNAL = SIGHUP; void write_pid_file(const char* filename) { FILE* fpid = fopen(filename, "w"); if (!fpid) { - log_messages.printf(SchedMessages::NORMAL, "Couldn't write pid\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Couldn't write pid\n"); return; } fprintf(fpid, "%d\n", (int)getpid()); @@ -60,12 +55,12 @@ void install_stop_signal_handler() { void check_stop_trigger() { if (caught_stop_signal) { - log_messages.printf(SchedMessages::CRITICAL, "Quitting due to SIGINT\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Quitting due to SIGINT\n"); exit(0); } FILE* f = fopen(STOP_TRIGGER_FILENAME, "r"); if (f) { - log_messages.printf(SchedMessages::NORMAL, "Quitting due to stop trigger\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Quitting due to stop trigger\n"); exit(0); } } diff --git a/sched/sched_util.h b/sched/sched_util.h index cade968dc3..9ca01ec3f5 100644 --- a/sched/sched_util.h +++ b/sched/sched_util.h @@ -20,8 +20,6 @@ #ifndef SCHED_UTIL_H #define SCHED_UTIL_H -#include "messages.h" - // "average credit" uses an exponential decay so that recent // activity is weighted more heavily. // CREDIT_HALF_LIFE is the "half-life" period: @@ -37,21 +35,4 @@ extern bool is_stopfile_present(); extern void install_stop_signal_handler(); extern bool caught_stop_signal; - -class SchedMessages : public Messages { - int debug_level; - const char* v_format_kind(int kind) const; - bool v_message_wanted(int kind) const; -public: - enum Kind { - CRITICAL, - NORMAL, - DEBUG - }; - SchedMessages(): Messages(stderr) {} - void set_debug_level(int new_level) { debug_level = new_level; } -}; -extern SchedMessages log_messages; - #endif - diff --git a/sched/server_types.C b/sched/server_types.C index a79dc70107..9840d8ea30 100644 --- a/sched/server_types.C +++ b/sched/server_types.C @@ -29,8 +29,9 @@ using namespace std; #include "error_numbers.h" #include "util.h" #include "main.h" -#include "server_types.h" #include "sched_util.h" +#include "sched_msgs.h" +#include "server_types.h" int CLIENT_APP_VERSION::parse(FILE* f) { char buf[256]; @@ -128,7 +129,7 @@ int SCHEDULER_REQUEST::parse(FILE* fin) { trickles.push_back(td); } } else { - log_messages.printf(SchedMessages::NORMAL, "SCHEDULER_REQUEST::parse(): unrecognized: %s\n", buf); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "SCHEDULER_REQUEST::parse(): unrecognized: %s\n", buf); } } return ERR_XML_PARSE; @@ -397,7 +398,7 @@ int RESULT::parse_from_client(FILE* fin) { continue; } else { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "RESULT::parse_from_client(): unrecognized: %s\n", buf ); @@ -438,7 +439,7 @@ int HOST::parse(FILE* fin) { else if (parse_double(buf, "", n_bwup)) continue; else if (parse_double(buf, "", n_bwdown)) continue; else { - log_messages.printf(SchedMessages::NORMAL, "HOST::parse(): unrecognized: %s\n", buf); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "HOST::parse(): unrecognized: %s\n", buf); } } return ERR_XML_PARSE; @@ -455,7 +456,7 @@ int HOST::parse_time_stats(FILE* fin) { else if (parse_double(buf, "", active_frac)) continue; else { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "HOST::parse_time_stats(): unrecognized: %s\n", buf ); @@ -473,7 +474,7 @@ int HOST::parse_net_stats(FILE* fin) { else if (parse_double(buf, "", n_bwdown)) continue; else { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "HOST::parse_net_stats(): unrecognized: %s\n", buf ); diff --git a/sched/start_servers.C b/sched/start_servers.C index 6e548ff4b4..8ec95c689e 100644 --- a/sched/start_servers.C +++ b/sched/start_servers.C @@ -31,23 +31,23 @@ int main() { char* p; log_messages.set_debug_level(3); - log_messages.printf(SchedMessages::NORMAL, "Starting servers.\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Starting servers.\n"); ++log_messages; retval = config.parse_file(); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "Can't read config\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't read config\n"); exit(1); } for (i=0; i<20; i++) { p = config.start_commands[i]; if (!p) break; - log_messages.printf(SchedMessages::NORMAL, "Executing: %s\n", p); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Executing: %s\n", p); system(p); } --log_messages; - log_messages.printf(SchedMessages::NORMAL, "Done.\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Done.\n"); return 0; } diff --git a/sched/transitioner.C b/sched/transitioner.C index afb7c7ec1f..99496423d8 100644 --- a/sched/transitioner.C +++ b/sched/transitioner.C @@ -39,6 +39,7 @@ using namespace std; #include "backend_lib.h" #include "sched_config.h" #include "sched_util.h" +#include "sched_msgs.h" #define LOCKFILE "transitioner.out" #define PIDFILE "transitioner.pid" @@ -67,7 +68,7 @@ void handle_wu(DB_WORKUNIT& wu) { } } - ScopeMessages scope_messages(log_messages, SchedMessages::NORMAL); + SCOPE_MSG_LOG scope_messages(log_messages, SCHED_MSG_LOG::NORMAL); // count up the number of results in various states, // and check for timed-out results @@ -89,7 +90,7 @@ void handle_wu(DB_WORKUNIT& wu) { case RESULT_SERVER_STATE_IN_PROGRESS: if (result.report_deadline < now) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[WU#%d %s] [RESULT#%d %s] result timed out (%d < %d) server_state:IN_PROGRESS=>OVER; outcome:NO_REPLY\n", wu.id, wu.name, result.id, result.name, result.report_deadline, (int)now @@ -99,7 +100,7 @@ void handle_wu(DB_WORKUNIT& wu) { retval = result.update(); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[WU#%d %s] [RESULT#%d %s] result.update() == %d\n", wu.id, wu.name, result.id, result.name, retval ); @@ -114,7 +115,7 @@ void handle_wu(DB_WORKUNIT& wu) { switch (result.outcome) { case RESULT_OUTCOME_COULDNT_SEND: log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[WU#%d %s] [RESULT#%d %s] result couldn't be sent\n", wu.id, wu.name, result.id, result.name ); @@ -135,7 +136,7 @@ void handle_wu(DB_WORKUNIT& wu) { } log_messages.printf( - SchedMessages::DEBUG, + SCHED_MSG_LOG::DEBUG, "[WU#%d %s] %d results: unsent %d, in_progress %d, over %d (success %d, error %d, couldnt_send %d)\n", wu.id, wu.name, (int)results.size(), @@ -148,7 +149,7 @@ void handle_wu(DB_WORKUNIT& wu) { if (nsuccess >= wu.min_quorum && have_result_to_validate) { wu.need_validate = true; log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[WU#%d %s] need_validate:=>true [nsuccess=%d >= min_quorum=%d]\n", wu.id, wu.name, nsuccess, wu.min_quorum ); @@ -163,7 +164,7 @@ void handle_wu(DB_WORKUNIT& wu) { if (nerrors > wu.max_error_results) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[WU#%d %s] WU has too many errors (%d errors for %d results)\n", wu.id, wu.name, nerrors, (int)results.size() ); @@ -171,7 +172,7 @@ void handle_wu(DB_WORKUNIT& wu) { } if ((int)results.size() > wu.max_total_results) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[WU#%d %s] WU has too many total results (%d)\n", wu.id, wu.name, (int)results.size() ); @@ -187,7 +188,7 @@ void handle_wu(DB_WORKUNIT& wu) { bool update_result = false; if (result.server_state == RESULT_SERVER_STATE_UNSENT) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[WU#%d %s] [RESULT#%d %s] server_state:UNSENT=>OVER; outcome:=>DIDNT_NEED\n", wu.id, wu.name, result.id, result.name ); @@ -203,7 +204,7 @@ void handle_wu(DB_WORKUNIT& wu) { retval = result.update(); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[WU#%d %s] [RESULT#%d %s] result.update() == %d\n", wu.id, wu.name, result.id, result.name, retval ); @@ -213,7 +214,7 @@ void handle_wu(DB_WORKUNIT& wu) { if (wu.assimilate_state == ASSIMILATE_INIT) { wu.assimilate_state = ASSIMILATE_READY; log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[WU#%d %s] error_mask:%d assimilate_state:INIT=>READY\n", wu.id, wu.name, wu.error_mask ); @@ -224,7 +225,7 @@ void handle_wu(DB_WORKUNIT& wu) { int n = wu.target_nresults - nunsent - ninprogress - nsuccess; if (n > 0) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[WU#%d %s] Generating %d more results (%d target - %d unsent - %d in progress - %d success)\n", wu.id, wu.name, n, wu.target_nresults, nunsent, ninprogress, nsuccess ); @@ -234,7 +235,7 @@ void handle_wu(DB_WORKUNIT& wu) { retval = create_result(wu, result_template, suffix, key, ""); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[WU#%d %s] create_result() %d\n", wu.id, wu.name, retval ); @@ -258,7 +259,7 @@ void handle_wu(DB_WORKUNIT& wu) { } if (wu.canonical_resultid && p_canonical_result == 0) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[WU#%d %s] can't find canonical result\n", wu.id, wu.name ); @@ -272,7 +273,7 @@ void handle_wu(DB_WORKUNIT& wu) { if (all_over && wu.file_delete_state == FILE_DELETE_INIT) { wu.file_delete_state = FILE_DELETE_READY; log_messages.printf( - SchedMessages::DEBUG, + SCHED_MSG_LOG::DEBUG, "[WU#%d %s] ASSIMILATE_DONE: file_delete_state:=>READY\n", wu.id, wu.name ); @@ -300,7 +301,7 @@ void handle_wu(DB_WORKUNIT& wu) { } if (do_delete && result.file_delete_state == FILE_DELETE_INIT) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[WU#%d %s] [RESULT#%d %s] file_delete_state:=>READY\n", wu.id, wu.name, result.id, result.name ); @@ -308,7 +309,7 @@ void handle_wu(DB_WORKUNIT& wu) { retval = result.update(); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[WU#%d %s] [RESULT#%d %s] result.update() == %d\n", wu.id, wu.name, result.id, result.name, retval ); @@ -330,7 +331,7 @@ void handle_wu(DB_WORKUNIT& wu) { retval = wu.update(); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[WU#%d %s] workunit.update() == %d\n", wu.id, wu.name, retval ); } @@ -358,7 +359,7 @@ void main_loop(bool one_pass) { retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "boinc_db.open: %d\n", retval); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "boinc_db.open: %d\n", retval); exit(1); } @@ -390,14 +391,14 @@ int main(int argc, char** argv) { retval = config.parse_file(".."); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't read config file\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't read config file\n"); exit(1); } sprintf(path, "%s/upload_private", config.key_dir); retval = read_key_file(path, key); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't read key\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't read key\n"); exit(1); } @@ -409,11 +410,11 @@ int main(int argc, char** argv) { // // Call lock_file after fork(), because file locks are not always inherited // if (lock_file(LOCKFILE)) { - // log_messages.printf(SchedMessages::NORMAL, "Another copy of transitioner is already running\n"); + // log_messages.printf(SCHED_MSG_LOG::NORMAL, "Another copy of transitioner is already running\n"); // exit(1); // } // write_pid_file(PIDFILE); - log_messages.printf(SchedMessages::NORMAL, "Starting\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Starting\n"); install_stop_signal_handler(); diff --git a/sched/trickle_handler.C b/sched/trickle_handler.C index 59182c4b7e..36590c5bfe 100644 --- a/sched/trickle_handler.C +++ b/sched/trickle_handler.C @@ -39,6 +39,7 @@ using namespace std; #include "util.h" #include "sched_config.h" #include "sched_util.h" +#include "sched_msgs.h" SCHED_CONFIG config; char app_name[256]; @@ -73,14 +74,14 @@ int main_loop(bool one_pass) { retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "boinc_db.open failed: %d\n", retval); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "boinc_db.open failed: %d\n", retval); exit(1); } sprintf(buf, "where name='%s'", app_name); retval = app.lookup(buf); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't find app %s\n", app.name); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't find app %s\n", app.name); exit(1); } @@ -112,13 +113,13 @@ int main(int argc, char** argv) { } else if (!strcmp(argv[i], "-d")) { log_messages.set_debug_level(atoi(argv[++i])); } else { - log_messages.printf(SchedMessages::CRITICAL, "unrecognized arg: %s\n", argv[i]); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "unrecognized arg: %s\n", argv[i]); } } retval = config.parse_file(".."); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't parse config file: %d\n", retval ); exit(1); @@ -130,7 +131,7 @@ int main(int argc, char** argv) { } } - log_messages.printf(SchedMessages::NORMAL, "Starting trickle handler\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Starting trickle handler\n"); install_stop_signal_handler(); diff --git a/sched/update_stats.C b/sched/update_stats.C index 068b616802..9bdc24f034 100644 --- a/sched/update_stats.C +++ b/sched/update_stats.C @@ -36,6 +36,7 @@ #include "util.h" #include "sched_config.h" #include "sched_util.h" +#include "sched_msgs.h" #define LOCKFILE "update_stats.out" #define PIDFILE "update_stats.pid" @@ -53,7 +54,7 @@ int update_users() { update_average(0, 0, CREDIT_HALF_LIFE, user.expavg_credit, user.expavg_time); retval = user.update(); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "Can't update user %d\n", user.id); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't update user %d\n", user.id); return retval; } } @@ -70,7 +71,7 @@ int update_hosts() { update_average(0, 0, CREDIT_HALF_LIFE, host.expavg_credit, host.expavg_time); retval = host.update(); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "Can't update host %d\n", host.id); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't update host %d\n", host.id); return retval; } } @@ -107,7 +108,7 @@ int update_teams() { retval = get_team_totals(team); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "update_teams: get_team_credit([TEAM#%d]) failed: %d\n", team.id, retval @@ -119,7 +120,7 @@ int update_teams() { } retval = team.update(); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "Can't update team %d\n", team.id); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't update team %d\n", team.id); return retval; } } @@ -148,7 +149,7 @@ int main(int argc, char** argv) { } else if (!strcmp(argv[i], "-asynch")) { asynch = true; } else { - log_messages.printf(SchedMessages::CRITICAL, "Unrecognized arg: %s\n", argv[i]); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Unrecognized arg: %s\n", argv[i]); } } @@ -160,28 +161,28 @@ int main(int argc, char** argv) { // // Call lock_file after fork(), because file locks are not always inherited // if (lock_file(LOCKFILE)) { - // log_messages.printf(SchedMessages::NORMAL, "Another copy of update_stats is already running\n"); + // log_messages.printf(SCHED_MSG_LOG::NORMAL, "Another copy of update_stats is already running\n"); // exit(1); // } // write_pid_file(PIDFILE); - log_messages.printf(SchedMessages::NORMAL, "Starting\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Starting\n"); retval = config.parse_file(".."); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "Can't parse config file\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't parse config file\n"); exit(1); } retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "Can't open DB\n"); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't open DB\n"); exit(1); } if (do_update_users) { retval = update_users(); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "update_users failed: %d\n", retval); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "update_users failed: %d\n", retval); exit(1); } } @@ -189,7 +190,7 @@ int main(int argc, char** argv) { if (do_update_hosts) { retval = update_hosts(); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "update_hosts failed: %d\n", retval); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "update_hosts failed: %d\n", retval); exit(1); } } @@ -197,7 +198,7 @@ int main(int argc, char** argv) { if (do_update_teams) { retval = update_teams(); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "update_teams failed: %d\n", retval); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "update_teams failed: %d\n", retval); exit(1); } } diff --git a/sched/validate.C b/sched/validate.C index dc39d9e5ef..d027e4737a 100644 --- a/sched/validate.C +++ b/sched/validate.C @@ -49,6 +49,7 @@ using namespace std; #include "util.h" #include "sched_config.h" #include "sched_util.h" +#include "sched_msgs.h" #define LOCKFILE "validate.out" #define PIDFILE "validate.pid" @@ -105,7 +106,7 @@ void handle_wu(DB_WORKUNIT& wu) { if (wu.canonical_resultid) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[WU#%d %s] handle_wu(): Already has canonical result\n", wu.id, wu.name ); @@ -117,7 +118,7 @@ void handle_wu(DB_WORKUNIT& wu) { retval = canonical_result.lookup_id(wu.canonical_resultid); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[WU#%d %s] Can't read canonical result; marking as validated: %d\n", wu.id, wu.name, retval ); @@ -139,7 +140,7 @@ void handle_wu(DB_WORKUNIT& wu) { // if (canonical_result.file_delete_state == FILE_DELETE_DONE) { log_messages.printf( - SchedMessages::DEBUG, + SCHED_MSG_LOG::DEBUG, "[WU#%d]: Canonical result (%d) has been deleted\n", wu.id, canonical_result.id ); @@ -150,7 +151,7 @@ void handle_wu(DB_WORKUNIT& wu) { } if (retval) { log_messages.printf( - SchedMessages::DEBUG, + SCHED_MSG_LOG::DEBUG, "[RESULT#%d %s]: pair_check() failed for result: %d\n", result.id, result.name, retval ); @@ -160,14 +161,14 @@ void handle_wu(DB_WORKUNIT& wu) { result.validate_state = VALIDATE_STATE_VALID; result.granted_credit = wu.canonical_credit; log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[RESULT#%d %s] pair_check() matched: setting result to valid; credit %f\n", result.id, result.name, result.granted_credit ); } else { result.validate_state = VALIDATE_STATE_INVALID; log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[RESULT#%d %s] pair_check() didn't match: setting result to invalid\n", result.id, result.name ); @@ -176,7 +177,7 @@ void handle_wu(DB_WORKUNIT& wu) { retval = result.update(); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[RESULT#%d %s] Can't update result: %d\n", result.id, result.name, retval ); @@ -185,7 +186,7 @@ void handle_wu(DB_WORKUNIT& wu) { retval = grant_credit(result, result.granted_credit); if (retval) { log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[RESULT#%d %s] Can't grant credit: %d\n", result.id, result.name, retval ); @@ -199,7 +200,7 @@ void handle_wu(DB_WORKUNIT& wu) { // Try to get one log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[WU#%d %s] handle_wu(): No canonical result yet\n", wu.id, wu.name ); ++log_messages; @@ -219,19 +220,19 @@ void handle_wu(DB_WORKUNIT& wu) { results.push_back(result); } log_messages.printf( - SchedMessages::DEBUG, "[WU#%d %s] Found %d successful results\n", + SCHED_MSG_LOG::DEBUG, "[WU#%d %s] Found %d successful results\n", wu.id, wu.name, (int)results.size() ); if (results.size() >= (unsigned int)wu.min_quorum) { log_messages.printf( - SchedMessages::DEBUG, + SCHED_MSG_LOG::DEBUG, "[WU#%d %s] Enough for quorum, checking set.\n", wu.id, wu.name ); retval = check_set(results, canonicalid, credit); if (!retval && canonicalid) { need_transition = true; log_messages.printf( - SchedMessages::DEBUG, + SCHED_MSG_LOG::DEBUG, "[WU#%d %s] Found a canonical result: id=%d\n", wu.id, wu.name, canonicalid ); @@ -249,14 +250,14 @@ void handle_wu(DB_WORKUNIT& wu) { retval = grant_credit(result, credit); if (retval) { log_messages.printf( - SchedMessages::DEBUG, + SCHED_MSG_LOG::DEBUG, "[RESULT#%d %s] grant_credit() failed: %d\n", result.id, result.name, retval ); } result.granted_credit = credit; log_messages.printf( - SchedMessages::NORMAL, + SCHED_MSG_LOG::NORMAL, "[RESULT#%d %s] Granted %f credit to valid result [HOST#%d]\n", result.id, result.name, result.granted_credit, result.hostid ); @@ -266,7 +267,7 @@ void handle_wu(DB_WORKUNIT& wu) { retval = result.update(); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[RESULT#%d %s] result.update() failed: %d\n", result.id, result.name, retval ); @@ -284,7 +285,7 @@ void handle_wu(DB_WORKUNIT& wu) { retval = result.update(); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[RESULT#%d %s] result.update() failed: %d\n", result.id, result.name, retval ); @@ -315,7 +316,7 @@ mark_validated: retval = wu.update(); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[WU#%d %s] wu.update() failed: %d\n", wu.id, wu.name, retval ); } @@ -345,14 +346,14 @@ int main_loop(bool one_pass) { retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "boinc_db.open failed: %d\n", retval); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "boinc_db.open failed: %d\n", retval); exit(1); } sprintf(buf, "where name='%s'", app_name); retval = app.lookup(buf); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, "can't find app %s\n", app.name); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't find app %s\n", app.name); exit(1); } @@ -384,13 +385,13 @@ int main(int argc, char** argv) { } else if (!strcmp(argv[i], "-d")) { log_messages.set_debug_level(atoi(argv[++i])); } else { - log_messages.printf(SchedMessages::CRITICAL, "unrecognized arg: %s\n", argv[i]); + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "unrecognized arg: %s\n", argv[i]); } } retval = config.parse_file(".."); if (retval) { - log_messages.printf(SchedMessages::CRITICAL, + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't parse config file: %d\n", retval ); exit(1); @@ -404,11 +405,11 @@ int main(int argc, char** argv) { // // Call lock_file after fork(), because file locks are not always inherited // if (lock_file(LOCKFILE)) { - // log_messages.printf(SchedMessages::NORMAL, "Another copy of validate is already running\n"); + // log_messages.printf(SCHED_MSG_LOG::NORMAL, "Another copy of validate is already running\n"); // exit(1); // } // write_pid_file(PIDFILE); - log_messages.printf(SchedMessages::NORMAL, "Starting validator\n"); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "Starting validator\n"); install_stop_signal_handler(); diff --git a/sched/validate_test.C b/sched/validate_test.C index 090432bad5..a5ef4d245d 100644 --- a/sched/validate_test.C +++ b/sched/validate_test.C @@ -19,6 +19,7 @@ #include "util.h" #include "sched_util.h" +#include "sched_msgs.h" #include "validate_util.h" // TODO: use md5 hash @@ -32,7 +33,7 @@ int init_result_read_file(RESULT const& result, void*& data) { retval = get_output_file_path(result, path); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[RESULT#%d %s] check_set: can't get output filename\n", result.id, result.name ); @@ -45,7 +46,7 @@ int init_result_read_file(RESULT const& result, void*& data) { retval = read_file_string(path.c_str(), *s); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[RESULT#%d %s] Couldn't open %s\n", result.id, result.name, path.c_str() ); diff --git a/sched/validate_util.C b/sched/validate_util.C index b6b05e1235..dd3d1a0254 100644 --- a/sched/validate_util.C +++ b/sched/validate_util.C @@ -24,10 +24,12 @@ #include -#include "sched_util.h" -#include "sched_config.h" #include "error_numbers.h" #include "parse.h" + +#include "sched_util.h" +#include "sched_config.h" +#include "sched_msgs.h" #include "validate_util.h" extern SCHED_CONFIG config; @@ -133,7 +135,7 @@ int generic_check_set_majority( for (i = 0; i != n; ++i) { if (init_result_f(results[i], data[i])) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "check_set_majority: init_result([RESULT#%d %s]) failed\n", results[i].id, results[i].name); goto cleanup; @@ -152,7 +154,7 @@ int generic_check_set_majority( matches[j] = true; } else if (check_pair_with_data_f(results[i], data[i], results[j], data[j], match)) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "check_set_majority: check_pair_with_data([RESULT#%d %s], [RESULT#%d %s]) failed\n", results[i].id, results[i].name, results[j].id, results[j].name); } else if (match) { @@ -192,7 +194,7 @@ int generic_check_pair( retval = init_result_f(r1, data1); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[RESULT#%d %s] [RESULT#%d %s] Couldn't initialize result 1\n", r1.id, r1.name, r2.id, r2.name ); @@ -202,7 +204,7 @@ int generic_check_pair( retval = init_result_f(r2, data2); if (retval) { log_messages.printf( - SchedMessages::CRITICAL, + SCHED_MSG_LOG::CRITICAL, "[RESULT#%d %s] [RESULT#%d %s] Couldn't initialize result 2\n", r1.id, r1.name, r2.id, r2.name );