]> git.sur5r.net Git - bacula/bacula/commitdiff
Add extern C to callback functions
authorKern Sibbald <kern@sibbald.com>
Tue, 15 Jun 2004 17:22:20 +0000 (17:22 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 15 Jun 2004 17:22:20 +0000 (17:22 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1423 91ce42f0-d328-0410-95d8-f526ca767f89

22 files changed:
bacula/autoconf/configure.in
bacula/configure
bacula/src/bacula.h
bacula/src/console/console.c
bacula/src/dird/dird.c
bacula/src/dird/jobq.c
bacula/src/dird/msgchan.c
bacula/src/dird/ua_cmds.c
bacula/src/dird/ua_server.c
bacula/src/filed/heartbeat.c
bacula/src/filed/job.c
bacula/src/findlib/match.c
bacula/src/gnome2-console/callbacks.c
bacula/src/gnome2-console/console.c
bacula/src/gnome2-console/console.h
bacula/src/lib/bnet.c
bacula/src/lib/jcr.c
bacula/src/lib/signal.c
bacula/src/lib/watchdog.c
bacula/src/lib/workq.c
bacula/src/stored/stored.c
bacula/src/version.h

index 4be8e345a7e601ab1e8d0c5ea6f741f7d02cee72..eccacfec29addbfa55f5a6f86f443f500b3fd65f 100644 (file)
@@ -59,7 +59,7 @@ AC_PATH_PROG(ECHO, echo, echo)
 AC_PATH_PROG(CMP, cmp, cmp)
 AC_PATH_PROG(TBL, tbl, tbl)
 AC_PATH_PROG(AR, ar, ar)
-AC_PATH_PROG(RANLIB, ranlib, ranlib)
+dnl AC_PATH_PROG(RANLIB, ranlib, ranlib)
 AC_PATH_PROG(OPENSSL, openssl, none)
 AC_PATH_PROG(MTX, mtx, mtx)
 AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
index 06bdc02c8049c34b8181e944ecda133b92eae692..ab0d12572999d6476931469b3e1e090bfdd0510a 100755 (executable)
@@ -3571,46 +3571,6 @@ else
 echo "${ECHO_T}no" >&6
 fi
 
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_RANLIB+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $RANLIB in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_RANLIB="$RANLIB" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_RANLIB="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  test -z "$ac_cv_path_RANLIB" && ac_cv_path_RANLIB="ranlib"
-  ;;
-esac
-fi
-RANLIB=$ac_cv_path_RANLIB
-
-if test -n "$RANLIB"; then
-  echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
 # Extract the first word of "openssl", so it can be a program name with args.
 set dummy openssl; ac_word=$2
 echo "$as_me:$LINENO: checking for $ac_word" >&5
index 54c355f42e7d95bb6d26e776a11592a89d1b556d..726c7ac88066b559083b251a6e0632f7ec2c8ec3 100644 (file)
 #ifndef _BACULA_H
 #define _BACULA_H 1
 
+#ifdef __cplusplus
+/* Workaround for SGI IRIX 6.5 */
+#define _LANGUAGE_C_PLUS_PLUS 1
+#endif
+
 #ifdef HAVE_WIN32
 #include "winconfig.h"
 #include "winhost.h"
index a59dc3eefc36bd967fad0f8f0248a6394e8c9263..0c221bce151a4818a78682e25a20041db02fe397 100644 (file)
@@ -68,6 +68,12 @@ static int do_outputcmd(FILE *input, BSOCK *UA_sock);
 void senditf(const char *fmt, ...);
 void sendit(const char *buf);
 
+extern "C" void got_sigstop(int sig);
+extern "C" void got_sigcontinue(int sig);
+extern "C" void got_sigtout(int sig);
+extern "C" void got_sigtin(int sig);
+
+
 /* Static variables */
 static char *configfile = NULL;
 static BSOCK *UA_sock = NULL;
@@ -106,26 +112,32 @@ static void usage()
 "\n"), HOST_OS, DISTNAME, DISTVER);
 }
 
+
+extern "C" 
 void got_sigstop(int sig)
 {
    stop = true;
 }
 
+extern "C" 
 void got_sigcontinue(int sig)
 {
    stop = false;
 }
 
+extern "C" 
 void got_sigtout(int sig) 
 {
 // printf("Got tout\n");
 }
 
+extern "C" 
 void got_sigtin(int sig)
 {   
 // printf("Got tin\n");
 }
 
