• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_NOSIGNAL
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_TIMEOUT (3)
9Protocol:
10  - All
11---
12
13# NAME
14
15CURLOPT_NOSIGNAL - skip all signal handling
16
17# SYNOPSIS
18
19~~~c
20#include <curl/curl.h>
21
22CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOSIGNAL, long onoff);
23~~~
24
25# DESCRIPTION
26
27If *onoff* is 1, libcurl uses no functions that install signal handlers or
28any functions that cause signals to be sent to the process. This option is
29here to allow multi-threaded unix applications to still set/use all timeout
30options etc, without risking getting signals.
31
32If this option is set and libcurl has been built with the standard name
33resolver, timeouts cannot occur while the name resolve takes place. Consider
34building libcurl with the c-ares or threaded resolver backends to enable
35asynchronous DNS lookups, to enable timeouts for name resolves without the use
36of signals.
37
38Setting CURLOPT_NOSIGNAL(3) to 1 makes libcurl NOT ask the system to
39ignore SIGPIPE signals, which otherwise are sent by the system when trying to
40send data to a socket which is closed in the other end. libcurl makes an
41effort to never cause such SIGPIPE signals to trigger, but some operating
42systems have no way to avoid them and even on those that have there are some
43corner cases when they may still happen, contrary to our desire.
44
45# DEFAULT
46
470
48
49# EXAMPLE
50
51~~~c
52int main(void)
53{
54  CURL *curl = curl_easy_init();
55  if(curl) {
56    CURLcode res;
57    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
58
59    curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
60
61    res = curl_easy_perform(curl);
62
63    curl_easy_cleanup(curl);
64  }
65}
66~~~
67
68# AVAILABILITY
69
70Added in 7.10
71
72# RETURN VALUE
73
74Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
75