John,

I think the patch attached  to this email (hopfully uploaded properly) will 
fix the Alpha problem.  

I've finally decided it was better to add detection code because various 
machines use "long unsigned int" and others use "int" for the ioctl(fd, 
req, ...) req argument.  In addition, at least on my machine, the man pages 
say it is "int", but /usr/include/sys/ioctl.h says it is "unsigned long 
int" ...

Kern
commit 78c64f1757419550411778b75f1018727d8f4e18
Author: Kern Sibbald <k...@sibbald.com>
Date:   Sat Dec 26 14:50:29 2009 +0100

    Attempt to autoconfig ioctl_req_t

diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in
index 632f9c0..754a44d 100644
--- a/bacula/autoconf/config.h.in
+++ b/bacula/autoconf/config.h.in
@@ -452,6 +452,9 @@
    declares uintmax_t. */
 #undef HAVE_INTTYPES_H_WITH_UINTMAX
 
+/* Set if ioctl request is unsigned long int */
+#undef HAVE_IOCTL_ULINT_REQUEST
+
 /* Whether to enable IPv6 support */
 #undef HAVE_IPV6
 
@@ -617,6 +620,9 @@
 /* Define to 1 if you have the `snprintf' function. */
 #undef HAVE_SNPRINTF
 
+/* Set if socklen_t exists */
+#undef HAVE_SOCKLEN_T
+
 /* Define to 1 if you have the <stdarg.h> header file. */
 #undef HAVE_STDARG_H
 
diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in
index 8a91a31..3147036 100644
--- a/bacula/autoconf/configure.in
+++ b/bacula/autoconf/configure.in
@@ -1859,7 +1859,31 @@ AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
        )
    ]
 )
-test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T)
+test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T, 1, [Set if socklen_t exists])
+
+dnl --------------------------------------------------------------------------
+dnl Check for ioctl request type
+dnl --------------------------------------------------------------------------
+AC_CACHE_CHECK(for ioctl_req_t, ba_cv_header_ioctl_req_t,
+   [
+       AC_TRY_COMPILE(
+	  [
+	      #include <sys/types.h>
+	      #include <sys/ioctl.h>
+	  ], [
+	      unsigned long int req;
+	      int fd;
+	      ioctl(fd, req);
+	  ], [
+	     ba_cv_header_ioctl_req_t=yes
+	  ], [
+	     ba_cv_header_ioct_req_t_t=no
+	  ]
+       )
+   ]
+)
+test $ba_cv_header_ioctl_req_t = yes && AC_DEFINE(HAVE_IOCTL_ULINT_REQUEST, 1, [Set if ioctl request is unsigned long int])
+
 
 dnl --------------------------------------------------------------------------
 dnl Check for bigendian
diff --git a/bacula/configure b/bacula/configure
index b9c4dce..65d7dd1 100755
--- a/bacula/configure
+++ b/bacula/configure
@@ -32468,11 +32468,83 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 { echo "$as_me:$LINENO: result: $ba_cv_header_socklen_t" >&5
 echo "${ECHO_T}$ba_cv_header_socklen_t" >&6; }
-test $ba_cv_header_socklen_t = yes && cat >>confdefs.h <<\_ACEOF
+test $ba_cv_header_socklen_t = yes &&
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_SOCKLEN_T 1
 _ACEOF
 
 
+{ echo "$as_me:$LINENO: checking for ioctl_req_t" >&5
+echo $ECHO_N "checking for ioctl_req_t... $ECHO_C" >&6; }
+if test "${ba_cv_header_ioctl_req_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+	      #include <sys/types.h>
+	      #include <sys/ioctl.h>
+
+int
+main ()
+{
+
+	      unsigned long int req;
+	      int fd;
+	      ioctl(fd, req);
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+
+	     ba_cv_header_ioctl_req_t=yes
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+	     ba_cv_header_ioct_req_t_t=no
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ba_cv_header_ioctl_req_t" >&5
+echo "${ECHO_T}$ba_cv_header_ioctl_req_t" >&6; }
+test $ba_cv_header_ioctl_req_t = yes &&
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_IOCTL_ULINT_REQUEST 1
+_ACEOF
+
+
+
 { echo "$as_me:$LINENO: checking for bigendian" >&5
 echo $ECHO_N "checking for bigendian... $ECHO_C" >&6; }
 if test "${ba_cv_bigendian+set}" = set; then
diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h
index f725630..e93c98c 100644
--- a/bacula/src/baconfig.h
+++ b/bacula/src/baconfig.h
@@ -53,7 +53,11 @@
 #define ETIME ETIMEDOUT
 #endif
 
-#define ioctl_req_t long unsigned int
+#ifdef HAVE_IOCTL_ULINT_REQUEST
+#define ioctl_req_t unsigned long int
+#else
+#define ioctl_req_t int
+#endif
 
 #ifdef PROTOTYPES
 # define __PROTO(p)     p
@@ -643,16 +647,9 @@ int  m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...)
 /* take this 'shortcut' */
 #define fseeko fseek
 #define ftello ftell
-#undef  ioctl_req_t
-#define ioctl_req_t int
 #endif
 
 
-#ifdef HAVE_OSF1_OS
-#undef  ioctl_req_t
-#define ioctl_req_t int
-#endif
-
 #ifdef HAVE_SUN_OS
    /*
     * On Solaris 2.5, threads are not timesliced by default, so we need to
@@ -662,8 +659,6 @@ int  m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...)
 #define set_thread_concurrency(x)  thr_setconcurrency(x)
 extern int thr_setconcurrency(int);
 #define SunOS 1
-#undef  ioctl_req_t
-#define ioctl_req_t int
 
 #else
 
@@ -717,17 +712,13 @@ extern int h_errno;
  */
 extern "C" int getdomainname(char *name, int namelen);
 extern "C" int setdomainname(char *name, int namelen);
-#undef  ioctl_req_t
-#define ioctl_req_t int
 #endif /* HAVE_HPUX_OS */
 
 
 #ifdef HAVE_OSF1_OS
 extern "C" int fchdir(int filedes);
 extern "C" long gethostid(void);
-extern "C" int mknod ( const char *path, int mode, dev_t device );
-#undef  ioctl_req_t
-#define ioctl_req_t int
+extern "C" int mknod(const char *path, int mode, dev_t device );
 #endif
 
 

Reply via email to