mirror of
https://github.com/curl/curl.git
synced 2026-08-25 22:03:47 +03:00
Makefile.mk: drop in favour of autotools and cmake (MS-DOS, AmigaOS3)
`Makefile.mk` supported MS-DOS and Amiga, but `./configure` also
supported them in a better tested and more flexible way.
This patch also adds CMake support for MS-DOS/DJGPP and Amiga OS 3.
`Makefile.mk` was not maintained. Delete it in favour of first-tier
build methods.
Also include some non-MS-DOS/AmigaOS-specific tidy-up, see details at
the end of this message.
Details:
- fix/silence all MS-DOS/DJGPP build warnings and issues.
- add MS-DOS support to cmake.
- default to `ENABLE_THREADED_RESOLVER=OFF` for MS-DOS.
- add support for `WATT_ROOT`.
- use static libcurl with MS-DOS.
- fixup default CMake suffixes/prefixes for DJGPP.
- disable hidden symbols for MS-DOS. Not supported on MS-DOS.
- opt-in MS-DOS into `USE_UNIX_SOCKETS`.
- improve MS-DOS support in autotools.
- default to `--disable-threaded-resolver` for MS-DOS.
- make sure to use `close_s()` (from Watt-32) with autotools and cmake.
`Makefile.mk` used it before this patch.
- GHA: add DJGPP cmake (~30s) and autotools (~60s) build jobs.
Also build tests and examples with cmake.
- improve AmigaOS support in autotools:
- configure: detect `CloseSocket()` when it's a macro.
- configure: fix `IoctlSocket` detection on AmigaOS.
- curl-amissl.m4: pass AmiSSL libs to tests/servers.
- add AmigaOS3 support to cmake:
- cmake: fix `HAVE_IOCTLSOCKET_CAMEL` and
`HAVE_IOCTLSOCKET_CAMEL_FIONBIO` detections.
- set necessary system libs.
- add AmiSSL support.
- inet_ntop, inet_pton: fix using it for AmigaOS. cmake detects them,
and they did not compile with AmigaOS.
- cmake: better sync `gethostname` detection with autotools.
Fixes detection for AmigaOS, where `gethostname` is a macro.
- cmake: fix `sys/utime.h` detection on AmigaOS.
- cmake: force-disable `getaddrinfo` for AmigaOS.
- cmake: tweak threading and static/shared default for AmigaOS.
- cmake: rely on manual variable `AMIGA` to enable the platform.
- GHA: add AmigaOS cmake and autotools (~45s) jobs.
Also build tests and examples with cmake.
- INSTALL: update MS-DOS and AmigaOS build instructions.
- amigaos: fix `-Wpointer-sign` and
`zero or negative size array '_args'` in `Printf()`.
- amigaos: fix `-Wpointer-sign`
- amigaos: fix `-Wredundant-decls` `errno` and `h_errno`.
- amigaos: brute-force silence `lseek()` size warnings.
- amigaos: server/resolve: silence `-Wdiscarded-qualifiers`.
- amigaos: server/resolve: fix `-Wpointer-sign`.
- amigaos: fix `CURL_SA_FAMILY_T` type.
- nonblock: prefer `HAVE_IOCTLSOCKET_CAMEL_FIONBIO` for AmigaOS.
`ioctl` is also detected, but fails when used. Make the above override
it for a successful build.
Authored-by: Darren Banfi
Fixes #15537
Closes #15603
- tftpd: prefer `HAVE_IOCTLSOCKET_CAMEL_FIONBIO` for AmigaOS.
- tftpd: tidy-up conditional code.
- curl: set stack size to 16384 for AmigaOS3/4
Overriding the default 4096.
Suggested-by: Darren Banfi
Ref: https://github.com/curl/curl/pull/15543#issuecomment-2498783123
Ref: https://wiki.amigaos.net/wiki/Controlling_Application_Stack
- functypes.h: fix `SEND_QUAL_ARG2` for AmigaOS.
- tftp: add missing cast in sendto() call for AmigaOS.
- getinfo: fix warning with AmigaOS.
- tool_operate: silence warning with AmigaOS
- amigaos: fix building libtests due to missing `RLIMIT_NOFILE`.
- curl_gethostname: silence warning for AmigaOS.
- ftp: silence `-Wtype-limits` for AmigaOS.
- libtest: fix timeval initialization for AmigaOS.
- examples: fix `timeval` initialization for AmigaOS.
- examples: silence warning for AmigaOS.
- configure: fix IPv6 detection for cross-builds.
- netrc: fix to build with AmigaOS cleanly.
- buildinfo: detect and add `DOS` tag for MS-DOS builds.
- buildinfo: add `AMIGA` to buildinfo.txt in auttools.
- build: move `USE_WATT32` macro definition to cmake/configure.
Non-MS-DOS/AmigeOS-specific tidy-ups:
- configure: sync `sa_family_t` detection with cmake.
- configure: sync `ADDRESS_FAMILY` detection signals with cmake.
- doh: use `CURL_SA_FAMILY_T`.
- lib: drop mingw-specific `CURL_SA_FAMILY_T` workaround.
- cmake: extend instead of override check-specific
configurations/requirements.
This allows to honor global requirements added earlier.
Necessary for AmigaOS for example.
- cmake: omit warning on disabled IPv6 for MS-DOS and AmigaOS.
No IPv6 support on these platforms. Also sync with autotools.
- lib1960: use libcurl `inet_pton()` wrapper.
- cmake: detect LibreSSL (to match autotools).
- cmake: say the specific OpenSSL flavour detected.
- hostip: add missing `HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID` guard.
- lib: simplify classic mac feature guards.
Follow-up to a8861b6ccd #9764
Closes #15543
This commit is contained in:
parent
607bec04d9
commit
a3585c9576
74 changed files with 734 additions and 1019 deletions
|
|
@ -35,8 +35,8 @@ nothing
|
|||
</stdout>
|
||||
|
||||
# This test case previously tested an overflow case ("2094 Nov 6 =>
|
||||
# 2147483647") for 32bit time_t, but since some systems have 64bit time_t and
|
||||
# handles this (returning 3939840000), and some 64bit-time_t systems don't
|
||||
# 2147483647") for 32-bit time_t, but since some systems have 64-bit time_t and
|
||||
# handles this (returning 3939840000), and some 64-bit time_t systems don't
|
||||
# handle this and return -1 for this, it turned very tricky to write a fine
|
||||
# test case and thus it is now removed until we have a way to write test cases
|
||||
# for this kind of things.
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
#
|
||||
###########################################################################
|
||||
|
||||
# Get 'LIBTESTPROGS', '*_SOURCES', 'TESTUTIL', 'TSTTRACE', 'WARNLESS', 'MULTIBYTE', 'TIMEDIFF', 'THREADS', 'FIRSTFILES' variables
|
||||
# Get 'LIBTESTPROGS', '*_SOURCES', 'TESTUTIL', 'TSTTRACE', 'WARNLESS', 'MULTIBYTE', 'INET_PTON', 'TIMEDIFF', 'THREADS',
|
||||
# 'FIRSTFILES' variables
|
||||
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
|
||||
|
|
@ -50,7 +51,7 @@ if(CURL_TEST_BUNDLES)
|
|||
list(APPEND libtests_SOURCES ${TESTUTIL} ${TSTTRACE})
|
||||
if(LIB_SELECTED STREQUAL LIB_SHARED)
|
||||
# These are part of the libcurl static lib. Add them here when linking shared.
|
||||
list(APPEND libtests_SOURCES ${WARNLESS} ${MULTIBYTE} ${TIMEDIFF} ${THREADS})
|
||||
list(APPEND libtests_SOURCES ${WARNLESS} ${MULTIBYTE} ${INET_PTON} ${TIMEDIFF} ${THREADS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
@ -63,7 +64,7 @@ foreach(_target IN LISTS LIBTESTPROGS)
|
|||
|
||||
if(LIB_SELECTED STREQUAL LIB_STATIC)
|
||||
# These are part of the libcurl static lib. Do not compile/link them again.
|
||||
list(REMOVE_ITEM _sources ${WARNLESS} ${MULTIBYTE} ${TIMEDIFF} ${THREADS})
|
||||
list(REMOVE_ITEM _sources ${WARNLESS} ${MULTIBYTE} ${INET_PTON} ${TIMEDIFF} ${THREADS})
|
||||
endif()
|
||||
|
||||
string(TOUPPER ${_target} _upper_target)
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ CLEANFILES += libtest_bundle.c
|
|||
if USE_CPPFLAG_CURL_STATICLIB
|
||||
else
|
||||
# These are part of the libcurl static lib. Add them here when linking shared.
|
||||
libtests_SOURCES += $(WARNLESS) $(MULTIBYTE) $(TIMEDIFF) $(THREADS)
|
||||
libtests_SOURCES += $(WARNLESS) $(MULTIBYTE) $(INET_PTON) $(TIMEDIFF) $(THREADS)
|
||||
endif
|
||||
else
|
||||
noinst_PROGRAMS = $(LIBTESTPROGS)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ WARNLESS = ../../lib/warnless.c ../../lib/warnless.h
|
|||
# files used only in some libcurl test programs
|
||||
MULTIBYTE = ../../lib/curl_multibyte.c ../../lib/curl_multibyte.h
|
||||
|
||||
# files used only in some libcurl test programs
|
||||
INET_PTON = ../../lib/inet_pton.c ../../lib/inet_pton.h
|
||||
|
||||
# these files are used in every single test program below
|
||||
TIMEDIFF = ../../lib/timediff.c ../../lib/timediff.h
|
||||
FIRSTFILES = first.c first.h
|
||||
|
|
@ -641,7 +644,7 @@ lib1958_LDADD = $(TESTUTIL_LIBS)
|
|||
lib1959_SOURCES = lib1959.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
||||
lib1959_LDADD = $(TESTUTIL_LIBS)
|
||||
|
||||
lib1960_SOURCES = lib1960.c $(SUPPORTFILES)
|
||||
lib1960_SOURCES = lib1960.c $(SUPPORTFILES) $(INET_PTON)
|
||||
lib1960_LDADD = $(TESTUTIL_LIBS)
|
||||
|
||||
lib1964_SOURCES = lib1964.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ CURLcode test(char *URL)
|
|||
rc = 0;
|
||||
#else
|
||||
/* Portable sleep for platforms other than Windows. */
|
||||
struct timeval wait = { 0, 100 * 1000 }; /* 100ms */
|
||||
struct timeval wait = {0};
|
||||
wait.tv_usec = 100 * 1000; /* 100ms */
|
||||
rc = select(0, NULL, NULL, NULL, &wait);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,18 +23,7 @@
|
|||
***************************************************************************/
|
||||
#include "test.h"
|
||||
|
||||
#ifdef HAVE_INET_PTON
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include "inet_pton.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
/* to prevent libcurl from closing our socket */
|
||||
|
|
@ -101,7 +90,7 @@ CURLcode test(char *URL)
|
|||
serv_addr.sin_family = AF_INET;
|
||||
serv_addr.sin_port = htons(port);
|
||||
|
||||
if(inet_pton(AF_INET, libtest_arg2, &serv_addr.sin_addr) <= 0) {
|
||||
if(Curl_inet_pton(AF_INET, libtest_arg2, &serv_addr.sin_addr) <= 0) {
|
||||
fprintf(stderr, "inet_pton failed\n");
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
|
@ -139,11 +128,3 @@ test_cleanup:
|
|||
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
CURLcode test(char *URL)
|
||||
{
|
||||
(void)URL;
|
||||
printf("lacks inet_pton\n");
|
||||
return CURLE_OK;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -218,7 +218,14 @@ static void updateFdSet(struct Sockets *sockets, fd_set* fdset,
|
|||
{
|
||||
int i;
|
||||
for(i = 0; i < sockets->count; ++i) {
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(sockets->sockets[i], fdset);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
if(*maxFd < sockets->sockets[i] + 1) {
|
||||
*maxFd = sockets->sockets[i] + 1;
|
||||
}
|
||||
|
|
@ -261,8 +268,9 @@ static CURLcode testone(char *URL, int timercb, int socketcb)
|
|||
CURLcode res = CURLE_OK;
|
||||
CURL *curl = NULL; CURLM *m = NULL;
|
||||
struct ReadWriteSockets sockets = {{NULL, 0, 0}, {NULL, 0, 0}};
|
||||
struct timeval timeout = {-1, 0};
|
||||
int success = 0;
|
||||
struct timeval timeout = {0};
|
||||
timeout.tv_sec = (time_t)-1;
|
||||
|
||||
/* set the limits */
|
||||
max_timer_calls = timercb;
|
||||
|
|
@ -303,14 +311,15 @@ static CURLcode testone(char *URL, int timercb, int socketcb)
|
|||
while(!checkForCompletion(m, &success)) {
|
||||
fd_set readSet, writeSet;
|
||||
curl_socket_t maxFd = 0;
|
||||
struct timeval tv = {10, 0};
|
||||
struct timeval tv = {0};
|
||||
tv.tv_sec = 10;
|
||||
|
||||
FD_ZERO(&readSet);
|
||||
FD_ZERO(&writeSet);
|
||||
updateFdSet(&sockets.read, &readSet, &maxFd);
|
||||
updateFdSet(&sockets.write, &writeSet, &maxFd);
|
||||
|
||||
if(timeout.tv_sec != -1) {
|
||||
if(timeout.tv_sec != (time_t)-1) {
|
||||
int usTimeout = getMicroSecondTimeout(&timeout);
|
||||
tv.tv_sec = usTimeout / 1000000;
|
||||
tv.tv_usec = usTimeout % 1000000;
|
||||
|
|
@ -333,7 +342,7 @@ static CURLcode testone(char *URL, int timercb, int socketcb)
|
|||
goto test_cleanup;
|
||||
}
|
||||
|
||||
if(timeout.tv_sec != -1 && getMicroSecondTimeout(&timeout) == 0) {
|
||||
if(timeout.tv_sec != (time_t)-1 && getMicroSecondTimeout(&timeout) == 0) {
|
||||
/* Curl's timer has elapsed. */
|
||||
if(socket_action(m, CURL_SOCKET_TIMEOUT, 0, "timeout")) {
|
||||
res = TEST_ERR_BAD_TIMEOUT;
|
||||
|
|
|
|||
|
|
@ -186,7 +186,14 @@ static void updateFdSet(struct Sockets *sockets, fd_set* fdset,
|
|||
{
|
||||
int i;
|
||||
for(i = 0; i < sockets->count; ++i) {
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(sockets->sockets[i], fdset);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
if(*maxFd < sockets->sockets[i] + 1) {
|
||||
*maxFd = sockets->sockets[i] + 1;
|
||||
}
|
||||
|
|
@ -227,8 +234,9 @@ CURLcode test(char *URL)
|
|||
struct_stat file_info;
|
||||
CURLM *m = NULL;
|
||||
struct ReadWriteSockets sockets = {{NULL, 0, 0}, {NULL, 0, 0}};
|
||||
struct timeval timeout = {-1, 0};
|
||||
int success = 0;
|
||||
struct timeval timeout = {0};
|
||||
timeout.tv_sec = (time_t)-1;
|
||||
|
||||
assert(test_argc >= 5);
|
||||
|
||||
|
|
@ -299,14 +307,15 @@ CURLcode test(char *URL)
|
|||
while(!checkForCompletion(m, &success)) {
|
||||
fd_set readSet, writeSet;
|
||||
curl_socket_t maxFd = 0;
|
||||
struct timeval tv = {10, 0};
|
||||
struct timeval tv = {0};
|
||||
tv.tv_sec = 10;
|
||||
|
||||
FD_ZERO(&readSet);
|
||||
FD_ZERO(&writeSet);
|
||||
updateFdSet(&sockets.read, &readSet, &maxFd);
|
||||
updateFdSet(&sockets.write, &writeSet, &maxFd);
|
||||
|
||||
if(timeout.tv_sec != -1) {
|
||||
if(timeout.tv_sec != (time_t)-1) {
|
||||
int usTimeout = getMicroSecondTimeout(&timeout);
|
||||
tv.tv_sec = usTimeout / 1000000;
|
||||
tv.tv_usec = usTimeout % 1000000;
|
||||
|
|
@ -322,7 +331,7 @@ CURLcode test(char *URL)
|
|||
checkFdSet(m, &sockets.read, &readSet, CURL_CSELECT_IN, "read");
|
||||
checkFdSet(m, &sockets.write, &writeSet, CURL_CSELECT_OUT, "write");
|
||||
|
||||
if(timeout.tv_sec != -1 && getMicroSecondTimeout(&timeout) == 0) {
|
||||
if(timeout.tv_sec != (time_t)-1 && getMicroSecondTimeout(&timeout) == 0) {
|
||||
/* Curl's timer has elapsed. */
|
||||
notifyCurl(m, CURL_SOCKET_TIMEOUT, 0, "timeout");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -748,7 +748,14 @@ static bool incoming(curl_socket_t listenfd)
|
|||
FD_ZERO(&fds_err);
|
||||
|
||||
/* there's always a socket to wait for */
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(sockfd, &fds_read);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
do {
|
||||
/* select() blocking behavior call on blocking descriptors please */
|
||||
|
|
|
|||
|
|
@ -142,7 +142,11 @@ int main(int argc, char *argv[])
|
|||
/* gethostbyname() resolve */
|
||||
struct hostent *he;
|
||||
|
||||
#ifdef __AMIGA__
|
||||
he = gethostbyname((unsigned char *)host);
|
||||
#else
|
||||
he = gethostbyname(host);
|
||||
#endif
|
||||
|
||||
rc = !he;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -996,7 +996,14 @@ static bool juggle(curl_socket_t *sockfdp,
|
|||
FD_ZERO(&fds_write);
|
||||
FD_ZERO(&fds_err);
|
||||
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET((curl_socket_t)fileno(stdin), &fds_read);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
switch(*mode) {
|
||||
|
||||
|
|
@ -1005,7 +1012,14 @@ static bool juggle(curl_socket_t *sockfdp,
|
|||
/* server mode */
|
||||
sockfd = listenfd;
|
||||
/* there's always a socket to wait for */
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(sockfd, &fds_read);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
maxfd = (int)sockfd;
|
||||
break;
|
||||
|
||||
|
|
@ -1019,7 +1033,14 @@ static bool juggle(curl_socket_t *sockfdp,
|
|||
}
|
||||
else {
|
||||
/* there's always a socket to wait for */
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(sockfd, &fds_read);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
maxfd = (int)sockfd;
|
||||
}
|
||||
break;
|
||||
|
|
@ -1029,7 +1050,14 @@ static bool juggle(curl_socket_t *sockfdp,
|
|||
sockfd = *sockfdp;
|
||||
/* sockfd turns CURL_SOCKET_BAD when our connection has been closed */
|
||||
if(CURL_SOCKET_BAD != sockfd) {
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(sockfd, &fds_read);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
maxfd = (int)sockfd;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -717,16 +717,37 @@ static bool incoming(curl_socket_t listenfd)
|
|||
FD_ZERO(&fds_err);
|
||||
|
||||
/* there's always a socket to wait for */
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(sockfd, &fds_read);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
for(i = 0; i < 2; i++) {
|
||||
if(c[i].used) {
|
||||
curl_socket_t fd = c[i].clientfd;
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(fd, &fds_read);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
if((int)fd > maxfd)
|
||||
maxfd = (int)fd;
|
||||
fd = c[i].remotefd;
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(fd, &fds_read);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
if((int)fd > maxfd)
|
||||
maxfd = (int)fd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -902,13 +902,21 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
|
|||
int rc;
|
||||
fd_set input;
|
||||
fd_set output;
|
||||
struct timeval timeout = {1, 0}; /* 1000 ms */
|
||||
struct timeval timeout = {0};
|
||||
timeout.tv_sec = 1; /* 1000 ms */
|
||||
|
||||
logmsg("Got EAGAIN from sread");
|
||||
FD_ZERO(&input);
|
||||
FD_ZERO(&output);
|
||||
got = 0;
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(sock, &input);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
do {
|
||||
logmsg("Wait until readable");
|
||||
rc = select((int)sock + 1, &input, &output, NULL, &timeout);
|
||||
|
|
@ -1375,10 +1383,18 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
|
|||
error = SOCKERRNO;
|
||||
if((error == EINPROGRESS) || (error == EWOULDBLOCK)) {
|
||||
fd_set output;
|
||||
struct timeval timeout = {1, 0}; /* 1000 ms */
|
||||
struct timeval timeout = {0};
|
||||
timeout.tv_sec = 1; /* 1000 ms */
|
||||
|
||||
FD_ZERO(&output);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(serverfd, &output);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
while(1) {
|
||||
rc = select((int)serverfd + 1, NULL, &output, NULL, &timeout);
|
||||
if(rc < 0 && SOCKERRNO != EINTR)
|
||||
|
|
@ -1488,9 +1504,10 @@ static void http_connect(curl_socket_t *infdp,
|
|||
|
||||
fd_set input;
|
||||
fd_set output;
|
||||
struct timeval timeout = {1, 0}; /* 1000 ms */
|
||||
ssize_t rc;
|
||||
curl_socket_t maxfd = (curl_socket_t)-1;
|
||||
struct timeval timeout = {0};
|
||||
timeout.tv_sec = 1; /* 1000 ms */
|
||||
|
||||
FD_ZERO(&input);
|
||||
FD_ZERO(&output);
|
||||
|
|
@ -1502,7 +1519,14 @@ static void http_connect(curl_socket_t *infdp,
|
|||
/* listener socket is monitored to allow client to establish
|
||||
secondary tunnel only when this tunnel is not established
|
||||
and primary one is fully operational */
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(rootfd, &input);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
maxfd = rootfd;
|
||||
}
|
||||
|
||||
|
|
@ -1512,14 +1536,28 @@ static void http_connect(curl_socket_t *infdp,
|
|||
if(clientfd[i] != CURL_SOCKET_BAD) {
|
||||
if(poll_client_rd[i]) {
|
||||
/* unless told not to do so, monitor readability */
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(clientfd[i], &input);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
if(clientfd[i] > maxfd)
|
||||
maxfd = clientfd[i];
|
||||
}
|
||||
if(poll_client_wr[i] && toc[i]) {
|
||||
/* unless told not to do so, monitor writability
|
||||
if there is data ready to be sent to client */
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(clientfd[i], &output);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
if(clientfd[i] > maxfd)
|
||||
maxfd = clientfd[i];
|
||||
}
|
||||
|
|
@ -1528,14 +1566,28 @@ static void http_connect(curl_socket_t *infdp,
|
|||
if(serverfd[i] != CURL_SOCKET_BAD) {
|
||||
if(poll_server_rd[i]) {
|
||||
/* unless told not to do so, monitor readability */
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(serverfd[i], &input);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
if(serverfd[i] > maxfd)
|
||||
maxfd = serverfd[i];
|
||||
}
|
||||
if(poll_server_wr[i] && tos[i]) {
|
||||
/* unless told not to do so, monitor writability
|
||||
if there is data ready to be sent to server */
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(serverfd[i], &output);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
if(serverfd[i] > maxfd)
|
||||
maxfd = serverfd[i];
|
||||
}
|
||||
|
|
@ -2323,9 +2375,10 @@ int main(int argc, char *argv[])
|
|||
for(;;) {
|
||||
fd_set input;
|
||||
fd_set output;
|
||||
struct timeval timeout = {0, 250000L}; /* 250 ms */
|
||||
curl_socket_t maxfd = (curl_socket_t)-1;
|
||||
int active;
|
||||
struct timeval timeout = {0};
|
||||
timeout.tv_usec = 250000L; /* 250 ms */
|
||||
|
||||
/* Clear out closed sockets */
|
||||
for(socket_idx = num_sockets - 1; socket_idx >= 1; --socket_idx) {
|
||||
|
|
@ -2347,7 +2400,14 @@ int main(int argc, char *argv[])
|
|||
|
||||
for(socket_idx = 0; socket_idx < num_sockets; ++socket_idx) {
|
||||
/* Listen on all sockets */
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warith-conversion"
|
||||
#endif
|
||||
FD_SET(all_sockets[socket_idx], &input);
|
||||
#if defined(__DJGPP__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
if(all_sockets[socket_idx] > maxfd)
|
||||
maxfd = all_sockets[socket_idx];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -512,21 +512,20 @@ skipit:
|
|||
|
||||
static int synchnet(curl_socket_t f /* socket to flush */)
|
||||
{
|
||||
|
||||
#if defined(HAVE_IOCTLSOCKET)
|
||||
unsigned long i;
|
||||
#else
|
||||
int i;
|
||||
#endif
|
||||
int j = 0;
|
||||
char rbuf[PKTSIZE];
|
||||
srvr_sockaddr_union_t fromaddr;
|
||||
curl_socklen_t fromaddrlen;
|
||||
|
||||
for(;;) {
|
||||
#if defined(HAVE_IOCTLSOCKET)
|
||||
#if defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
|
||||
long i;
|
||||
(void) IoctlSocket(f, FIONBIO, &i);
|
||||
#elif defined(HAVE_IOCTLSOCKET)
|
||||
unsigned long i;
|
||||
(void) ioctlsocket(f, FIONREAD, &i);
|
||||
#else
|
||||
int i;
|
||||
(void) ioctl(f, FIONREAD, &i);
|
||||
#endif
|
||||
if(i) {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@
|
|||
#include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
#ifdef MSDOS
|
||||
#include <dos.h> /* delay() */
|
||||
#endif
|
||||
|
||||
#include "curlx.h" /* from the private lib dir */
|
||||
#include "getpart.h"
|
||||
#include "util.h"
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@
|
|||
} \
|
||||
} while(0)
|
||||
|
||||
#define abort_test(msg) \
|
||||
#define unittest_abort(msg) \
|
||||
do { \
|
||||
fprintf(stderr, "%s:%d test ABORTED: '%s'\n", \
|
||||
__FILE__, __LINE__, msg); \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue