From: Kern Sibbald Date: Fri, 7 Nov 2008 10:32:43 +0000 (+0000) Subject: Apply win32-fixes patch from Riccardo that makes the Win32 X-Git-Tag: Release-7.0.0~3772 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fc42c84d26114e3b5a398f799d20fe0509d13d93;p=bacula%2Fbacula Apply win32-fixes patch from Riccardo that makes the Win32 bat more stable and faster (but still slow). git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8003 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/autoconf/who_and_what_of_libtool_patch b/bacula/autoconf/who_and_what_of_libtool_patch new file mode 100644 index 0000000000..3156f5990e --- /dev/null +++ b/bacula/autoconf/who_and_what_of_libtool_patch @@ -0,0 +1,183 @@ +Small walk trough of libtool patch (what in there ...) + +- Toplevel Makefile.in + - Added depend definition for LIBTOOL + - Rewrote some of the autoconf targets for the new name and always remove the cache autoconf makes + - Updated some install targets to use the RMF macro (minor cleanup) + - Remove libtool (which is autogenerated by configure) on make distclean + +- autoconf/Make.common.in + - Added libdir and includedir + - Changed RM and RMF macros (See configure.in warning why its named @REMOVE@ now) + - Small update in INSTALL_ macros to use the INSTALL_PROGRAM macro better and not have configure + replace all the instances. + - Added the LIBTOOL macros which are used when building with libtool (the DEFAULT_* macros + are a workaround for easily disabling libtool and build in the old fashion way but still use + the same Makefile.in everywhere. + +- autoconf/aclocal.m4 + - Added libtool m4 files to be included + +- autoconf/bacula-macros/db.m4 + - Updated all help strings to use the Autoconf AC_HELP_STRING function which formats help strings + better so we never have to change those in the future (e.g. relayout ever again even when changing the content) + +- autoconf/config.h.in + - updated by configure run with libtool updates + +- autoconf/config.on.save + - removed redundant file (because things are in SVN don't see why you want this) + +- autoconf/configure.in + - This is a complete overhaul of the original file I reindented most stuff + (killed all tabs ...) I think its better readable now and when changing it I think + I also got some small bugs fixed. Also updated all comments to use dnl and not + sometimes # and then dnl as comment. As we probably never gonna read the resulting + configure script generated by autoconf anyhow I think using this style in configure.in is + more consistent. + - also added all libtool specific coding which gives us the --disable-libtool option + which makes sure we can build everything using the old tools too. The LT_INIT is not in + the if statement because it breaks the generated configure. So we always test for libtool + but you can overwrite it usage by using the --disable-libtool option. + +- autoconf/gettext-macros/gettext.m4 + - updated to use AC_HELP_STRING function + +- autoconf/libtool/libtool.m4 +- autoconf/libtool/ltoptions.m4 +- autoconf/libtool/ltsugar.m4 +- autoconf/libtool/ltversion.m4 +- autoconf/libtool/lt~obsolete.m4 +- autoconf/libtool/ltmain.sh + - Files from libtool 2.2.6 install which are needed to build libtool support in package + +- configure + - Regenerated file from autoconf 2.63 run on new configure.in + +- src/Makefile.in + - removed stray empty line + +- src/cats/Makefile.in + - added support for libtool + - use dynamic generation of names of object files + - add version for shared lib + - new inference rule for .c.lo + - changed lib name from libsql to libbacsql (to make it linked to the Bacula project) + - extra target to create libtool .la (libtool archive) + - extra libtool-clean target only called when libtool is used + - libtool-install and libtool-uninstall target only called when libtool is used + - install include files when using libtool + +- src/console/Makefile.in + - added support for libtool + - updated to use libtool when defined and have depend on correct archive type + - extra libtool-clean target only called when libtool is used + +- src/dird/Makefile.in + - use dynamic generation of names of object files + - added support for libtool + - updated to use libtool when defined and have depend on correct archive type + - extra libtool-clean target only called when libtool is used + +- src/dird/dird.c + - update for python interface change (because of full prototypes we wrap things in #ifdef HAVE_PYTHON) + +- src/dird/pythondir.c + - update for python interface change (some prototypes are moved to pythonlib.h) + +- src/dird/ua_cmds.c + - update for python interface change (because of full prototypes we wrap things in #ifdef HAVE_PYTHON) + +- src/filed/Makefile.in + - use dynamic generation of names of object files + - added support for libtool + - updated to use libtool when defined and have depend on correct archive type + - extra libtool-clean target only called when libtool is used + +- src/filed/filed.c + - update for python interface change (because of full prototypes we wrap things in #ifdef HAVE_PYTHON) + +- src/filed/pythonfd.c + - update for python interface change (some prototypes are moved to pythonlib.h) + +- src/findlib/Makefile.in + - added support for libtool + - use dynamic generation of names of object files + - add version for shared lib + - new inference rule for .c.lo + - changed lib name from libfind to libbacfind (to make it linked to the Bacula project) + - extra target to create libtool .la (libtool archive) + - extra libtool-clean target only called when libtool is used + - libtool-install and libtool-uninstall target only called when libtool is used + - install include files when using libtool + +- src/gnome2-console/Makefile.in + - added support for libtool + +- src/lib/Makefile.in + - added support for libtool + - use dynamic generation of names of object files + - splitted objects into 3 libs (because of symbol reference problems otherwise) + - kept all in the same dir to not interfere with win32 build etc. (first moved it to configlib and pythonlib + but that would break non libtool/unix builds. + - add version for shared libs + - new inference rule for .c.lo and .cc.lo + - extra target to create libtool .la (libtool archive) + - extra libtool-clean target only called when libtool is used + - libtool-install and libtool-uninstall target only called when libtool is used + - install include files when using libtool + - need to see if we need all those include files (already removed tcpd.h) + +- src/lib/protos.h + - update for python interface change (some prototypes are moved to pythonlib.h) + +- src/lib/pythonlib.c + - update for python interface change (some prototypes are moved to pythonlib.h) + - extern references to global vars/functions not needed anymore + +- src/lib/pythonlib.h + - new file for python interface change (some prototypes are moved here) + +- src/plugins/fd/Makefile.in + - added support for libtool + - new inference rule for .c.lo and .cc.lo + - kept old rule but that doesn't get called for libtool builds + - install rule extended to remove .la file which gets installed by the libtool --mode=install (Apache does same for DSO) + +- src/qt-console/bat.pro.in + - added support for libtool + +- src/stored/Makefile.in + - removed pythond.o from BEXTOBJS unneeded + - added support for libtool + - updated to use libtool when defined and have depend on correct archive type + - extra libtool-clean target only called when libtool is used + +- src/stored/pythonsd.c + - update for python interface change (some prototypes are moved to pythonlib.h) + +- src/stored/stored.c + - update for python interface change (because of full prototypes we wrap things in #ifdef HAVE_PYTHON) + +- src/tools/Makefile.in + - added support for libtool + - updated to use libtool when defined and have depend on correct archive type + - extra libtool-clean target only called when libtool is used + +- src/tray-monitor/Makefile.in + - added support for libtool + - updated to use libtool when defined and have depend on correct archive type + - extra libtool-clean target only called when libtool is used + +- src/wx-console/Makefile.in + - added support for libtool + - updated to use libtool when defined and have depend on correct archive type + - extra libtool-clean target only called when libtool is used + +Todo: + +- check if install of libs and includes also goes nicely when you don't do things like --prefix=/opt/ELMbacula + e.g. where does the stuff then gets installed. +- do a full regression test on the new stuff build with libtool +- see how it works on a real install (currently running 72 hours with shared libs on Solaris 10 64 bits) + diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index ce849c8074..2bad20da40 100644 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -1012,8 +1012,13 @@ void _print_jcr_dbg(FILE *fp) fprintf(fp, "JCR=%p JobId=%i name=%s JobStatus=%c\n", jcr, jcr->JobId, jcr->Job, jcr->JobStatus); +#ifdef HAVE_WIN32 + fprintf(fp, "\tuse_count=%i\n", + jcr->use_count()); +#else fprintf(fp, "\tuse_count=%i threadid=0x%x\n", jcr->use_count(), (int)jcr->my_thread_id); +#endif fprintf(fp, "\tJobType=%c JobLevel=%c\n", jcr->get_JobType(), jcr->get_JobLevel()); bstrftime(buf1, sizeof(buf1), jcr->sched_time); diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index d437f42ab4..97d4adf118 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -43,7 +43,10 @@ static int tls_pem_callback(char *buf, int size, const void *userdata); -Console::Console(QStackedWidget *parent) +Console::Console(QStackedWidget *parent): +m_notifier(NULL), +m_api_set(false), +m_messages_pending(false) { QFont font; m_parent = parent; @@ -230,11 +233,14 @@ void Console::connect_dir() mainWin->set_status(_("Initializing ...")); +#ifndef HAVE_WIN32 /* Set up input notifier */ m_notifier = new QSocketNotifier(m_sock->m_fd, QSocketNotifier::Read, 0); QObject::connect(m_notifier, SIGNAL(activated(int)), this, SLOT(read_dir(int))); +#endif write(".api 1"); + m_api_set = true; displayToPrompt(); beginNewCommand(); @@ -619,14 +625,9 @@ int Console::sock_read() { int stat; #ifdef HAVE_WIN32 - bool isEnabled = m_notifier->isEnabled(); - if (isEnabled) { - m_notifier->setEnabled(false); - } + bool wasEnabled = notify(false); stat = m_sock->recv(); - if (isEnabled) { - m_notifier->setEnabled(true); - } + notify(wasEnabled); #else stat = m_sock->recv(); #endif @@ -646,7 +647,7 @@ int Console::read() break; } app->processEvents(); - if (m_api_set && m_messages_pending && m_notifier->isEnabled()) { + if (m_api_set && m_messages_pending && is_notify_enabled()) { write_dir(".messages"); m_messages_pending = false; } @@ -663,7 +664,7 @@ int Console::read() } switch (m_sock->msglen) { case BNET_MSGS_PENDING : - if (m_notifier->isEnabled()) { + if (is_notify_enabled()) { if (mainWin->m_commDebug) Pmsg0(000, "MSGS PENDING\n"); write_dir(".messages"); displayToPrompt(); @@ -758,9 +759,11 @@ int Console::read() QBrush redBrush(Qt::red); QTreeWidgetItem *item = mainWin->getFromHash(this); item->setForeground(0, redBrush); - m_notifier->setEnabled(false); - delete m_notifier; - m_notifier = NULL; + if (m_notifier) { + m_notifier->setEnabled(false); + delete m_notifier; + m_notifier = NULL; + } mainWin->set_status(_("Director disconnected.")); QApplication::restoreOverrideCursor(); stat = BNET_HARDEOF; @@ -789,9 +792,22 @@ void Console::read_dir(int /* fd */) * from the Directory, so we set notify to off. * m_console->notifiy(false); */ -void Console::notify(bool enable) +bool Console::notify(bool enable) { - m_notifier->setEnabled(enable); + bool prev_enabled = false; + if (m_notifier) { + prev_enabled = m_notifier->isEnabled(); + m_notifier->setEnabled(enable); + } + return prev_enabled; +} + +bool Console::is_notify_enabled() const +{ + bool enabled = false; + if (m_notifier) + enabled = m_notifier->isEnabled(); + return enabled; } void Console::setDirectorTreeItem(QTreeWidgetItem *item) diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index 18fcb1cd76..44e577c927 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -91,7 +91,8 @@ public: void writeSettings(); void readSettings(); char *msg(); - void notify(bool enable); + bool notify(bool enable); // enables/disables socket notification - returns the previous state + bool is_notify_enabled() const; QStringList get_list(char *cmd); bool get_job_defaults(struct job_defaults &); void terminate(); diff --git a/bacula/src/qt-console/jobs/jobs.cpp b/bacula/src/qt-console/jobs/jobs.cpp index 777a6f459e..e7a30f908b 100644 --- a/bacula/src/qt-console/jobs/jobs.cpp +++ b/bacula/src/qt-console/jobs/jobs.cpp @@ -145,7 +145,7 @@ void Jobs::PgSeltreeWidgetClicked() void Jobs::tableItemChanged(QTableWidgetItem *currentwidgetitem, QTableWidgetItem *previouswidgetitem ) { /* m_checkcurwidget checks to see if this is during a refresh, which will segfault */ - if (m_checkcurwidget) { + if (m_checkcurwidget && currentwidgetitem) { /* The Previous item */ if (previouswidgetitem) { /* avoid a segfault if first time */ foreach(QAction* jobAction, tableWidget->actions()) { diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index 90a6acdb79..bf891fa4c1 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -421,12 +421,14 @@ void MediaList::volumeFromPool() */ void MediaList::writeExpandedSettings() { - QSettings settings(m_console->m_dir->name(), "bat"); - settings.beginGroup("MediaListTreeExpanded"); - int childcount = m_topItem->childCount(); - for (int cnt=0; cntchild(cnt); - settings.setValue(poolitem->text(0), poolitem->isExpanded()); + if (m_topItem) { + QSettings settings(m_console->m_dir->name(), "bat"); + settings.beginGroup("MediaListTreeExpanded"); + int childcount = m_topItem->childCount(); + for (int cnt=0; cntchild(cnt); + settings.setValue(poolitem->text(0), poolitem->isExpanded()); + } + settings.endGroup(); } - settings.endGroup(); } diff --git a/bacula/src/qt-console/util/fmtwidgetitem.cpp b/bacula/src/qt-console/util/fmtwidgetitem.cpp index 476e931a74..cb3a1f08b2 100644 --- a/bacula/src/qt-console/util/fmtwidgetitem.cpp +++ b/bacula/src/qt-console/util/fmtwidgetitem.cpp @@ -78,6 +78,7 @@ Freeze::~Freeze() if (qw) { qw->setUpdatesEnabled(true); QApplication::restoreOverrideCursor(); + qw->update(); } } diff --git a/bacula/src/version.h b/bacula/src/version.h index b3826f0c95..fc65e80dd3 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.5.19" -#define BDATE "06 November 2008" -#define LSMDATE "06Nov08" +#define BDATE "07 November 2008" +#define LSMDATE "07Nov08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 2c8df3f552..7b8abff29a 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -10,6 +10,9 @@ filepattern (restore with regex in bsr) mixed priorities General: +07Nov08 +kes Apply win32-fixes patch from Riccardo that makes the Win32 + bat more stable and faster (but still slow). 06Nov08 kes Fix bug with job name duplication if more than 60 jobs created during a minute.