Blame SOURCES/0004-curl-7.29.0-57ccdfa8.patch

9d7d3f
From 37a515d9933a3160a8a868d5a697a42b28f6d792 Mon Sep 17 00:00:00 2001
9d7d3f
From: Zdenek Pavlas <zpavlas@redhat.com>
9d7d3f
Date: Mon, 11 Mar 2013 14:57:07 +0100
9d7d3f
Subject: [PATCH 2/2] curl_global_init: accept the CURL_GLOBAL_ACK_EINTR flag
9d7d3f
9d7d3f
The flag can be used in pycurl-based applications where using the multi
9d7d3f
interface would not be acceptable because of the performance lost caused
9d7d3f
by implementing the select() loop in python.
9d7d3f
9d7d3f
Bug: http://curl.haxx.se/bug/view.cgi?id=1168
9d7d3f
Downstream Bug: https://bugzilla.redhat.com/919127
9d7d3f
9d7d3f
[upstream commit 57ccdfa8d2bb6275388223f4676cd623ebd01697]
9d7d3f
---
9d7d3f
 docs/libcurl/curl_global_init.3  |    4 ++++
9d7d3f
 docs/libcurl/symbols-in-versions |    1 +
9d7d3f
 include/curl/curl.h              |    1 +
9d7d3f
 lib/easy.c                       |    2 ++
9d7d3f
 lib/select.c                     |   17 ++---------------
9d7d3f
 lib/select.h                     |    6 ++++++
9d7d3f
 6 files changed, 16 insertions(+), 15 deletions(-)
9d7d3f
9d7d3f
diff --git a/docs/libcurl/curl_global_init.3 b/docs/libcurl/curl_global_init.3
9d7d3f
index d91e1bd..6a08383 100644
9d7d3f
--- a/docs/libcurl/curl_global_init.3
9d7d3f
+++ b/docs/libcurl/curl_global_init.3
9d7d3f
@@ -70,6 +70,10 @@ Initialise nothing extra. This sets no bit.
9d7d3f
 .B CURL_GLOBAL_DEFAULT
9d7d3f
 A sensible default. It will init both SSL and Win32. Right now, this equals
9d7d3f
 the functionality of the \fBCURL_GLOBAL_ALL\fP mask.
9d7d3f
+.TP
9d7d3f
+.B CURL_GLOBAL_ACK_EINTR
9d7d3f
+When this flag is set, curl will acknowledge EINTR condition when connecting
9d7d3f
+or when waiting for data.  Otherwise, curl waits until full timeout elapses.
9d7d3f
 .SH RETURN VALUE
9d7d3f
 If this function returns non-zero, something went wrong and you cannot use the
9d7d3f
 other curl functions.
9d7d3f
diff --git a/docs/libcurl/symbols-in-versions b/docs/libcurl/symbols-in-versions
9d7d3f
index 1de1ace..37b5e27 100644
9d7d3f
--- a/docs/libcurl/symbols-in-versions
9d7d3f
+++ b/docs/libcurl/symbols-in-versions
9d7d3f
@@ -614,6 +614,7 @@ CURL_GLOBAL_DEFAULT             7.8
9d7d3f
 CURL_GLOBAL_NOTHING             7.8
9d7d3f
 CURL_GLOBAL_SSL                 7.8
9d7d3f
 CURL_GLOBAL_WIN32               7.8.1
9d7d3f
+CURL_GLOBAL_ACK_EINTR           7.30.0
9d7d3f
 CURL_HTTP_VERSION_1_0           7.9.1
9d7d3f
 CURL_HTTP_VERSION_1_1           7.9.1
9d7d3f
 CURL_HTTP_VERSION_NONE          7.9.1
