summaryrefslogtreecommitdiff
path: root/lib/select.c
Commit message (Collapse)AuthorAgeFilesLines
* URLs: change all http:// URLs to https://Daniel Stenberg2016-02-031-1/+1
|
* lwip: Fix compatibility issues with later versionsGisle Vanem2015-12-071-10/+10
| | | | | | | | | | | | | | | | | | | | | | The name of the header guard in lwIP's <lwip/opt.h> has changed from '__LWIP_OPT_H__' to 'LWIP_HDR_OPT_H' (bug #35874 in May 2015). Other fixes: - In curl_setup.h, the problem with an old PSDK doesn't apply if lwIP is used. - In memdebug.h, the 'socket' should be undefined first due to lwIP's lwip_socket() macro. - In curl_addrinfo.c lwIP's getaddrinfo() + freeaddrinfo() macros need special handling because they were undef'ed in memdebug.h. - In select.c we can't use preprocessor conditionals inside select if MSVC and select is a macro, as it is with lwIP. http://curl.haxx.se/mail/lib-2015-12/0023.html http://curl.haxx.se/mail/lib-2015-12/0024.html
* checksrc: use space after commaDaniel Stenberg2015-03-171-2/+2
|
* checksrc: use space before paren in "return (expr);"Daniel Stenberg2015-03-171-2/+2
|
* select.c: fix compilation for VxWorksDaniel Stenberg2014-11-251-0/+4
| | | | | Reported-by: Brian Bug: http://curl.haxx.se/bug/view.cgi?id=1455
* Curl_poll + Curl_wait_ms: fix timeout return valuePeter Wang2014-08-111-3/+9
| | | | | | | | | Curl_poll and Curl_wait_ms require the fix applied to Curl_socket_check in commits b61e8b8 and c771968: When poll or select are interrupted and coincides with the timeout elapsing, the functions return -1 indicating an error instead of 0 for the timeout.
* select: with winsock, avoid passing unsupported arguments to select()Brad Spencer2014-05-271-3/+55
| | | | | | | | | | | | | | | | "Any two of the parameters, readfds, writefds, or exceptfds, can be given as null. At least one must be non-null, and any non-null descriptor set must contain at least one handle to a socket." http://msdn.microsoft.com/en-ca/library/windows/desktop/ms740141(v=vs.85).aspx When using select(), cURL doesn't adhere to this (WinSock-specific) rule, and can ask to monitor empty fd_sets, which leads to select() returning WSAEINVAL (i.e. EINVAL) and connections failing in mysterious ways as a result (at least when using the curl_multi_socket_action() interface). Bug: http://curl.haxx.se/mail/lib-2014-05/0278.html
* curl_global_init: accept the CURL_GLOBAL_ACK_EINTR flagZdenek Pavlas2013-03-121-15/+2
| | | | | | | | | The flag can be used in pycurl-based applications where using the multi interface would not be acceptable because of the performance lost caused by implementing the select() loop in python. Bug: http://curl.haxx.se/bug/view.cgi?id=1168 Downstream Bug: https://bugzilla.redhat.com/919127
* build: fix circular header inclusion with other packagesYang Tse2013-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit renames lib/setup.h to lib/curl_setup.h and renames lib/setup_once.h to lib/curl_setup_once.h. Removes the need and usage of a header inclusion guard foreign to libcurl. [1] Removes the need and presence of an alarming notice we carried in old setup_once.h [2] ---------------------------------------- 1 - lib/setup_once.h used __SETUP_ONCE_H macro as header inclusion guard up to commit ec691ca3 which changed this to HEADER_CURL_SETUP_ONCE_H, this single inclusion guard is enough to ensure that inclusion of lib/setup_once.h done from lib/setup.h is only done once. Additionally lib/setup.h has always used __SETUP_ONCE_H macro to protect inclusion of setup_once.h even after commit ec691ca3, this was to avoid a circular header inclusion triggered when building a c-ares enabled version with c-ares sources available which also has a setup_once.h header. Commit ec691ca3 exposes the real nature of __SETUP_ONCE_H usage in lib/setup.h, it is a header inclusion guard foreign to libcurl belonging to c-ares's setup_once.h The renaming this commit does, fixes the circular header inclusion, and as such removes the need and usage of a header inclusion guard foreign to libcurl. Macro __SETUP_ONCE_H no longer used in libcurl. 2 - Due to the circular interdependency of old lib/setup_once.h and the c-ares setup_once.h header, old file lib/setup_once.h has carried back from 2006 up to now days an alarming and prominent notice about the need of keeping libcurl's and c-ares's setup_once.h in sync. Given that this commit fixes the circular interdependency, the need and presence of mentioned notice is removed. All mentioned interdependencies come back from now old days when the c-ares project lived inside a curl subdirectory. This commit removes last traces of such fact.
* Revert changes relative to lib/*.[ch] recent renamingYang Tse2013-01-061-0/+529
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts renaming and usage of lib/*.h header files done 28-12-2012, reverting 2 commits: f871de0... build: make use of 76 lib/*.h renamed files ffd8e12... build: rename 76 lib/*.h files This also reverts removal of redundant include guard (redundant thanks to changes in above commits) done 2-12-2013, reverting 1 commit: c087374... curl_setup.h: remove redundant include guard This also reverts renaming and usage of lib/*.c source files done 3-12-2013, reverting 3 commits: 13606bb... build: make use of 93 lib/*.c renamed files 5b6e792... build: rename 93 lib/*.c files 7d83dff... build: commit 13606bbfde follow-up 1 Start of related discussion thread: http://curl.haxx.se/mail/lib-2013-01/0012.html Asking for confirmation on pushing this revertion commit: http://curl.haxx.se/mail/lib-2013-01/0048.html Confirmation summary: http://curl.haxx.se/mail/lib-2013-01/0079.html NOTICE: The list of 2 files that have been modified by other intermixed commits, while renamed, and also by at least one of the 6 commits this one reverts follows below. These 2 files will exhibit a hole in history unless git's '--follow' option is used when viewing logs. lib/curl_imap.h lib/curl_smtp.h
* build: rename 93 lib/*.c filesYang Tse2013-01-031-529/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 93 lib/*.c source files renamed to use our standard naming scheme. This commit only does the file renaming. ---------------------------------------- renamed: lib/amigaos.c -> lib/curl_amigaos.c renamed: lib/asyn-ares.c -> lib/curl_asyn_ares.c renamed: lib/asyn-thread.c -> lib/curl_asyn_thread.c renamed: lib/axtls.c -> lib/curl_axtls.c renamed: lib/base64.c -> lib/curl_base64.c renamed: lib/bundles.c -> lib/curl_bundles.c renamed: lib/conncache.c -> lib/curl_conncache.c renamed: lib/connect.c -> lib/curl_connect.c renamed: lib/content_encoding.c -> lib/curl_content_encoding.c renamed: lib/cookie.c -> lib/curl_cookie.c renamed: lib/cyassl.c -> lib/curl_cyassl.c renamed: lib/dict.c -> lib/curl_dict.c renamed: lib/easy.c -> lib/curl_easy.c renamed: lib/escape.c -> lib/curl_escape.c renamed: lib/file.c -> lib/curl_file.c renamed: lib/fileinfo.c -> lib/curl_fileinfo.c renamed: lib/formdata.c -> lib/curl_formdata.c renamed: lib/ftp.c -> lib/curl_ftp.c renamed: lib/ftplistparser.c -> lib/curl_ftplistparser.c renamed: lib/getenv.c -> lib/curl_getenv.c renamed: lib/getinfo.c -> lib/curl_getinfo.c renamed: lib/gopher.c -> lib/curl_gopher.c renamed: lib/gtls.c -> lib/curl_gtls.c renamed: lib/hash.c -> lib/curl_hash.c renamed: lib/hmac.c -> lib/curl_hmac.c renamed: lib/hostasyn.c -> lib/curl_hostasyn.c renamed: lib/hostcheck.c -> lib/curl_hostcheck.c renamed: lib/hostip.c -> lib/curl_hostip.c renamed: lib/hostip4.c -> lib/curl_hostip4.c renamed: lib/hostip6.c -> lib/curl_hostip6.c renamed: lib/hostsyn.c -> lib/curl_hostsyn.c renamed: lib/http.c -> lib/curl_http.c renamed: lib/http_chunks.c -> lib/curl_http_chunks.c renamed: lib/http_digest.c -> lib/curl_http_digest.c renamed: lib/http_negotiate.c -> lib/curl_http_negotiate.c renamed: lib/http_negotiate_sspi.c -> lib/curl_http_negotiate_sspi.c renamed: lib/http_proxy.c -> lib/curl_http_proxy.c renamed: lib/idn_win32.c -> lib/curl_idn_win32.c renamed: lib/if2ip.c -> lib/curl_if2ip.c renamed: lib/imap.c -> lib/curl_imap.c renamed: lib/inet_ntop.c -> lib/curl_inet_ntop.c renamed: lib/inet_pton.c -> lib/curl_inet_pton.c renamed: lib/krb4.c -> lib/curl_krb4.c renamed: lib/krb5.c -> lib/curl_krb5.c renamed: lib/ldap.c -> lib/curl_ldap.c renamed: lib/llist.c -> lib/curl_llist.c renamed: lib/md4.c -> lib/curl_md4.c renamed: lib/md5.c -> lib/curl_md5.c renamed: lib/memdebug.c -> lib/curl_memdebug.c renamed: lib/mprintf.c -> lib/curl_mprintf.c renamed: lib/multi.c -> lib/curl_multi.c renamed: lib/netrc.c -> lib/curl_netrc.c renamed: lib/non-ascii.c -> lib/curl_non_ascii.c renamed: lib/curl_non-ascii.h -> lib/curl_non_ascii.h renamed: lib/nonblock.c -> lib/curl_nonblock.c renamed: lib/nss.c -> lib/curl_nss.c renamed: lib/nwlib.c -> lib/curl_nwlib.c renamed: lib/nwos.c -> lib/curl_nwos.c renamed: lib/openldap.c -> lib/curl_openldap.c renamed: lib/parsedate.c -> lib/curl_parsedate.c renamed: lib/pingpong.c -> lib/curl_pingpong.c renamed: lib/polarssl.c -> lib/curl_polarssl.c renamed: lib/pop3.c -> lib/curl_pop3.c renamed: lib/progress.c -> lib/curl_progress.c renamed: lib/qssl.c -> lib/curl_qssl.c renamed: lib/rawstr.c -> lib/curl_rawstr.c renamed: lib/rtsp.c -> lib/curl_rtsp.c renamed: lib/security.c -> lib/curl_security.c renamed: lib/select.c -> lib/curl_select.c renamed: lib/sendf.c -> lib/curl_sendf.c renamed: lib/share.c -> lib/curl_share.c renamed: lib/slist.c -> lib/curl_slist.c renamed: lib/smtp.c -> lib/curl_smtp.c renamed: lib/socks.c -> lib/curl_socks.c renamed: lib/socks_gssapi.c -> lib/curl_socks_gssapi.c renamed: lib/socks_sspi.c -> lib/curl_socks_sspi.c renamed: lib/speedcheck.c -> lib/curl_speedcheck.c renamed: lib/splay.c -> lib/curl_splay.c renamed: lib/ssh.c -> lib/curl_ssh.c renamed: lib/sslgen.c -> lib/curl_sslgen.c renamed: lib/ssluse.c -> lib/curl_ssluse.c renamed: lib/strdup.c -> lib/curl_strdup.c renamed: lib/strequal.c -> lib/curl_strequal.c renamed: lib/strerror.c -> lib/curl_strerror.c renamed: lib/strtok.c -> lib/curl_strtok.c renamed: lib/strtoofft.c -> lib/curl_strtoofft.c renamed: lib/telnet.c -> lib/curl_telnet.c renamed: lib/tftp.c -> lib/curl_tftp.c renamed: lib/timeval.c -> lib/curl_timeval.c renamed: lib/transfer.c -> lib/curl_transfer.c renamed: lib/url.c -> lib/curl_url.c renamed: lib/version.c -> lib/curl_version.c renamed: lib/warnless.c -> lib/curl_warnless.c renamed: lib/wildcard.c -> lib/curl_wildcard.c ----------------------------------------
* build: make use of 76 lib/*.h renamed filesYang Tse2012-12-281-5/+5
| | | | | | 76 private header files renamed to use our standard naming scheme. This change affects 322 files in libcurl's source tree.
* Curl_socket_check: fix timeout return value for select usersDaniel Stenberg2012-08-071-2/+4
| | | | | | This is the same fix applied for the conditional code that uses select() that was already done for the poll specific code in commit b61e8b81f5038.
* Curl_socket_check: fix return code for timeoutMaxime Larocque2012-08-071-1/+3
| | | | | | | | | | | | | | | | | | | | We found a problem with ftp transfer using libcurl (7.23 and 7.25) inside an application which is receiving unix signals (SIGUSR1, SIGUSR2...) almost continuously. (Linux 2.4, PowerPC, HAVE_POLL_FINE defined). Curl_socket_check() uses poll() to wait for the socket, and retries it when a signal is received (EINTR). However, if a signal is received and it also happens that the timeout has been reached, Curl_socket_check() returns -1 instead of 0 (indicating an error instead of a timeout). In our case, the result is an aborted connection even before the ftp banner is received from the server, and a return value of CURLE_OUT_OF_MEMORY from curl_easy_perform() (Curl_pp_multi_statemach(), in pingpong.c, actually returns OOM if Curl_socket_check() fails :-) Funny to debug on a system on which OOM is a possible cause). Bug: http://curl.haxx.se/mail/lib-2012-07/0122.html
* Curl_socket_check: enlarge poll struct array to 3Daniel Stenberg2011-12-201-1/+1
| | | | | | | | | | | This function was introduced in commit 5527417afae0 and as pointed out by Gokhan Sengun, the array with poll structs must large enough to hold 3 sockets since that is what the function can accept. It could be noted that he had this fixed in his patch as posted in http://curl.haxx.se/mail/lib-2011-12/0179.html Bug: http://curl.haxx.se/mail/lib-2011-12/0228.html Reported by: Gokhan Sengun
* sockets: new Curl_socket_check() can wait for 3 socketsDaniel Stenberg2011-12-201-20/+55
| | | | | This offers an alternative to the existing Curl_socket_ready() API which only checks one socket for read and one for write.
* curl_multi_fdset: avoid FD_SET out of boundsDaniel Stenberg2011-09-251-14/+0
| | | | | | | | If a socket is larger than FD_SETSIZE, avoid using FD_SET() on the platforms where this is possible. Bug: http://curl.haxx.se/bug/view.cgi?id=3413274 Reported by: Tim Starling
* fix a bunch of MSVC compiler warningsYang Tse2011-09-031-1/+1
|
* MemoryTracking: fix logging of free() calls done where Curl_safefree is calledYang Tse2011-09-021-2/+2
| | | | | | | | | | | | | | Just internal stuff... Curl_safefree is now a macro defined in memdebug.h instead of a function prototyped in url.h and implemented in url.c, so inclusion of url.h is no longer required in order to simply use Curl_safefree. Provide definition of macro WHILE_FALSE in setup_once.h in order to allow other macros such as DEBUGF and DEBUGASSERT, and code using it, to compile without 'conditional expression is constant' warnings. The WHILE_FALSE stuff fixes 150+ MSVC compiler warnings.
* Give the NTLM SSO helper a moment to cleanly shut down if neededDan Fandrich2011-07-281-3/+3
|
* time.h and sys/time.h inclusion conditionally done in setup_once.hYang Tse2011-07-251-3/+0
|
* long/int messDaniel Stenberg2011-06-111-2/+2
| | | | Typecast when converting to int from long to avoid some compiler warnings
* wait_ms: takes an int argumentDaniel Stenberg2011-06-051-2/+2
| | | | Typecasts added since I changed more code to use long for timeouts
* Curl_socket_ready: make timeout a 'long'Daniel Stenberg2011-06-041-1/+1
| | | | | It was mostly typecasted to int all over the code so switching to long instead all over should be a net gain.
* compiler warning: fixYang Tse2011-05-241-0/+1
| | | | | | Fix compiler warning: variable was set but never used Fix compiler warning: clobber ignored
* source cleanup: unify look, style and indent levelsDaniel Stenberg2011-04-271-5/+5
| | | | | By the use of a the new lib/checksrc.pl script that checks that our basic source style rules are followed.
* remove the CVSish $Id$ linesDaniel Stenberg2010-03-241-1/+0
|
* Fix spellingYang Tse2009-10-271-2/+2
|
* Some systems poll function sets POLLHUP in revents without settingYang Tse2009-09-151-0/+14
| | | | | | | | POLLIN, and sets POLLERR without setting POLLIN and POLLOUT. In some libcurl code execution paths this could trigger busy wait loops with high CPU usage until a timeout condition aborted the loop. This fix for Curl_poll adresses the above in a libcurl-wide mode.
* Andreas Faerber and Scott McCreary made (lib)curl build for the Haiku OSDaniel Stenberg2008-05-261-1/+1
|
* Internal time differences now use monotonic time source if available.Yang Tse2008-05-091-2/+2
| | | | This also implies the removal of the winmm.lib dependency for WIN32.
* Regression fix:Yang Tse2008-03-061-8/+8
| | | | | | | | select/poll calls will only be retried upon EINTR failures as it previously was in lib/select.c revision 1.29 In this way Curl_socket_ready() and Curl_poll() will again fail on any select/poll errors different than EINTR.
* removed space after if and while before the parenthesis for better source codeDaniel Stenberg2007-11-051-75/+75
| | | | consistency
* Cleanup no longer used macrosYang Tse2007-10-031-10/+0
|
* Fix compiler warning: local variable may be used without having been initializedYang Tse2007-10-031-2/+2
|
* When transferring 500 downloads in parallel with a c-ares enabled build onlyDaniel Stenberg2007-05-311-221/+0
| | | | | | | | to find that it crashed miserably, and this was due to some select()isms left in the code. This was due to API restrictions in c-ares 1.3.x, but with the upcoming c-ares 1.4.0 this is no longer the case so now libcurl runs much better with c-ares and the multi interface with > 1024 file descriptors in use.
* Primarily this fixes an off-by-one buffer overwrite (rare but still existing).Daniel Stenberg2007-05-261-6/+13
| | | | | | | | | | I also switched from calloc() to malloc() as a minor performance boost since the rest of the code fills in the structs fine anyway - and they must for the case when we use the stack-based auto variable array instead of the allocated one. I made the loop filling in poll_fds[] break when poll_nfds is reached as a minor speed improvement.
* initialize pending_ms to zero to avoid compiler warning:Yang Tse2007-04-201-3/+3
| | | | 'pending_ms' may be used uninitialized in this function
* - Save one call to curlx_tvnow(), which calls gettimeofday(), in each ofYang Tse2007-04-201-33/+127
| | | | | | | | | | | | | Curl_socket_ready(), Curl_poll() and Curl_select() when these are called with a zero timeout or a timeout value indicating a blocking call should be performed. These unnecessary calls to gettimeofday() got introduced in 7.16.2 when fixing 'timeout would restart when signal caught while awaiting socket events' on 20 March 2007. - Move some loop breaking logic from the while clause into the loop, avoiding compiler warning 'assignment within conditional expression'
* keep lines < 80 columnsDaniel Stenberg2007-04-191-2/+4
|
* - Robert Iakobashvil added curl_multi_socket_action() to libcurl, which is aDaniel Stenberg2007-04-161-9/+9
| | | | | | | | function that deprecates the curl_multi_socket() function. Using the new function the application tell libcurl what action that was found in the socket that it passes in. This gives a significant performance boost as it allows libcurl to avoid a call to poll()/select() for every call to curl_multi_socket*().
* move WinSock definitions of EBADF, EINTR, EINVAL and EAFNOSUPPORT to ↵Yang Tse2007-04-041-11/+0
| | | | setup_once.h
* fix MSDOS symbol checkYang Tse2007-04-031-3/+3
|
* fix compiler warningYang Tse2007-04-021-1/+1
|
* fix error introduced in last commitYang Tse2007-03-291-0/+1
|
* Improve detection of socket events which allow a further recv() callYang Tse2007-03-281-20/+13
| | | | | | | to complete with no delay and actually find out what happened with the socket. As well as detection of socket send()able condition. This also allows removal of a Cygwin specific block of code.
* New Internal wrapper function Curl_select() around select (2), itYang Tse2007-03-271-2/+195
| | | | | uses poll() when a fine poll() is available, so now libcurl can be built without select() support at all if a fine poll() is available.
* don't retry select() call upon unrecoverable error EBADFYang Tse2007-03-271-7/+17
|
* Internal function Curl_select() renamed to Curl_socket_ready()Yang Tse2007-03-261-3/+3
|
* Add a couple of local macros to improve code readability.Yang Tse2007-03-221-43/+66
| | | | | For completeness sake, wait_ms() might also get interrupted when experimental CURL_ACKNOWLEDGE_EINTR is defined.