Index: ossp-pkg/sa/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/sa/ChangeLog,v rcsdiff -q -kk '-r1.28' '-r1.29' -u '/v/ossp/cvs/ossp-pkg/sa/ChangeLog,v' 2>/dev/null --- ChangeLog 2003/11/10 18:50:28 1.28 +++ ChangeLog 2004/03/26 16:05:59 1.29 @@ -11,6 +11,19 @@ This is a list of all changes to OSSP sa. For a more brief summary please have a look at the NEWS file. + Changes between 1.1.0 and FIXME (10-Nov-2003 to FIXME) + + o Add SA_CHECK_SOCKOPT autoconf check to detect setsockopt failing + under run-time on Solaris 2.6,8,9,10 and Debian 2.2 because + SO_RCVTIMEO|SO_SNDTIMEO are defined but not implemented. + Issue was found and reported by Amos Gouaux. + [Thomas Lotterer ] + + o Upgrade and unify build environment devtool and devtool.func. + Change devtool.conf to require current versions of + shtool, libtool and autoconf; correct spelling + [Thomas Lotterer ] + Changes between 1.0.5 and 1.1.0 (31-Jan-2003 to 10-Nov-2003) o Upgrade build environment to GNU autoconf 2.58. Index: ossp-pkg/sa/sa.ac RCS File: /v/ossp/cvs/ossp-pkg/sa/sa.ac,v rcsdiff -q -kk '-r1.14' '-r1.15' -u '/v/ossp/cvs/ossp-pkg/sa/sa.ac,v' 2>/dev/null --- sa.ac 2003/02/07 20:47:51 1.14 +++ sa.ac 2004/03/26 16:05:59 1.15 @@ -53,6 +53,48 @@ fi ]) +dnl # Check whether to use SO_RCVTIMEO|SO_SNDTIMEO with setsockopt(2) +dnl # configure.ac: +dnl # SA_CHECK_SOCKOPT(SO_RCVTIMEO) +dnl # SA_CHECK_SOCKOPT(SO_SNDTIMEO) +dnl # config.h: +dnl # #undef USE_SO_RCVTIMEO or #define USE_SO_RCVTIMEO 1 +dnl # #undef USE_SO_SNDTIMEO or #define USE_SO_SNDTIMEO 1 + +AC_DEFUN(SA_CHECK_SOCKOPT, [ +AC_MSG_CHECKING(whether to use $1 with setsockopt(2)) +AC_TRY_RUN([ +#include +#include +#include + +int main(void) +{ + int s; + struct timeval timeo; + timeo.tv_sec = 3; + timeo.tv_usec = 3; + +#ifndef $1 + exit(3); +#else + if ((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) + exit(2); + + /* fails on Solaris 2.6,8,9,10 and Debian 2.2 because + SO_RCVTIMEO|SO_SNDTIMEO are defined but not implemented */ + if (setsockopt(s, SOL_SOCKET, $1, (void *)&timeo, sizeof(timeo)) == -1) + exit(1); + + exit(0); +#endif +} +] +, [ AC_MSG_RESULT([yes]) AC_DEFINE(USE_$1, 1, [Define to use $1 with setsockopt(2)]) ] +, [ AC_MSG_RESULT([no]) ] +) +])dnl + dnl # Check for anything OSSP SA wants to know dnl # configure.in: dnl # SA_CHECK_ALL @@ -77,5 +119,7 @@ dnl # check for network/socket size type SA_CHECK_TYPEDEF(socklen_t, sys/socket.h) SA_CHECK_TYPEDEF(ssize_t, sys/types.h) + SA_CHECK_SOCKOPT(SO_RCVTIMEO) + SA_CHECK_SOCKOPT(SO_SNDTIMEO) ]) Index: ossp-pkg/sa/sa.c RCS File: /v/ossp/cvs/ossp-pkg/sa/sa.c,v rcsdiff -q -kk '-r1.76' '-r1.77' -u '/v/ossp/cvs/ossp-pkg/sa/sa.c,v' 2>/dev/null --- sa.c 2004/02/17 09:21:05 1.76 +++ sa.c 2004/03/26 16:05:59 1.77 @@ -939,7 +939,7 @@ if (sa->fdSocket == -1) return SA_OK; -#if defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO) +#if defined(SO_RCVTIMEO) && defined(USE_SO_RCVTIMEO) && defined(SO_SNDTIMEO) && defined(USE_SO_SNDTIMEO) if (SA_TVISZERO(sa->tvTimeout[SA_TIMEOUT_READ])) { if (setsockopt(sa->fdSocket, SOL_SOCKET, SO_RCVTIMEO, (const void *)(&sa->tvTimeout[SA_TIMEOUT_READ]), @@ -1737,13 +1737,13 @@ static int sa_read_raw(sa_t *sa, char *cpBuf, int nBufLen) { int rv; -#if !(defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO)) +#if !(defined(SO_RCVTIMEO) && defined(USE_SO_RCVTIMEO) && defined(SO_SNDTIMEO) && defined(USE_SO_SNDTIMEO)) fd_set fds; #endif /* if timeout is enabled, perform explicit/smart blocking instead of implicitly/hard blocking in the read(2) system call */ -#if !(defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO)) +#if !(defined(SO_RCVTIMEO) && defined(USE_SO_RCVTIMEO) && defined(SO_SNDTIMEO) && defined(USE_SO_SNDTIMEO)) if (!SA_TVISZERO(sa->tvTimeout[SA_TIMEOUT_READ])) { FD_ZERO(&fds); FD_SET(sa->fdSocket, &fds); @@ -1763,7 +1763,7 @@ rv = (int)SA_SC_CALL_3(sa, read, sa->fdSocket, cpBuf, (size_t)nBufLen); } while (rv == -1 && errno == EINTR); -#if defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO) +#if defined(SO_RCVTIMEO) && defined(USE_SO_RCVTIMEO) && defined(SO_SNDTIMEO) && defined(USE_SO_SNDTIMEO) if (rv == -1 && errno == EWOULDBLOCK) errno = ETIMEDOUT; #endif @@ -1916,13 +1916,13 @@ static int sa_write_raw(sa_t *sa, const char *cpBuf, int nBufLen) { int rv; -#if !(defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO)) +#if !(defined(SO_RCVTIMEO) && defined(USE_SO_RCVTIMEO) && defined(SO_SNDTIMEO) && defined(USE_SO_SNDTIMEO)) fd_set fds; #endif /* if timeout is enabled, perform explicit/smart blocking instead of implicitly/hard blocking in the write(2) system call */ -#if !(defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO)) +#if !(defined(SO_RCVTIMEO) && defined(USE_SO_RCVTIMEO) && defined(SO_SNDTIMEO) && defined(USE_SO_SNDTIMEO)) if (!SA_TVISZERO(sa->tvTimeout[SA_TIMEOUT_WRITE])) { FD_ZERO(&fds); FD_SET(sa->fdSocket, &fds); @@ -1942,7 +1942,7 @@ rv = (int)SA_SC_CALL_3(sa, write, sa->fdSocket, cpBuf, (size_t)nBufLen); } while (rv == -1 && errno == EINTR); -#if defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO) +#if defined(SO_RCVTIMEO) && defined(USE_SO_RCVTIMEO) && defined(SO_SNDTIMEO) && defined(USE_SO_SNDTIMEO) if (rv == -1 && errno == EWOULDBLOCK) errno = ETIMEDOUT; #endif