9d7d3f
diff --git a/include/curl/curl.h b/include/curl/curl.h
9d7d3f
index 5b39a24..80e4cf5 100644
9d7d3f
--- a/include/curl/curl.h
9d7d3f
+++ b/include/curl/curl.h
9d7d3f
@@ -2023,6 +2023,7 @@ typedef enum {
9d7d3f
 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
9d7d3f
 #define CURL_GLOBAL_NOTHING 0
9d7d3f
 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
9d7d3f
+#define CURL_GLOBAL_ACK_EINTR (1<<2)
9d7d3f
 
9d7d3f
 
9d7d3f
 /*****************************************************************************
9d7d3f
diff --git a/lib/easy.c b/lib/easy.c
9d7d3f
index 2e747bb..2739598 100644
9d7d3f
--- a/lib/easy.c
9d7d3f
+++ b/lib/easy.c
9d7d3f
@@ -262,6 +262,8 @@ CURLcode curl_global_init(long flags)
9d7d3f
   }
9d7d3f
 #endif
9d7d3f
 
9d7d3f
+  Curl_ack_eintr = flags & CURL_GLOBAL_ACK_EINTR;
9d7d3f
+
9d7d3f
   init_flags  = flags;
9d7d3f
 
9d7d3f
   /* Preset pseudo-random number sequence. */
9d7d3f
diff --git a/lib/select.c b/lib/select.c
9d7d3f
index d13e122..db7fb6d 100644
9d7d3f
--- a/lib/select.c
9d7d3f
+++ b/lib/select.c
9d7d3f
@@ -50,11 +50,8 @@
9d7d3f
 
9d7d3f
 #define elapsed_ms  (int)curlx_tvdiff(curlx_tvnow(), initial_tv)
9d7d3f
 
9d7d3f
-#ifdef CURL_ACKNOWLEDGE_EINTR
9d7d3f
-#define error_not_EINTR (1)
9d7d3f
-#else
9d7d3f
-#define error_not_EINTR (error != EINTR)
9d7d3f
-#endif
9d7d3f
+int Curl_ack_eintr = 0;
9d7d3f
+#define error_not_EINTR (Curl_ack_eintr || error != EINTR)
9d7d3f
 
9d7d3f
 /*
9d7d3f
  * Internal function used for waiting a specific amount of ms
9d7d3f
@@ -67,10 +64,6 @@
9d7d3f
  * Timeout resolution, accuracy, as well as maximum supported
9d7d3f
  * value is system dependent, neither factor is a citical issue
9d7d3f
  * for the intended use of this function in the library.
9d7d3f
- * On non-DOS and non-Winsock platforms, when compiled with
9d7d3f
- * CURL_ACKNOWLEDGE_EINTR defined, EINTR condition is honored
9d7d3f
- * and function might exit early without awaiting full timeout,
9d7d3f
- * otherwise EINTR will be ignored and full timeout will elapse.
9d7d3f
  *
9d7d3f
  * Return values:
9d7d3f
  *   -1 = system call error, invalid timeout value, or interrupted
9d7d3f
@@ -133,9 +126,6 @@ int Curl_wait_ms(int timeout_ms)
9d7d3f
  * A negative timeout value makes this function wait indefinitely,
9d7d3f
  * unles no valid file descriptor is given, when this happens the
9d7d3f
  * negative timeout is ignored and the function times out immediately.
9d7d3f
- * When compiled with CURL_ACKNOWLEDGE_EINTR defined, EINTR condition
9d7d3f
- * is honored and function might exit early without awaiting timeout,
9d7d3f
- * otherwise EINTR will be ignored.
9d7d3f
  *
9d7d3f
  * Return values:
9d7d3f
  *   -1 = system call error or fd >= FD_SETSIZE
9d7d3f
@@ -351,9 +341,6 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
9d7d3f
  * A negative timeout value makes this function wait indefinitely,
9d7d3f
  * unles no valid file descriptor is given, when this happens the
9d7d3f
  * negative timeout is ignored and the function times out immediately.
9d7d3f
- * When compiled with CURL_ACKNOWLEDGE_EINTR defined, EINTR condition
9d7d3f
- * is honored and function might exit early without awaiting timeout,
9d7d3f
- * otherwise EINTR will be ignored.
9d7d3f
  *
9d7d3f
  * Return values:
9d7d3f
  *   -1 = system call error or fd >= FD_SETSIZE
9d7d3f
diff --git a/lib/select.h b/lib/select.h
9d7d3f
index 00789bb..c00afe1 100644
9d7d3f
--- a/lib/select.h
9d7d3f
+++ b/lib/select.h
9d7d3f
@@ -81,6 +81,12 @@ int Curl_socket_check(curl_socket_t readfd, curl_socket_t readfd2,
9d7d3f
 
9d7d3f
 int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms);
9d7d3f
 
9d7d3f
+/* On non-DOS and non-Winsock platforms, when Curl_ack_eintr is set,
9d7d3f
+ * EINTR condition is honored and function might exit early without
9d7d3f
+ * awaiting full timeout.  Otherwise EINTR will be ignored and full
9d7d3f
+ * timeout will elapse. */
9d7d3f
+extern int Curl_ack_eintr;
9d7d3f
+
9d7d3f
 int Curl_wait_ms(int timeout_ms);
9d7d3f
 
9d7d3f
 #ifdef TPF
9d7d3f
-- 
9d7d3f
1.7.1
9d7d3f