+
 static int zed_keyscmd(FILE *input, BSOCK *UA_sock)
 {
    con_set_zed_keys();
@@ -531,7 +543,7 @@ wait_for_data(int fd, int sec)
    tv.tv_usec = 0;
    for ( ;; ) {
       FD_ZERO(&fdset);
-      FD_SET(fd, &fdset);
+      FD_SET((unsigned)fd, &fdset);
       switch(select(fd + 1, &fdset, NULL, NULL, &tv)) {
       case 0:                        /* timeout */
         return 0;
index 326999d84dd3835180c3bad72da3e237f59595ee..109b582d57eb9d83c11fcab3285f8c8b299d7739 100644 (file)
@@ -34,7 +34,8 @@ static void terminate_dird(int sig);
 static int check_resources();
 
 /* Exported subroutines */
-void reload_config(int sig);
+
+extern "C" void reload_config(int sig);
 
 
 /* Imported subroutines */
@@ -341,6 +342,7 @@ static int find_free_table()
  * If we get here, we have received a SIGHUP, which means to
  *    reread our configuration file. 
  */
+extern "C"
 void reload_config(int sig)
 {
    static bool already_here = false;
index 112584fcd48be856f4802547e4242842f9b13762..8040ed77e0bef02a839ee91b431492dc592df1cd 100755 (executable)
@@ -42,7 +42,9 @@
 
 
 /* Forward referenced functions */
-static void *jobq_server(void *arg);
+extern "C" void *jobq_server(void *arg);
+extern "C" void *sched_wait(void *arg);
+
 static int   start_server(jobq_t *jq);
 
 /*   
@@ -152,7 +154,8 @@ struct wait_pkt {
  *  most jobs are put into the job queue only when their
  *  scheduled time arives.
  */
-static void *sched_wait(void *arg)
+extern "C"  
+void *sched_wait(void *arg)
 {
    JCR *jcr = ((wait_pkt *)arg)->jcr;
    jobq_t *jq = ((wait_pkt *)arg)->jq;
@@ -186,7 +189,6 @@ static void *sched_wait(void *arg)
    return NULL;
 }
 
-
 /*
  *  Add a job to the queue
  *    jq is a queue that was created with jobq_init
@@ -352,7 +354,8 @@ static int start_server(jobq_t *jq)
  * When all the resources are acquired for the job, 
  *  it will call the user's engine.
  */
-static void *jobq_server(void *arg)
+extern "C"  
+void *jobq_server(void *arg)
 {
    struct timespec timeout;
    jobq_t *jq = (jobq_t *)arg;
index 1afe148ba69a3cc83a86e585046db0edc5814775..62ea60876866f7da2713d796a6e820b8f85f0fa5 100644 (file)
@@ -54,7 +54,7 @@ static char Job_end[]  =
 static char Job_status[] = "3012 Job %127s jobstatus %d\n";
 
 /* Forward referenced functions */
-static void *msg_thread(void *arg);
+extern "C" void *msg_thread(void *arg);
 
 /*
  * Establish a message channel connection with the Storage daemon
@@ -188,7 +188,7 @@ int start_storage_daemon_message_thread(JCR *jcr)
    return 1;
 }
 
-static void msg_thread_cleanup(void *arg)
+extern "C" void msg_thread_cleanup(void *arg)
 {
    JCR *jcr = (JCR *)arg;
    Dmsg0(200, "End msg_thread\n");
@@ -206,7 +206,8 @@ static void msg_thread_cleanup(void *arg)
  *  Storage daemon).
  * Note, we are running in a separate thread.
  */
-static void *msg_thread(void *arg)
+extern "C"
+void *msg_thread(void *arg)
 {
    JCR *jcr = (JCR *)arg;
    BSOCK *sd;
index 73858a84909a7831e9f8f407e1bba44728a13dc9..35b9212f3c560a37ff26757aeeb1e926e18a06f2 100644 (file)
@@ -1526,7 +1526,7 @@ static int time_cmd(UAContext *ua, const char *cmd)
 /*
  * reload the conf file
  */
-extern void reload_config(int sig);
+extern "C" void reload_config(int sig);
 
 static int reload_cmd(UAContext *ua, const char *cmd)
 {
index 4dd97dbab0002dc5dd768556530426fc8ac37287..415a60e1a63ce44714c93888bf34f66ba6ca7263 100644 (file)
@@ -48,7 +48,8 @@ int quit_cmd_thread = 0;
 
 /* Forward referenced functions */
 
-static void *connect_thread(void *arg);
+extern "C" void *connect_thread(void *arg);
+
 static void *handle_UA_client_request(void *arg);
 
 
@@ -80,7 +81,8 @@ void start_UA_server(char *UA_addr, int UA_port)
    return;
 }
 
-static void *connect_thread(void *arg)
+extern "C" 
+void *connect_thread(void *arg)
 {
    struct s_addr_port *UA = (struct s_addr_port *)arg;
 
index 8e1c033d22ccee69ef689bdb2fa26f2157493afc..3a1ae9406cdf1e609064b71410b4c6a626b76c9a 100644 (file)
 #define WAIT_INTERVAL 60
 #endif
 
+extern "C" void *sd_heartbeat_thread(void *arg);
+extern "C" void *dir_heartbeat_thread(void *arg);
+
+
 /* 
  * Listen on the SD socket for heartbeat signals.
  * Send heartbeats to the Director every HB_TIME
  *   seconds.
  */
-static void *sd_heartbeat_thread(void *arg)
+extern "C" void *sd_heartbeat_thread(void *arg)
 {
    int32_t n;
    JCR *jcr = (JCR *)arg;
@@ -121,7 +125,7 @@ void stop_heartbeat_monitor(JCR *jcr)
  *   is no SD monitoring needed -- e.g. restore and verify Vol
  *   both do their own read() on the SD socket.
  */
-static void *dir_heartbeat_thread(void *arg)
+extern "C" void *dir_heartbeat_thread(void *arg)
 {
    JCR *jcr = (JCR *)arg;
    BSOCK *dir;
@@ -149,6 +153,7 @@ static void *dir_heartbeat_thread(void *arg)
    jcr->hb_bsock = NULL;
    return NULL;
 }
+
 /*
  * Same as above but we don't listen to the SD
  */
index 4706531d60db3530ca40b7268a1f04c8e92b6428..ed8833fba977a0c0dbd123c95f3795a643797941 100644 (file)
@@ -1032,7 +1032,7 @@ static int level_cmd(JCR *jcr)
 
       Dmsg2(100, "adj = %d since_time=%d\n", (int)adj, (int)since_time);
       jcr->incremental = 1;          /* set incremental or decremental backup */
-      jcr->mtime = since_time;       /* set since time */
+      jcr->mtime = (time_t)since_time; /* set since time */
    } else {
       Jmsg1(jcr, M_FATAL, 0, "Unknown backup level: %s\n", level);
       free_memory(level);
@@ -1094,7 +1094,7 @@ static int storage_cmd(JCR *jcr)
    Dmsg3(110, "Open storage: %s:%d ssl=%d\n", jcr->stored_addr, stored_port, enable_ssl);
    /* Open command communications with Storage daemon */
    /* Try to connect for 1 hour at 10 second intervals */
-   sd = bnet_connect(jcr, 10, me->SDConnectTimeout, _("Storage daemon"), 
+   sd = bnet_connect(jcr, 10, (int)me->SDConnectTimeout, _("Storage daemon"), 
                     jcr->stored_addr, NULL, stored_port, 1);
    Dmsg0(110, "Connection OK to SD.\n");
    if (sd == NULL) {
index 377ce45393990113f744819bb9bb5cc47b8b2bc8..62d3da7329bfb3beecb8c48cb4d8ed0d3fb379e6 100644 (file)
@@ -148,7 +148,7 @@ void add_fname_to_include_list(FF_PKT *ff, int prefixed, const char *fname)
          case 'A':
            inc->options |= FO_ACL;
            break;
-        case 'Z':                 /* gzip compression */
+         case 'Z':                 /* gzip compression */
            inc->options |= FO_GZIP;
             inc->level = *++rp - '0';
             Dmsg1(200, "Compression level=%d\n", inc->level);
@@ -215,17 +215,13 @@ void add_fname_to_exclude_list(FF_PKT *ff, const char *fname)
    int len;
    struct s_excluded_file *exc, **list;
 
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
-   /* Convert any \'s into /'s */
-   for (char *p=fname; *p; p++) {
-      if (*p == '\\') {
-         *p = '/';
-      }
-   }
-#endif
    Dmsg1(20, "Add name to exclude: %s\n", fname);
 
+#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+   if (strchr(fname, '/') || strchr(fname, '\\')) {
+#else
    if (strchr(fname, '/')) {
+#endif
       list = &ff->excluded_paths_list;
    } else {
       list = &ff->excluded_files_list;
@@ -237,6 +233,14 @@ void add_fname_to_exclude_list(FF_PKT *ff, const char *fname)
    exc->next = *list;
    exc->len = len;
    strcpy(exc->fname, fname);                
+#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+   /* Convert any \'s into /'s */
+   for (char *p=exc->fname; *p; p++) {
+      if (*p == '\\') {
+         *p = '/';
+      }
+   }
+#endif
    *list = exc;
 }
 
index 9bf60753419a3d705af3e05b4ba2ad8bc8aff8c0..0de9987a6eb3e802adc6c6a8cbe94b7b9a684ec8 100644 (file)
 
 void terminate_console(int sig);
 
+extern "C" gint compare_func(const void *data1, const void *data2);
+
 gboolean
 on_console_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
 {
    gtk_main_quit();
    terminate_console(0);     
+   return TRUE;
 }
 
 void
@@ -224,7 +227,8 @@ on_select_director_cancel_clicked(GtkButton *button, gpointer user_data)
 /*
  * Compare list string items
  */
-static gint compare_func(const void *data1, const void *data2)
+extern "C"
+gint compare_func(const void *data1, const void *data2)
 {
    return strcmp((const char *)data1, (const char *)data2);
 }
index 136c2417d412ac5c66ffa9f75bac99e6feae0e64..963b96b58ebc2f9d5d333f4f58f8a1092dc6158f 100644 (file)
@@ -62,8 +62,12 @@ GList *type_list, *level_list;
 
 /* Forward referenced functions */
 void terminate_console(int sig);
-static gint message_handler(gpointer data);
-static int initial_connect_to_director(gpointer data);
+
+extern "C" {
+    static gint message_handler(gpointer data);
+    static int initial_connect_to_director(gpointer data);
+}
+
 static void set_scroll_bar_to_end(void);
 
 /* Static variables */
@@ -463,6 +467,7 @@ void write_director(const gchar *msg)
    }
 }
 
+extern "C"
 void read_director(gpointer data, gint fd, GdkInputCondition condition)
 {
    int stat;
index 98dedfae0bce49a7beb3f3ec5ed4f49442c82323..ce3a1177322dc20adf5527d86333e423b80ee0e8 100644 (file)
@@ -24,7 +24,7 @@ extern GtkWidget *entry1;     /* entry box */
 extern GtkWidget *combo1;     /* Directory combo */
 extern GtkWidget *dir_dialog; 
 extern GtkWidget *dir_select;
-extern GtkWidget *run_dialog;      /* run dialog */
+extern GtkWidget *run_dialog;       /* run dialog */
 extern GtkWidget *label_dialog;     
 extern GtkWidget *restore_dialog;   /* restore dialog */
 extern GtkWidget *restore_file_selection;   /* restore files dialog */
@@ -56,8 +56,9 @@ int disconnect_from_director(gpointer data);
 void start_director_reader(gpointer data);
 void stop_director_reader(gpointer data);
 void write_director(const gchar *msg);
-void read_director(gpointer data, gint fd, GdkInputCondition condition);
 void set_restore_dialog_defaults();
 void select_restore_files();
 
+extern "C" void read_director(gpointer data, gint fd, GdkInputCondition condition);
+
 #endif
index 3f64090f3c9cb6babe00963350cbe0f139083eca..df0680a1cfa18798338f2b56eec69618234a0ed3 100644 (file)
@@ -117,7 +117,7 @@ static int32_t write_nbytes(BSOCK *bsock, char *ptr, int32_t nbytes)
         struct timeval tv;
 
         FD_ZERO(&fdset);
-        FD_SET(bsock->fd, &fdset);
+        FD_SET((unsigned)bsock->fd, &fdset);
         tv.tv_sec = 10;
         tv.tv_usec = 0;
         select(bsock->fd + 1, NULL, &fdset, NULL, &tv);
@@ -439,7 +439,7 @@ bnet_wait_data(BSOCK *bsock, int sec)
    struct timeval tv;
 
    FD_ZERO(&fdset);
-   FD_SET(bsock->fd, &fdset);
+   FD_SET((unsigned)bsock->fd, &fdset);
    tv.tv_sec = sec;
    tv.tv_usec = 0;
    for ( ;; ) {
@@ -470,7 +470,7 @@ bnet_wait_data_intr(BSOCK *bsock, int sec)
    struct timeval tv;
 
    FD_ZERO(&fdset);
-   FD_SET(bsock->fd, &fdset);
+   FD_SET((unsigned)bsock->fd, &fdset);
    tv.tv_sec = sec;
    tv.tv_usec = 0;
    for ( ;; ) {
index 3f1c7d89f374cab77449994f1cae48b96bcaa2af..4d18839ab3e77f73179401aab5e0dc7065c90ca9 100755 (executable)
@@ -35,7 +35,8 @@
 extern time_t watchdog_time;
 
 /* Forward referenced functions */
-static void timeout_handler(int sig);
+extern "C" void timeout_handler(int sig);
+
 static void jcr_timeout_check(watchdog_t *self);
 
 int num_jobs_run;
@@ -79,7 +80,7 @@ void read_last_jobs_list(int fd, uint64_t addr)
    uint32_t num;
 
    Dmsg1(100, "read_last_jobs seek to %d\n", (int)addr);
-   if (addr == 0 || lseek(fd, addr, SEEK_SET) < 0) {
+   if (addr == 0 || lseek(fd, (off_t)addr, SEEK_SET) < 0) {
       return;
    }
    if (read(fd, &num, sizeof(num)) != sizeof(num)) {
@@ -116,7 +117,7 @@ uint64_t write_last_jobs_list(int fd, uint64_t addr)
    uint32_t num;
 
    Dmsg1(100, "write_last_jobs seek to %d\n", (int)addr);
-   if (lseek(fd, addr, SEEK_SET) < 0) {
+   if (lseek(fd, (off_t)addr, SEEK_SET) < 0) {
       return 0;
    }
    if (last_jobs) {
@@ -638,7 +639,7 @@ static void jcr_timeout_check(watchdog_t *self)
 /*
  * Timeout signal comes here
  */
-static void timeout_handler(int sig)
+extern "C" void timeout_handler(int sig)
 {
    return;                           /* thus interrupting the function */
 }
index 4e32d44401fd3e3ce28dcee10812f16ec1751958..c9216ac9269b050c0d49493b3da9db50a381f5cd 100644 (file)
@@ -58,6 +58,10 @@ static pid_t main_pid = 0;
 /* 
  * Handle signals here
  */
+extern "C" {
+    static void signal_handler(int sig);
+}
+
 static void signal_handler(int sig)
 {
    static int already_dead = 0;
index 13d3375847ed96afd9c74834c098290a6c1c9a21..28ac35f0bd73d279230de5e4237985b9318bbad1 100755 (executable)
@@ -36,7 +36,8 @@ time_t watchdog_time = 0;           /* this has granularity of SLEEP_TIME */
 #define SLEEP_TIME 1                 /* examine things every second */
 
 /* Forward referenced functions */
-static void *watchdog_thread(void *arg);
+extern "C" void *watchdog_thread(void *arg);
+
 static void wd_lock();
 static void wd_unlock();
 
@@ -214,7 +215,7 @@ bool unregister_watchdog(watchdog_t *wd)
    return ret;
 }
 
-static void *watchdog_thread(void *arg)
+extern "C" void *watchdog_thread(void *arg)
 {
    Dmsg0(400, "NicB-reworked watchdog thread entered\n");
 
index 318a20eb35540856c16def0a04dd5978fc010a88..01c9307cb1151d0f126abd9458484d55364c4346 100755 (executable)
@@ -50,7 +50,7 @@
 #include "bacula.h"
 
 /* Forward referenced functions */
-static void *workq_server(void *arg);
+extern "C" void *workq_server(void *arg);
 
 /*   
  * Initialize a work queue
@@ -282,7 +282,8 @@ int workq_remove(workq_t *wq, workq_ele_t *work_item)
  * This is the worker thread that serves the work queue.
  * In due course, it will call the user's engine.
  */
-static void *workq_server(void *arg)
+extern "C"
+void *workq_server(void *arg)
 {
    struct timespec timeout;
    workq_t *wq = (workq_t *)arg;
index f910f85e2fefb28c28cdf28ffd80b33a1bd22079..fe12febbea2cb68f20d3336b33ebd30d890e3908 100644 (file)
@@ -38,7 +38,8 @@
 /* Forward referenced functions */
 void terminate_stored(int sig);
 static void check_config();
-static void *device_allocation(void *arg);
+
+extern "C" void *device_allocation(void *arg);
 
 #define CONFIG_FILE "bacula-sd.conf"  /* Default config file */
 
@@ -295,7 +296,8 @@ static void check_config()
  * We are started as a separate thread.  The
  *  resources are alread locked.
  */
-static void *device_allocation(void *arg)
+extern "C"
+void *device_allocation(void *arg)
 {
    DEVRES *device;
 
index 7ae7e586d12e26116bef2512e1c4d6dbda1d7bae..ea7ebab74f93fd4d6627de94e4f9bb6c535684fa 100644 (file)
@@ -2,8 +2,8 @@
 #undef  VERSION
 #define VERSION "1.35.0"
 #define VSTRING "1"
-#define BDATE   "14 June 2004"
-#define LSMDATE "14Jun04"
+#define BDATE   "15 June 2004"
+#define LSMDATE "15Jun04"
 
 /* Debug flags */
 #undef  DEBUG