One more off the TODO list, although I hadn't realised it was going to be
as painful as it was. Teach GNU autoconf to recognise socklen_t, and use it in the code.
This commit is contained in:
parent
2e3fa7a73a
commit
d4397af4d8
3
dist/iscsi/include/config.h
vendored
3
dist/iscsi/include/config.h
vendored
@ -64,6 +64,9 @@
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define to 1 if the system has the type `socklen_t'. */
|
||||
#define HAVE_SOCKLEN_T 1
|
||||
|
||||
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||
#define HAVE_STDARG_H 1
|
||||
|
||||
|
3
dist/iscsi/include/config.h.in
vendored
3
dist/iscsi/include/config.h.in
vendored
@ -63,6 +63,9 @@
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if the system has the type `socklen_t'. */
|
||||
#undef HAVE_SOCKLEN_T
|
||||
|
||||
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||
#undef HAVE_STDARG_H
|
||||
|
||||
|
4
dist/iscsi/include/util.h
vendored
4
dist/iscsi/include/util.h
vendored
@ -250,6 +250,10 @@ void set_debug(const char *);
|
||||
#define ISCSI_GETPID getpid()
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SOCKLEN_T
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Sleeping
|
||||
*/
|
||||
|
2
dist/iscsi/src/TODO
vendored
2
dist/iscsi/src/TODO
vendored
@ -1,6 +1,5 @@
|
||||
To do
|
||||
=====
|
||||
add socklen_t awareness
|
||||
cmdline fs or fsmmap
|
||||
add ability to add a target in, take one out (if !busy)
|
||||
|
||||
@ -31,3 +30,4 @@ get port from cmd line
|
||||
raid0
|
||||
add discovery masking
|
||||
clean up IPv6
|
||||
add socklen_t awareness
|
||||
|
81
dist/iscsi/src/configure
vendored
81
dist/iscsi/src/configure
vendored
@ -3703,6 +3703,75 @@ cat >>confdefs.h <<_ACEOF
|
||||
#define size_t unsigned
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking for socklen_t" >&5
|
||||
echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6
|
||||
if test "${ac_cv_type_socklen_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/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if ((socklen_t *) 0)
|
||||
return 0;
|
||||
if (sizeof (socklen_t))
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_type_socklen_t=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_type_socklen_t=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
|
||||
echo "${ECHO_T}$ac_cv_type_socklen_t" >&6
|
||||
if test $ac_cv_type_socklen_t = yes; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_SOCKLEN_T 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking for long long" >&5
|
||||
@ -3834,6 +3903,18 @@ _ACEOF
|
||||
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_SOCKLEN_T $ac_cv_type_socklen_t
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LONG_LONG $ac_cv_type_long_long
|
||||
_ACEOF
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_UNSIGNED_LONG_LONG $ac_cv_type_unsigned_long_long
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
|
7
dist/iscsi/src/configure.ac
vendored
7
dist/iscsi/src/configure.ac
vendored
@ -19,7 +19,14 @@ AC_CHECK_HEADERS(ctype.h errno.h fcntl.h pthread.h pwd.h signal.h stdlib.h syslo
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
AC_CHECK_TYPES(socklen_t,,,[
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
])
|
||||
AC_CHECK_TYPES([long long, unsigned long long])
|
||||
AC_DEFINE_UNQUOTED(HAVE_SOCKLEN_T, $ac_cv_type_socklen_t)
|
||||
AC_DEFINE_UNQUOTED(HAVE_LONG_LONG, $ac_cv_type_long_long)
|
||||
AC_DEFINE_UNQUOTED(HAVE_UNSIGNED_LONG_LONG, $ac_cv_type_unsigned_long_long)
|
||||
|
||||
dnl Check for functionality
|
||||
AC_CHECK_FUNCS(asprintf asnprintf bswap64 snprintf strlcpy strtoll daemon vasprintf vasnprintf vsnprintf)
|
||||
|
16
dist/iscsi/src/target.c
vendored
16
dist/iscsi/src/target.c
vendored
@ -1526,14 +1526,14 @@ target_shutdown(globals_t *gp)
|
||||
int
|
||||
target_listen(globals_t *gp)
|
||||
{
|
||||
target_session_t *sess;
|
||||
int one = 1;
|
||||
int localAddrLen;
|
||||
struct sockaddr_in localAddrStorage;
|
||||
int remoteAddrLen;
|
||||
struct sockaddr_in remoteAddrStorage;
|
||||
char local[1024];
|
||||
char remote[1024];
|
||||
struct sockaddr_in remoteAddrStorage;
|
||||
struct sockaddr_in localAddrStorage;
|
||||
target_session_t *sess;
|
||||
socklen_t remoteAddrLen;
|
||||
socklen_t localAddrLen;
|
||||
char remote[1024];
|
||||
char local[1024];
|
||||
int one = 1;
|
||||
|
||||
ISCSI_THREAD_START("listen_thread");
|
||||
gp->listener_pid = ISCSI_GETPID;
|
||||
|
3
dist/iscsi/src/util.c
vendored
3
dist/iscsi/src/util.c
vendored
@ -474,8 +474,7 @@ int
|
||||
iscsi_sock_accept(iscsi_socket_t sock, iscsi_socket_t * newsock)
|
||||
{
|
||||
struct sockaddr_in remoteAddr;
|
||||
int remoteAddrLen;
|
||||
/* XXX - socklen_t */
|
||||
socklen_t remoteAddrLen;
|
||||
|
||||
remoteAddrLen = sizeof(remoteAddr);
|
||||
(void) memset(&remoteAddr, 0, sizeof(remoteAddr));
|
||||
|
Loading…
Reference in New Issue
Block a user