mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 09:21:50 -05:00
With lots of help from Rich Rauenza(?) in bug #1733119, we introduce a fairly
complicated work-around for 64bit HPUX compiles. We do the fix using inline static functions to make them follow the header file properly and thus get used fine in the test suite too etc.
This commit is contained in:
parent
ab7e7144ef
commit
375cdf89ad
@ -204,6 +204,9 @@ dnl The install stuff has already been taken care of by the automake stuff
|
||||
dnl AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
dnl check if there's a way to force code inline
|
||||
AC_C_INLINE
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
|
||||
dnl and ws2tcpip.h take precedence over any other further checks which
|
||||
|
@ -365,5 +365,87 @@ typedef int sig_atomic_t;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (__LP64__) && defined(__hpux) && !defined(_XOPEN_SOURCE_EXTENDED)
|
||||
#include <sys/socket.h>
|
||||
/* HP-UX has this oddity where it features a few functions that don't work
|
||||
with socklen_t so we need to convert to ints
|
||||
|
||||
This is due to socklen_t being a 64bit int under 64bit ABI, but the
|
||||
pre-xopen (default) interfaces require an int, which is 32bits.
|
||||
|
||||
Therefore, Anytime socklen_t is passed by pointer, the libc function
|
||||
truncates the 64bit socklen_t value by treating it as a 32bit value.
|
||||
|
||||
|
||||
Note that some socket calls are allowed to have a NULL pointer for
|
||||
the socklen arg.
|
||||
*/
|
||||
|
||||
inline static int Curl_hp_getsockname(int s, struct sockaddr *name,
|
||||
socklen_t *namelen)
|
||||
{
|
||||
int rc;
|
||||
if(namelen) {
|
||||
int len = *namelen;
|
||||
rc = getsockname(s, name, &len);
|
||||
*namelen = len;
|
||||
}
|
||||
else
|
||||
rc = getsockname(s, name, 0);
|
||||
return rc;
|
||||
}
|
||||
|
||||
inline static int Curl_hp_getsockopt(int s, int level, int optname,
|
||||
void *optval, socklen_t *optlen)
|
||||
{
|
||||
int rc;
|
||||
if(optlen) {
|
||||
int len = *optlen;
|
||||
rc = getsockopt(s, level, optname, optval, &len);
|
||||
*optlen = len;
|
||||
}
|
||||
else
|
||||
rc = getsockopt(s, level, optname, optval, 0);
|
||||
return rc;
|
||||
}
|
||||
|
||||
inline static int Curl_hp_accept(int sockfd, struct sockaddr *addr,
|
||||
socklen_t *addrlen)
|
||||
{
|
||||
int rc;
|
||||
if(addrlen) {
|
||||
int len = *addrlen;
|
||||
rc = accept(sockfd, addr, &len);
|
||||
*addrlen = len;
|
||||
}
|
||||
else
|
||||
rc = accept(sockfd, addr, 0);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
inline static ssize_t Curl_hp_recvfrom(int s, void *buf, size_t len, int flags,
|
||||
struct sockaddr *from,
|
||||
socklen_t *fromlen)
|
||||
{
|
||||
ssize_t rc;
|
||||
if(fromlen) {
|
||||
int fromlen32 = *fromlen;
|
||||
rc = recvfrom(s, buf, len, flags, from, &fromlen32);
|
||||
*fromlen = fromlen32;
|
||||
}
|
||||
else {
|
||||
rc = recvfrom(s, buf, len, flags, from, 0);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
#define getsockname(a,b,c) Curl_hp_getsockname((a),(b),(c))
|
||||
#define getsockopt(a,b,c,d,e) Curl_hp_getsockopt((a),(b),(c),(d),(e))
|
||||
#define accept(a,b,c) Curl_hp_accept((a),(b),(c))
|
||||
#define recvfrom(a,b,c,d,e,f) Curl_hp_recvfrom((a),(b),(c),(d),(e),(f))
|
||||
|
||||
#endif /* HPUX work-around */
|
||||
|
||||
#endif /* __SETUP_ONCE_H */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user