summaryrefslogtreecommitdiff
path: root/lib/select.h
Commit message (Collapse)AuthorAgeFilesLines
* select.h: make socket validation macros test for INVALID_SOCKETMarc Hoersken2020-08-251-2/+13
| | | | | | | | | | | With Winsock the valid range is [0..INVALID_SOCKET-1] according to https://docs.microsoft.com/en-us/windows/win32/winsock/socket-data-type-2 Reviewed-by: Jay Satiro Reviewed-by: Marcel Raad Reviewed-by: Daniel Stenberg Closes #5760
* select: use timediff_t instead of time_t and int for timeout_msMarc Hoersken2020-05-301-3/+3
| | | | | | | | | | | | | Make all functions in select.[ch] take timeout_ms as timediff_t which should always be large enough and signed on all platforms to take all possible timeout values and avoid type conversions. Reviewed-by: Jay Satiro Reviewed-by: Daniel Stenberg Replaces #5107 and partially #5262 Related to #5240 and #5286 Closes #5343
* checksrc: enhance the ASTERISKSPACE and update code accordinglyDaniel Stenberg2020-05-141-1/+1
| | | | | | | | Fine: "struct hello *world" Not fine: "struct hello* world" (and variations) Closes #5386
* select: make Curl_socket_check take timediff_t timeoutDaniel Stenberg2020-04-231-1/+1
| | | | | | | | | | Coverity found CID 1461718: Integer handling issues (CONSTANT_EXPRESSION_RESULT) "timeout_ms > 9223372036854775807L" is always false regardless of the values of its operands. This occurs as the logical second operand of "||". Closes #5240
* select: remove typecast from SOCKET_WRITABLE/READABLE macrosDaniel Stenberg2020-04-071-2/+2
| | | | | | | So that they don't hide conversions-by-mistake Reviewed-by: Jay Satiro Closes #5190
* select: move duplicate select preparation code into Curl_selectMarc Hoersken2020-03-151-0/+6
| | | | | | Reviewed by Daniel Stenberg Reviewed by Marcel Raad Closes #5078
* global_init: assume the EINTR bit by defaultDaniel Stenberg2020-01-261-9/+1
| | | | | | | | | | | | - Removed from global_init since it isn't thread-safe. The symbol will still remain to not break compiles, it just won't have any effect going forward. - make the internals NOT loop on EINTR (the opposite from previously). It only risks returning from the select/poll/wait functions early, and that should be risk-free. Closes #4840
* build: Disable Visual Studio warning "conditional expression is constant"Jay Satiro2019-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Disable warning C4127 "conditional expression is constant" globally in curl_setup.h for when building with Microsoft's compiler. This mainly affects building with the Visual Studio project files found in the projects dir. Prior to this change the cmake and winbuild build systems already disabled 4127 globally for when building with Microsoft's compiler. Also, 4127 was already disabled for all build systems in the limited circumstance of the WHILE_FALSE macro which disabled the warning specifically for while(0). This commit removes the WHILE_FALSE macro and all other cruft in favor of disabling globally in curl_setup. Background: We have various macros that cause 0 or 1 to be evaluated, which would cause warning C4127 in Visual Studio. For example this causes it: #define Curl_resolver_asynch() 1 Full behavior is not clearly defined and inconsistent across versions. However it is documented that since VS 2015 Update 3 Microsoft has addressed this somewhat but not entirely, not warning on while(true) for example. Prior to this change some C4127 warnings occurred when I built with Visual Studio using the generated projects in the projects dir. Closes https://github.com/curl/curl/pull/4658
* timediff: make it 64 bit (if possible) even with 32 bit time_tDaniel Stenberg2019-08-011-3/+3
| | | | | | | ... to make it hold microseconds too. Fixes #4165 Closes #4168
* whitespace fixesViktor Szakats2018-09-231-1/+0
| | | | | | | | | | | - replace tabs with spaces where possible - remove line ending spaces - remove double/triple newlines at EOF - fix a non-UTF-8 character - cleanup a few indentations/line continuations in manual examples Closes https://github.com/curl/curl/pull/3037
* select.h: avoid macro redefinition harderDaniel Stenberg2017-07-051-2/+3
| | | | | ... by checking the POLLIN define, as the header file checks don't work on Windows.
* poll: prefer <poll.h> over <sys/poll.h>Marcel Raad2017-04-111-3/+3
| | | | | | | The POSIX standard location is <poll.h>. Using <sys/poll.h> results in warning spam when using the musl standard library. Closes https://github.com/curl/curl/pull/1406
* lib: fix compiler warnings after de4de4e3c7cMarcel Raad2016-11-181-1/+1
| | | | | | | | | Visual C++ now complains about implicitly casting time_t (64-bit) to long (32-bit). Fix this by changing some variables from long to time_t, or explicitly casting to long where the public interface would be affected. Closes #1131
* select: switch to macros in uppercaseDaniel Stenberg2016-10-181-4/+5
| | | | | | | | | | Curl_select_ready() was the former API that was replaced with Curl_select_check() a while back and the former arg setup was provided with a define (in order to leave existing code unmodified). Now we instead offer SOCKET_READABLE and SOCKET_WRITABLE for the most common shortcuts where only one socket is checked. They're also more visibly macros.
* URLs: change all http:// URLs to https://Daniel Stenberg2016-02-031-1/+1
|
* curl_global_init: accept the CURL_GLOBAL_ACK_EINTR flagZdenek Pavlas2013-03-121-0/+6
| | | | | | | | | 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/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 76 lib/*.h filesYang Tse2012-12-281-108/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 76 private header files renamed to use our standard naming scheme. This commit only does the file renaming. ---------------------------------------- renamed: amigaos.h -> curl_amigaos.h renamed: arpa_telnet.h -> curl_arpa_telnet.h renamed: asyn.h -> curl_asyn.h renamed: axtls.h -> curl_axtls.h renamed: bundles.h -> curl_bundles.h renamed: conncache.h -> curl_conncache.h renamed: connect.h -> curl_connect.h renamed: content_encoding.h -> curl_content_encoding.h renamed: cookie.h -> curl_cookie.h renamed: cyassl.h -> curl_cyassl.h renamed: dict.h -> curl_dict.h renamed: easyif.h -> curl_easyif.h renamed: escape.h -> curl_escape.h renamed: file.h -> curl_file.h renamed: fileinfo.h -> curl_fileinfo.h renamed: formdata.h -> curl_formdata.h renamed: ftp.h -> curl_ftp.h renamed: ftplistparser.h -> curl_ftplistparser.h renamed: getinfo.h -> curl_getinfo.h renamed: gopher.h -> curl_gopher.h renamed: gtls.h -> curl_gtls.h renamed: hash.h -> curl_hash.h renamed: hostcheck.h -> curl_hostcheck.h renamed: hostip.h -> curl_hostip.h renamed: http.h -> curl_http.h renamed: http_chunks.h -> curl_http_chunks.h renamed: http_digest.h -> curl_http_digest.h renamed: http_negotiate.h -> curl_http_negotiate.h renamed: http_proxy.h -> curl_http_proxy.h renamed: if2ip.h -> curl_if2ip.h renamed: imap.h -> curl_imap.h renamed: inet_ntop.h -> curl_inet_ntop.h renamed: inet_pton.h -> curl_inet_pton.h renamed: krb4.h -> curl_krb4.h renamed: llist.h -> curl_llist.h renamed: memdebug.h -> curl_memdebug.h renamed: multiif.h -> curl_multiif.h renamed: netrc.h -> curl_netrc.h renamed: non-ascii.h -> curl_non-ascii.h renamed: nonblock.h -> curl_nonblock.h renamed: nssg.h -> curl_nssg.h renamed: parsedate.h -> curl_parsedate.h renamed: pingpong.h -> curl_pingpong.h renamed: polarssl.h -> curl_polarssl.h renamed: pop3.h -> curl_pop3.h renamed: progress.h -> curl_progress.h renamed: qssl.h -> curl_qssl.h renamed: rawstr.h -> curl_rawstr.h renamed: rtsp.h -> curl_rtsp.h renamed: select.h -> curl_select.h renamed: sendf.h -> curl_sendf.h renamed: setup.h -> curl_setup.h renamed: setup_once.h -> curl_setup_once.h renamed: share.h -> curl_share.h renamed: slist.h -> curl_slist.h renamed: smtp.h -> curl_smtp.h renamed: sockaddr.h -> curl_sockaddr.h renamed: socks.h -> curl_socks.h renamed: speedcheck.h -> curl_speedcheck.h renamed: splay.h -> curl_splay.h renamed: ssh.h -> curl_ssh.h renamed: sslgen.h -> curl_sslgen.h renamed: ssluse.h -> curl_ssluse.h renamed: strdup.h -> curl_strdup.h renamed: strequal.h -> curl_strequal.h renamed: strerror.h -> curl_strerror.h renamed: strtok.h -> curl_strtok.h renamed: strtoofft.h -> curl_strtoofft.h renamed: telnet.h -> curl_telnet.h renamed: tftp.h -> curl_tftp.h renamed: timeval.h -> curl_timeval.h renamed: transfer.h -> curl_transfer.h renamed: url.h -> curl_url.h renamed: urldata.h -> curl_urldata.h renamed: warnless.h -> curl_warnless.h renamed: wildcard.h -> curl_wildcard.h ----------------------------------------
* build: make use of 76 lib/*.h renamed filesYang Tse2012-12-281-1/+1
| | | | | | 76 private header files renamed to use our standard naming scheme. This change affects 322 files in libcurl's source tree.
* lib/*.h: use our standard naming scheme for header inclusion guardsYang Tse2012-12-281-3/+4
|
* WSAPoll: disabled on all windows buildsDaniel Stenberg2012-08-071-19/+1
| | | | | | | | | | | | | | | | Due to WSAPoll bugs, libcurl does not work as intended. When the cURL library is used to setup a connection to an incorrect port, normally the result is CURLE_COULDNT_CONNECT, /* 7 */, but due to the bug in WSAPoll, the result now is CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */. On August 1, Jan Koen Annot opened a case for this to Microsoft Premier Online (https://premier.microsoft.com/). The support engineer handling the case wrote that the case description is quite clear. He will try to reproduce the issue and then proceed with troubleshooting it. Reported by: Jan Koen Annot Bug: http://curl.haxx.se/mail/lib-2012-07/0310.html
* sockets: new Curl_socket_check() can wait for 3 socketsDaniel Stenberg2011-12-201-1/+11
| | | | | 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-0/+16
| | | | | | | | 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
* Give the NTLM SSO helper a moment to cleanly shut down if neededDan Fandrich2011-07-281-0/+2
|
* Curl_socket_ready: make timeout a 'long'Daniel Stenberg2011-06-041-2/+2
| | | | | It was mostly typecasted to int all over the code so switching to long instead all over should be a net gain.
* remove the CVSish $Id$ linesDaniel Stenberg2010-03-241-1/+0
|
* Peter Lamberg filed bug report #2015126: "poll gives WSAEINVAL when POLLPRIYang Tse2008-07-101-8/+10
| | | | | | | is set in fdset.events" (http://curl.haxx.se/bug/view.cgi?id=2015126) which exactly pinpointed the problem only triggered on Windows Vista, provided reference to docs and also a fix. There is much work behind Peter Lamberg's excellent bug report. Thank You!
* check availability of poll.h header at configuration time, and includeYang Tse2008-01-221-2/+6
| | | | it when sys/poll.h is unavailable
* Some versions of winsock2.h have pollfd struct and constantsYang Tse2007-11-101-1/+4
|
* Make our own definitions of the POLL* defiens and the pollfd struct only getDaniel Stenberg2007-06-141-1/+1
| | | | | | done if the sys/poll.h file is missing, as we have seen machines with poll() present but without the header file and machines that don't get HAVE_POLL defined but that do have the sys/poll.h header file...
* When transferring 500 downloads in parallel with a c-ares enabled build onlyDaniel Stenberg2007-05-311-4/+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.
* - Robert Iakobashvil added curl_multi_socket_action() to libcurl, which is aDaniel Stenberg2007-04-161-5/+2
| | | | | | | | 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*().
* New Internal wrapper function Curl_select() around select (2), itYang Tse2007-03-271-0/+16
| | | | | 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.
* Internal function Curl_select() renamed to Curl_socket_ready()Yang Tse2007-03-261-1/+1
|
* Code refactoring, extracting a new function wait_ms() from Curl_select andYang Tse2007-03-181-7/+24
| | | | | | | Curl_poll() which is called whenever not a single valid file descriptor is passed to these functions. Improve readibility using a poll() macro to replace WSApoll().
* reverted the pselect patch => http://curl.haxx.se/mail/lib-2007-03/0100.htmlDaniel Stenberg2007-03-111-3/+0
|
* - Bryan Henderson introduces two things:Daniel Stenberg2007-03-101-0/+3
| | | | | 1) the progress callback gets called more frequently (at times) 2) libcurl *might* call the callback when it receives a signal
* Cory Nelson made libcurl use the WSAPoll() function if built for WindowsDaniel Stenberg2006-09-241-1/+5
| | | | Vista (_WIN32_WINNT >= 0x0600)
* First commit of David McCreedy's EBCDIC and TPF changes.Daniel Stenberg2006-04-071-0/+4
|
* Suppress signed vs. unsigned warnings on Win32Gisle Vanem2004-11-191-1/+1
|
* Curl_select() now uses curl_socket_t on socket argumentsDaniel Stenberg2004-11-191-3/+1
|
* David Phillips' FD_SETSIZE fixDaniel Stenberg2004-11-191-0/+57