From 68e0a4d4c9b3a2bf4d850bc0c3f68583999551ad Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 2 May 2006 07:12:03 +0000 Subject: [PATCH] - Simplify Win32 Makefile - Correct count of buffers/bytes used by smartall.c - Updated compat.h after porting apcupsd to MinGW. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2992 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 3 + bacula/kes-1.39 | 6 +- bacula/src/lib/bshm.c | 39 ++-- bacula/src/lib/smartall.c | 10 +- bacula/src/lib/winapi.c | 4 + bacula/src/version.h | 4 +- bacula/src/win32/Makefile.in | 338 ++++++++++++++--------------- bacula/src/win32/compat/compat.cpp | 27 ++- bacula/src/win32/compat/compat.h | 40 +++- 9 files changed, 256 insertions(+), 215 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index 45ebb2f1a1..6d9dc679f2 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -88,6 +88,9 @@ minutes). [ possibly a Python event -- kes ] === +- Directive: at "command" +- Command: pycmd "command" generates "command" event. How to + attach to a specific job? - Integrate Christopher's St. Bernard code. - run_cmd() returns int should return JobId_t - get_next_jobid_from_list() returns int should return JobId_t diff --git a/bacula/kes-1.39 b/bacula/kes-1.39 index 49fd0bdd29..c5fda47246 100644 --- a/bacula/kes-1.39 +++ b/bacula/kes-1.39 @@ -2,7 +2,11 @@ Kern Sibbald General: -01Ma06 +02May06 +- Simplify Win32 Makefile +- Correct count of buffers/bytes used by smartall.c +- Updated compat.h after porting apcupsd to MinGW. +01May06 - Work on getting wx-console building on MinGW. wxWidgets now builds started adding Makefile ... - Moved MinGW library objects to src/win32/lib to reduce clutter. diff --git a/bacula/src/lib/bshm.c b/bacula/src/lib/bshm.c index 4ba4db1658..41f62cf4d8 100644 --- a/bacula/src/lib/bshm.c +++ b/bacula/src/lib/bshm.c @@ -18,27 +18,22 @@ * available to all the threads. * */ - /* - Copyright (C) 2000-2004 Kern Sibbald and John Walker + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ + #ifdef implemented #include "bacula.h" @@ -46,7 +41,7 @@ #if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32) #ifdef NEED_SHARED_MEMORY -#define SHM_KEY 0x0BACB01 /* key for shared memory */ +#define SHM_KEY 0x0BACB01 /* key for shared memory */ static key_t shmkey = SHM_KEY; #define MAX_TRIES 1000 @@ -66,9 +61,9 @@ void shm_create(BSHM *shm) Dmsg1(110, "shm_create size=%d\n", shm->size); for (i=0; isize, shm->perms | IPC_CREAT)) < 0) { - Emsg1(M_WARN, 0, _("shmget failure key = %x\n"), shmkey); - shmkey++; - continue; + Emsg1(M_WARN, 0, _("shmget failure key = %x\n"), shmkey); + shmkey++; + continue; } not_found = FALSE; break; @@ -78,10 +73,10 @@ void shm_create(BSHM *shm) shm->shmkey = shmkey; shm->shmid = shmid; Dmsg2(110, "shm_create return key=%x id=%d\n", shmkey, shmid); - shmkey++; /* leave set for next time */ + shmkey++; /* leave set for next time */ #else shm->shmbuf = NULL; - shm->shmkey = 0; /* reference count */ + shm->shmkey = 0; /* reference count */ #endif } @@ -108,7 +103,7 @@ void *shm_open(BSHM *shm) if (!shm->shmbuf) { shm->shmbuf = bmalloc(shm->size); } - shm->shmkey++; /* reference count */ + shm->shmkey++; /* reference count */ V(mutex); return shm->shmbuf; #endif @@ -120,12 +115,12 @@ void shm_close(BSHM *shm) #ifdef NEED_SHARED_MEMORY if (shm->size) { if (shmdt(shm->shmbuf) < 0) { - Emsg1(M_ERROR, 0, _("Error detaching shared memory: %s\n"), strerror(errno)); + Emsg1(M_ERROR, 0, _("Error detaching shared memory: %s\n"), strerror(errno)); } } #else P(mutex); - shm->shmkey--; /* reference count */ + shm->shmkey--; /* reference count */ V(mutex); #endif } @@ -136,7 +131,7 @@ void shm_destroy(BSHM *shm) #ifdef NEED_SHARED_MEMORY if (shm->size) { if (shmctl(shm->shmid, IPC_RMID, NULL) < 0) { - Emsg1(M_ERROR, 0, _("Could not destroy shared memory: %s\n"), strerror(errno)); + Emsg1(M_ERROR, 0, _("Could not destroy shared memory: %s\n"), strerror(errno)); } } #else diff --git a/bacula/src/lib/smartall.c b/bacula/src/lib/smartall.c index 7fe164f96c..5ad10e539a 100644 --- a/bacula/src/lib/smartall.c +++ b/bacula/src/lib/smartall.c @@ -188,8 +188,10 @@ void sm_free(const char *file, int line, void *fp) V(mutex); Emsg2(M_ABORT, 0, _("Buffer overrun called from %s:%d\n"), file, line); } - sm_buffers--; - sm_bytes -= head->ablen; + if (sm_buffers > 0) { + sm_buffers--; + sm_bytes -= head->ablen; + } qdchain(qp); V(mutex); @@ -283,8 +285,8 @@ void *sm_realloc(const char *fname, int lineno, void *ptr, unsigned int size) return NULL from realloc() and leave the buffer in PTR intact. */ - sm_buffers--; - sm_bytes -= head->ablen; +// sm_buffers--; +// sm_bytes -= head->ablen; if ((buf = smalloc(fname, lineno, size)) != NULL) { memcpy(buf, ptr, (int) sm_min(size, osize)); diff --git a/bacula/src/lib/winapi.c b/bacula/src/lib/winapi.c index 5f649edcc4..80fb5f7963 100644 --- a/bacula/src/lib/winapi.c +++ b/bacula/src/lib/winapi.c @@ -20,7 +20,11 @@ */ +#ifdef __APCUPSD__ +#include "apc.h" +#else #include "bacula.h" +#endif #if defined(HAVE_CYGWIN) || defined(HAVE_WIN32) diff --git a/bacula/src/version.h b/bacula/src/version.h index 5da1b34b88..d519c11b02 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "1.39.10" -#define BDATE "01 May 2006" -#define LSMDATE "01May06" +#define BDATE "02 May 2006" +#define LSMDATE "02May06" /* Debug flags */ #undef DEBUG diff --git a/bacula/src/win32/Makefile.in b/bacula/src/win32/Makefile.in index f28b908416..93a8c9c615 100644 --- a/bacula/src/win32/Makefile.in +++ b/bacula/src/win32/Makefile.in @@ -1,11 +1,12 @@ # # Makefile for win32 bacula executables # Using MinGW cross-compiler on GNU/Linux +# +# Written for Bacula by Howard Thomson, April 2006 # # Configuration -# Version for cross-tools-3.4.2 TOPDIR = @TOP_DIR@ CROSSTOOLS = $(TOPDIR)/cross-tools MINGW = $(CROSSTOOLS)/mingw32 @@ -71,6 +72,7 @@ first: all LIBDIR = ./lib OBJDIR = . + ########################################################################## # Files in src/win32/filed/ @@ -88,38 +90,38 @@ OBJS_FILED = \ $(OBJDIR)/verify.o \ $(OBJDIR)/verify_vol.o -authenticate.o: ../filed/authenticate.c - $(CXX) -c ../filed/authenticate.c -o $(OBJDIR)/authenticate.o +$(OBJDIR)/authenticate.o: ../filed/authenticate.c + $(CXX) -c $< -o $@ -backup.o: ../filed/backup.c - $(CXX) -c ../filed/backup.c -o $(OBJDIR)/backup.o +$(OBJDIR)/backup.o: ../filed/backup.c + $(CXX) -c $< -o $@ -estimate.o: ../filed/estimate.c - $(CXX) -c ../filed/estimate.c -o $(OBJDIR)/estimate.o +$(OBJDIR)/estimate.o: ../filed/estimate.c + $(CXX) -c $< -o $@ -filed.o: ../filed/filed.c - $(CXX) -c ../filed/filed.c -o $(OBJDIR)/filed.o +$(OBJDIR)/filed.o: ../filed/filed.c + $(CXX) -c $< -o $@ -filed_conf.o: ../filed/filed_conf.c - $(CXX) -c ../filed/filed_conf.c -o $(OBJDIR)/filed_conf.o +$(OBJDIR)/filed_conf.o: ../filed/filed_conf.c + $(CXX) -c $< -o $@ -heartbeat.o: ../filed/heartbeat.c - $(CXX) -c ../filed/heartbeat.c -o $(OBJDIR)/heartbeat.o +$(OBJDIR)/heartbeat.o: ../filed/heartbeat.c + $(CXX) -c $< -o $@ -job.o: ../filed/job.c - $(CXX) -c ../filed/job.c -o $(OBJDIR)/job.o +$(OBJDIR)/job.o: ../filed/job.c + $(CXX) -c $< -o $@ -restore.o: ../filed/restore.c - $(CXX) -c ../filed/restore.c -o $(OBJDIR)/restore.o +$(OBJDIR)/restore.o: ../filed/restore.c + $(CXX) -c $< -o $@ -status.o: ../filed/status.c - $(CXX) -c ../filed/status.c -o $(OBJDIR)/status.o +$(OBJDIR)/status.o: ../filed/status.c + $(CXX) -c $< -o $@ -verify.o: ../filed/verify.c - $(CXX) -c ../filed/verify.c -o $(OBJDIR)/verify.o +$(OBJDIR)/verify.o: ../filed/verify.c + $(CXX) -c $< -o $@ -verify_vol.o: ../filed/verify_vol.c - $(CXX) -c ../filed/verify_vol.c -o $(OBJDIR)/verify_vol.o +$(OBJDIR)/verify_vol.o: ../filed/verify_vol.c + $(CXX) -c $< -o $@ ###################################################################### @@ -133,23 +135,23 @@ OBJS_COMPAT = \ $(OBJDIR)/vss_xp.o \ $(OBJDIR)/vss_w2k3.o -compat.o: ./compat/compat.cpp - $(CXX) -c ./compat/compat.cpp -o $(OBJDIR)/compat.o +$(OBJDIR)/compat.o: ./compat/compat.cpp + $(CXX) -c $< -o $@ -getopt.o: ./compat/getopt.c - $(CXX) -c ./compat/getopt.c -o $(OBJDIR)/getopt.o +$(OBJDIR)/getopt.o: ./compat/getopt.c + $(CXX) -c $< -o $@ -print.o: ./compat/print.cpp - $(CXX) -c ./compat/print.cpp -o $(OBJDIR)/print.o +$(OBJDIR)/print.o: ./compat/print.cpp + $(CXX) -c $< -o $@ -vss.o: ./compat/vss.cpp - $(CXX) -c ./compat/vss.cpp -o $(OBJDIR)/vss.o +$(OBJDIR)/vss.o: ./compat/vss.cpp + $(CXX) -c $< -o $@ -vss_xp.o: ./compat/vss_XP.cpp ./compat/vss_generic.cpp - $(CXX) -c ./compat/vss_XP.cpp -o $(OBJDIR)/vss_xp.o +$(OBJDIR)/vss_xp.o: ./compat/vss_XP.cpp ./compat/vss_generic.cpp + $(CXX) -c $< -o $@ -vss_w2k3.o: ./compat/vss_W2K3.cpp ./compat/vss_generic.cpp - $(CXX) -c ./compat/vss_W2K3.cpp -o $(OBJDIR)/vss_w2k3.o +$(OBJDIR)/vss_w2k3.o: ./compat/vss_W2K3.cpp ./compat/vss_generic.cpp + $(CXX) -c $< -o $@ ###################################################################### @@ -163,28 +165,26 @@ OBJS_WIN = \ $(OBJDIR)/winmain.o \ $(OBJDIR)/winres.res -winabout.o: ../filed/win32/winabout.cpp - $(CXX) -c ../filed/win32/winabout.cpp -o $(OBJDIR)/winabout.o +$(OBJDIR)/winabout.o: ../filed/win32/winabout.cpp + $(CXX) -c $< -o $@ -winevents.o: ../filed/win32/winevents.cpp - $(CXX) -c ../filed/win32/winevents.cpp -o $(OBJDIR)/winevents.o +$(OBJDIR)/winevents.o: ../filed/win32/winevents.cpp + $(CXX) -c $< -o $@ -winmain.o: ../filed/win32/winmain.cpp - $(CXX) -c ../filed/win32/winmain.cpp -o $(OBJDIR)/winmain.o +$(OBJDIR)/winmain.o: ../filed/win32/winmain.cpp + $(CXX) -c $< -o $@ -winservice.o: ../filed/win32/winservice.cpp - $(CXX) -c ../filed/win32/winservice.cpp -o $(OBJDIR)/winservice.o +$(OBJDIR)/winservice.o: ../filed/win32/winservice.cpp + $(CXX) -c $< -o $@ -winstat.o: ../filed/win32/winstat.cpp - $(CXX) -c ../filed/win32/winstat.cpp -o $(OBJDIR)/winstat.o +$(OBJDIR)/winstat.o: ../filed/win32/winstat.cpp + $(CXX) -c $< -o $@ -wintray.o: ../filed/win32/wintray.cpp - $(CXX) -c ../filed/win32/wintray.cpp -o $(OBJDIR)/wintray.o +$(OBJDIR)/wintray.o: ../filed/win32/wintray.cpp + $(CXX) -c $< -o $@ -winres.res: ../filed/win32/winres.rc - $(WINDRES) $(INCLUDE_ICONS) -O coff ../filed/win32/winres.rc -o $(OBJDIR)/winres.res -# $(WINDRES) --help -# mingw32-nm winres.res +$(OBJDIR)/winres.res: ../filed/win32/winres.rc + $(WINDRES) $(INCLUDE_ICONS) -O coff $< -o $@ ###################################################################### @@ -201,35 +201,35 @@ OBJS_FINDLIB = \ $(OBJDIR)/match.o \ $(OBJDIR)/save-cwd.o -attribs.o: ../findlib/attribs.c - $(CXX) -c ../findlib/attribs.c -o $(OBJDIR)/attribs.o +$(OBJDIR)/attribs.o: ../findlib/attribs.c + $(CXX) -c $< -o $@ -bfile.o: ../findlib/bfile.c - $(CXX) -c ../findlib/bfile.c -o $(OBJDIR)/bfile.o +$(OBJDIR)/bfile.o: ../findlib/bfile.c + $(CXX) -c $< -o $@ -create_file.o: ../findlib/create_file.c - $(CXX) -c ../findlib/create_file.c -o $(OBJDIR)/create_file.o +$(OBJDIR)/create_file.o: ../findlib/create_file.c + $(CXX) -c $< -o $@ -enable_priv.o: ../findlib/enable_priv.c - $(CXX) -c ../findlib/enable_priv.c -o $(OBJDIR)/enable_priv.o +$(OBJDIR)/enable_priv.o: ../findlib/enable_priv.c + $(CXX) -c $< -o $@ -find.o: ../findlib/find.c - $(CXX) -c ../findlib/find.c -o $(OBJDIR)/find.o +$(OBJDIR)/find.o: ../findlib/find.c + $(CXX) -c $< -o $@ -find_one.o: ../findlib/find_one.c - $(CXX) -c ../findlib/find_one.c -o $(OBJDIR)/find_one.o +$(OBJDIR)/find_one.o: ../findlib/find_one.c + $(CXX) -c $< -o $@ -fstype.o: ../findlib/fstype.c - $(CXX) -c ../findlib/fstype.c -o $(OBJDIR)/fstype.o +$(OBJDIR)/fstype.o: ../findlib/fstype.c + $(CXX) -c $< -o $@ -makepath.o: ../findlib/makepath.c - $(CXX) -c ../findlib/makepath.c -o $(OBJDIR)/makepath.o +$(OBJDIR)/makepath.o: ../findlib/makepath.c + $(CXX) -c $< -o $@ -match.o: ../findlib/match.c - $(CXX) -c ../findlib/match.c -o $(OBJDIR)/match.o +$(OBJDIR)/match.o: ../findlib/match.c + $(CXX) -c $< -o $@ -save-cwd.o: ../findlib/save-cwd.c - $(CXX) -c ../findlib/save-cwd.c -o $(OBJDIR)/save-cwd.o +$(OBJDIR)/save-cwd.o: ../findlib/save-cwd.c + $(CXX) -c $< -o $@ ###################################################################### @@ -249,7 +249,6 @@ LIB_OBJS = \ $(LIBDIR)/bnet_server.o \ $(LIBDIR)/bpipe.o \ $(LIBDIR)/bregex.o \ - $(LIBDIR)/bshm.o \ $(LIBDIR)/bsys.o \ $(LIBDIR)/btime.o \ $(LIBDIR)/btimers.o \ @@ -291,149 +290,146 @@ LIB_OBJS = \ # Rules for generating from ../lib # -address_conf.o: ../lib/address_conf.c - $(CXX) -c ../lib/address_conf.c -o $(LIBDIR)/address_conf.o - -alist.o: ../lib/alist.c - $(CXX) -c ../lib/alist.c -o $(LIBDIR)/alist.o +$(LIBDIR)/address_conf.o: ../lib/address_conf.c + $(CXX) -c $< -o $@ -alloc.o: ../lib/alloc.c - $(CXX) -c ../lib/alloc.c -o $(LIBDIR)/alloc.o +$(LIBDIR)/alist.o: ../lib/alist.c + $(CXX) -c $< -o $@ -attr.o: ../lib/attr.c - $(CXX) -c ../lib/attr.c -o $(LIBDIR)/attr.o +$(LIBDIR)/alloc.o: ../lib/alloc.c + $(CXX) -c $< -o $@ -base64.o: ../lib/base64.c - $(CXX) -c ../lib/base64.c -o $(LIBDIR)/base64.o +$(LIBDIR)/attr.o: ../lib/attr.c + $(CXX) -c $< -o $@ -berrno.o: ../lib/berrno.c - $(CXX) -c ../lib/berrno.c -o $(LIBDIR)/berrno.o +$(LIBDIR)/base64.o: ../lib/base64.c + $(CXX) -c $< -o $@ -bget_msg.o: ../lib/bget_msg.c - $(CXX) -c ../lib/bget_msg.c -o $(LIBDIR)/bget_msg.o +$(LIBDIR)/berrno.o: ../lib/berrno.c + $(CXX) -c $< -o $@ -bnet.o: ../lib/bnet.c - $(CXX) -c ../lib/bnet.c -o $(LIBDIR)/bnet.o +$(LIBDIR)/bget_msg.o: ../lib/bget_msg.c + $(CXX) -c $< -o $@ -bnet_server.o: ../lib/bnet_server.c - $(CXX) -c ../lib/bnet_server.c -o $(LIBDIR)/bnet_server.o +$(LIBDIR)/bnet.o: ../lib/bnet.c + $(CXX) -c $< -o $@ -bpipe.o: ../lib/bpipe.c - $(CXX) -c ../lib/bpipe.c -o $(LIBDIR)/bpipe.o +$(LIBDIR)/bnet_server.o: ../lib/bnet_server.c + $(CXX) -c $< -o $@ -bregex.o: ../lib/bregex.c - $(CXX) -c ../lib/bregex.c -o $(LIBDIR)/bregex.o +$(LIBDIR)/bpipe.o: ../lib/bpipe.c + $(CXX) -c $< -o $@ -bshm.o: ../lib/bshm.c - $(CXX) -c ../lib/bshm.c -o $(LIBDIR)/bshm.o +$(LIBDIR)/bregex.o: ../lib/bregex.c + $(CXX) -c $< -o $@ -bsys.o: ../lib/bsys.c - $(CXX) -c ../lib/bsys.c -o $(LIBDIR)/bsys.o +$(LIBDIR)/bsys.o: ../lib/bsys.c + $(CXX) -c $< -o $@ -btime.o: ../lib/btime.c - $(CXX) -c ../lib/btime.c -o $(LIBDIR)/btime.o +$(LIBDIR)/btime.o: ../lib/btime.c + $(CXX) -c $< -o $@ -btimers.o: ../lib/btimers.c - $(CXX) -c ../lib/btimers.c -o $(LIBDIR)/btimers.o +$(LIBDIR)/btimers.o: ../lib/btimers.c + $(CXX) -c $< -o $@ -cram-md5.o: ../lib/cram-md5.c - $(CXX) -c ../lib/cram-md5.c -o $(LIBDIR)/cram-md5.o +$(LIBDIR)/cram-md5.oc: ../lib/cram-md5.c + $(CXX) -c $< -o $@ -crc32.o: ../lib/crc32.c - $(CXX) -c ../lib/crc32.c -o $(LIBDIR)/crc32.o +$(LIBDIR)/crc32.o: ../lib/crc32.c + $(CXX) -c $< -o $@ -crypto.o: ../lib/crypto.c - $(CXX) -c ../lib/crypto.c -o $(LIBDIR)/crypto.o +$(LIBDIR)/crypto.o: ../lib/crypto.c + $(CXX) -c $< -o $@ -daemon.o: ../lib/daemon.c - $(CXX) -c ../lib/daemon.c -o $(LIBDIR)/daemon.o +$(LIBDIR)/daemon.o: ../lib/daemon.c + $(CXX) -c $< -o $@ -dlist.o: ../lib/dlist.c - $(CXX) -c ../lib/dlist.c -o $(LIBDIR)/dlist.o +$(LIBDIR)/dlist.o: ../lib/dlist.c + $(CXX) -c $< -o $@ -edit.o: ../lib/edit.c - $(CXX) -c ../lib/edit.c -o $(LIBDIR)/edit.o +$(LIBDIR)/edit.o: ../lib/edit.c + $(CXX) -c $< -o $@ -fnmatch.o: ../lib/fnmatch.c - $(CXX) -c ../lib/fnmatch.c -o $(LIBDIR)/fnmatch.o +$(LIBDIR)/fnmatch.o: ../lib/fnmatch.c + $(CXX) -c $< -o $@ -hmac.o: ../lib/hmac.c - $(CXX) -c ../lib/hmac.c -o $(LIBDIR)/hmac.o +$(LIBDIR)/hmac.o: ../lib/hmac.c + $(CXX) -c $< -o $@ -htable.o: ../lib/htable.c - $(CXX) -c ../lib/htable.c -o $(LIBDIR)/htable.o +$(LIBDIR)/htable.o: ../lib/htable.c + $(CXX) -c $< -o $@ -idcache.o: ../lib/idcache.c - $(CXX) -c ../lib/idcache.c -o $(LIBDIR)/idcache.o +$(LIBDIR)/idcache.o: ../lib/idcache.c + $(CXX) -c $< -o $@ -jcr.o: ../lib/jcr.c - $(CXX) -c ../lib/jcr.c -o $(LIBDIR)/jcr.o +$(LIBDIR)/jcr.o: ../lib/jcr.c + $(CXX) -c $< -o $@ -lex.o: ../lib/lex.c - $(CXX) -c ../lib/lex.c -o $(LIBDIR)/lex.o +$(LIBDIR)/lex.o: ../lib/lex.c + $(CXX) -c $< -o $@ -md5.o: ../lib/md5.c - $(CXX) -c ../lib/md5.c -o $(LIBDIR)/md5.o +$(LIBDIR)/md5.o: ../lib/md5.c + $(CXX) -c $< -o $@ -mem_pool.o: ../lib/mem_pool.c - $(CXX) -c ../lib/mem_pool.c -o $(LIBDIR)/mem_pool.o +$(LIBDIR)/mem_pool.o: ../lib/mem_pool.c + $(CXX) -c $< -o $@ -message.o: ../lib/message.c - $(CXX) -c ../lib/message.c -o $(LIBDIR)/message.o +$(LIBDIR)/message.o: ../lib/message.c + $(CXX) -c $< -o $@ -parse_conf.o: ../lib/parse_conf.c - $(CXX) -c ../lib/parse_conf.c -o $(LIBDIR)/parse_conf.o +$(LIBDIR)/parse_conf.o: ../lib/parse_conf.c + $(CXX) -c $< -o $@ -pythonlib.o: ../lib/pythonlib.c - $(CXX) -c ../lib/pythonlib.c -o $(LIBDIR)/pythonlib.o +$(LIBDIR)/pythonlib.o: ../lib/pythonlib.c + $(CXX) -c $< -o $@ -queue.o: ../lib/queue.c - $(CXX) -c ../lib/queue.c -o $(LIBDIR)/queue.o +$(LIBDIR)/queue.o: ../lib/queue.c + $(CXX) -c $< -o $@ -res.o: ../lib/res.c - $(CXX) -c ../lib/res.c -o $(LIBDIR)/res.o +$(LIBDIR)/res.o: ../lib/res.c + $(CXX) -c $< -o $@ -rwlock.o: ../lib/rwlock.c - $(CXX) -c ../lib/rwlock.c -o $(LIBDIR)/rwlock.o +$(LIBDIR)/rwlock.o: ../lib/rwlock.c + $(CXX) -c $< -o $@ -scan.o: ../lib/scan.c - $(CXX) -c ../lib/scan.c -o $(LIBDIR)/scan.o +$(LIBDIR)/scan.o: ../lib/scan.c + $(CXX) -c $< -o $@ -semlock.o: ../lib/semlock.c - $(CXX) -c ../lib/semlock.c -o $(LIBDIR)/semlock.o +$(LIBDIR)/semlock.o: ../lib/semlock.c + $(CXX) -c $< -o $@ -serial.o: ../lib/serial.c - $(CXX) -c ../lib/serial.c -o $(LIBDIR)/serial.o +$(LIBDIR)/serial.o: ../lib/serial.c + $(CXX) -c $< -o $@ -sha1.o: ../lib/sha1.c - $(CXX) -c ../lib/sha1.c -o $(LIBDIR)/sha1.o +$(LIBDIR)/sha1.o: ../lib/sha1.c + $(CXX) -c $< -o $@ -signal.o: ../lib/signal.c - $(CXX) -c ../lib/signal.c -o $(LIBDIR)/signal.o +$(LIBDIR)/signal.o: ../lib/signal.c + $(CXX) -c $< -o $@ -smartall.o: ../lib/smartall.c - $(CXX) -c ../lib/smartall.c -o $(LIBDIR)/smartall.o +$(LIBDIR)/smartall.o: ../lib/smartall.c + $(CXX) -c $< -o $@ -tls.o: ../lib/tls.c - $(CXX) -c ../lib/tls.c -o $(LIBDIR)/tls.o +$(LIBDIR)/tls.o: ../lib/tls.c + $(CXX) -c $< -o $@ -tree.o: ../lib/tree.c - $(CXX) -c ../lib/tree.c -o $(LIBDIR)/tree.o +$(LIBDIR)/tree.o: ../lib/tree.c + $(CXX) -c $< -o $@ -util.o: ../lib/util.c - $(CXX) -c ../lib/util.c -o $(LIBDIR)/util.o +$(LIBDIR)/util.o: ../lib/util.c + $(CXX) -c $< -o $@ -var.o: ../lib/var.c - $(CXX) -c ../lib/var.c -o $(LIBDIR)/var.o +$(LIBDIR)/var.o: ../lib/var.c + $(CXX) -c $< -o $@ -watchdog.o: ../lib/watchdog.c - $(CXX) -c ../lib/watchdog.c -o $(LIBDIR)/watchdog.o +$(LIBDIR)/watchdog.o: ../lib/watchdog.c + $(CXX) -c $< -o $@ -winapi.o: ../lib/winapi.c - $(CXX) -c ../lib/winapi.c -o $(LIBDIR)/winapi.o +$(LIBDIR)/winapi.o: ../lib/winapi.c + $(CXX) -c $< -o $@ -workq.o: ../lib/workq.c - $(CXX) -c ../lib/workq.c -o $(LIBDIR)/workq.o +$(LIBDIR)/workq.o: ../lib/workq.c + $(CXX) -c $< -o $@ ###################################################################### @@ -480,8 +476,8 @@ main.o: ../wx-console/main.c console_thread.o: ../wx-console/console_thread.c $(CXX) -I../wx-console -c ../wx-console/console_thread.c -o $(OBJDIR)/console_thread.o -console_conf.o: ../wx-console/console_conf.c - $(CXX) -I../wx-console -c ../wx-console/console_conf.c -o $(OBJDIR)/console_conf.o +wx_console_conf.o: ../wx-console/console_conf.c + $(CXX) -I../wx-console -c ../wx-console/console_conf.c -o $(OBJDIR)/wx_console_conf.o wxbrestorepanel.o: ../wx-console/wxbrestorepanel.c $(CXX) -I../wx-console -c ../wx-console/wxbrestorepanel.c -o $(OBJDIR)/wxbrestorepanel.o diff --git a/bacula/src/win32/compat/compat.cpp b/bacula/src/win32/compat/compat.cpp index e843d79653..6a35103caf 100644 --- a/bacula/src/win32/compat/compat.cpp +++ b/bacula/src/win32/compat/compat.cpp @@ -21,13 +21,23 @@ // Created On : Sat Jan 31 15:55:00 2004 // $Id$ -#include "bacula.h" +#ifdef __APCUPSD__ + +#include "apc.h" #include "compat.h" -#define b_errno_win32 (1<<29) +#include "winapi.h" -#include "vss.h" +#else +#include "bacula.h" +#include "compat.h" +#include "jcr.h" #include "../../lib/winapi.h" +#include "vss.h" + +#endif + +#define b_errno_win32 (1<<29) /* to allow the usage of the original version in this file here */ @@ -1332,8 +1342,6 @@ public: static winver INIT; // cause constructor to be called before main() -#include "bacula.h" -#include "jcr.h" winver::winver(void) { @@ -1971,4 +1979,13 @@ dup2(int, int) #ifdef HAVE_MINGW /* syslog function, added by Nicolas Boichat */ void closelog() {} +void openlog(const char *ident, int option, int facility) {} #endif //HAVE_MINGW + +/* Temp kludges ***FIXME**** */ +#ifdef __APCUPSD__ +unsigned int alarm(unsigned int seconds) +{ + return 0; +} +#endif diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h index 54ddf1e245..fd195cfb7b 100644 --- a/bacula/src/win32/compat/compat.h +++ b/bacula/src/win32/compat/compat.h @@ -177,7 +177,9 @@ struct timezone { int strcasecmp(const char*, const char *); int gettimeofday(struct timeval *, struct timezone *); +#ifndef ETIMEDOUT #define ETIMEDOUT 55 +#endif struct stat { @@ -301,8 +303,8 @@ int __sprintf(char *str, const char *fmt, ...); struct timespec; int readdir(unsigned int fd, struct dirent *dirp, unsigned int count); int nanosleep(const struct timespec*, struct timespec *); -struct tm *localtime_r(const time_t *, struct tm *); -struct tm *gmtime_r(const time_t *, struct tm *); +//struct tm *localtime_r(const time_t *, struct tm *); +//struct tm *gmtime_r(const time_t *, struct tm *); long int random(void); void srandom(unsigned int seed); int lstat(const char *, struct stat *); @@ -312,8 +314,6 @@ int readlink(const char *, char *, int); #define _PC_PATH_MAX 1 #define _PC_NAME_MAX 2 - - int geteuid(); DIR *opendir(const char *name); @@ -330,11 +330,6 @@ struct group { struct passwd *getpwuid(uid_t); struct group *getgrgid(uid_t); -#ifndef HAVE_MINGW -#define R_OK 04 -#define W_OK 02 -#endif //HAVE_MINGW - struct sigaction { int sa_flags; void (*sa_handler)(int); @@ -346,10 +341,16 @@ struct sigaction { #define unlink win32_unlink #define chdir win32_chdir int syslog(int, const char *, const char *); +#ifndef LOG_DAEMON #define LOG_DAEMON 0 +#endif +#ifndef LOG_ERR #define LOG_ERR 0 +#endif #ifndef HAVE_MINGW +#define R_OK 04 +#define W_OK 02 int stat(const char *, struct stat *); #ifdef __cplusplus #define access _access @@ -377,15 +378,34 @@ int win32_unlink(const char *filename); char* win32_cgets (char* buffer, int len); - int WSA_Init(void); #ifdef HAVE_MINGW void closelog(); +void openlog(const char *ident, int option, int facility); #endif //HAVE_MINGW #ifndef INVALID_FILE_ATTRIBUTES #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) #endif +/* Temp kludge ***FIXME*** */ +#ifdef __APCUPSD__ +#define SIGCHLD 0 +#define SIGALRM 0 +#define SIGHUP 0 +#define SIGCHLD 0 +#define SIGPIPE 0 +unsigned int alarm(unsigned int seconds); +#define PM_FNAME 2000 +#define PM_MESSAGE 2000 +#define get_pool_memory(x) (char *)malloc(x) +#define free_pool_memory(x) free((char *)x) +#define check_pool_memory_size(x, y) x +#define ASSERT(x) +#define bstrncat astrncat +#define bstrncpy astrncpy + +#endif + #endif /* __COMPAT_H_ */ -- 2.39.5