xref: /aosp_15_r20/external/curl/docs/libcurl/opts/CURLOPT_NOSIGNAL.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerTitle: CURLOPT_NOSIGNAL
5*6236dae4SAndroid Build Coastguard WorkerSection: 3
6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl
7*6236dae4SAndroid Build Coastguard WorkerSee-also:
8*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_TIMEOUT (3)
9*6236dae4SAndroid Build Coastguard WorkerProtocol:
10*6236dae4SAndroid Build Coastguard Worker  - All
11*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.10
12*6236dae4SAndroid Build Coastguard Worker---
13*6236dae4SAndroid Build Coastguard Worker
14*6236dae4SAndroid Build Coastguard Worker# NAME
15*6236dae4SAndroid Build Coastguard Worker
16*6236dae4SAndroid Build Coastguard WorkerCURLOPT_NOSIGNAL - skip all signal handling
17*6236dae4SAndroid Build Coastguard Worker
18*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS
19*6236dae4SAndroid Build Coastguard Worker
20*6236dae4SAndroid Build Coastguard Worker~~~c
21*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h>
22*6236dae4SAndroid Build Coastguard Worker
23*6236dae4SAndroid Build Coastguard WorkerCURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOSIGNAL, long onoff);
24*6236dae4SAndroid Build Coastguard Worker~~~
25*6236dae4SAndroid Build Coastguard Worker
26*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION
27*6236dae4SAndroid Build Coastguard Worker
28*6236dae4SAndroid Build Coastguard WorkerIf *onoff* is 1, libcurl uses no functions that install signal handlers or
29*6236dae4SAndroid Build Coastguard Workerany functions that cause signals to be sent to the process. This option is
30*6236dae4SAndroid Build Coastguard Workerhere to allow multi-threaded Unix applications to still set/use all timeout
31*6236dae4SAndroid Build Coastguard Workeroptions etc, without risking getting signals.
32*6236dae4SAndroid Build Coastguard Worker
33*6236dae4SAndroid Build Coastguard WorkerIf this option is set and libcurl has been built with the standard name
34*6236dae4SAndroid Build Coastguard Workerresolver, timeouts cannot occur while the name resolve takes place. Consider
35*6236dae4SAndroid Build Coastguard Workerbuilding libcurl with the c-ares or threaded resolver backends to enable
36*6236dae4SAndroid Build Coastguard Workerasynchronous DNS lookups, to enable timeouts for name resolves without the use
37*6236dae4SAndroid Build Coastguard Workerof signals.
38*6236dae4SAndroid Build Coastguard Worker
39*6236dae4SAndroid Build Coastguard WorkerSetting CURLOPT_NOSIGNAL(3) to 1 makes libcurl NOT ask the system to
40*6236dae4SAndroid Build Coastguard Workerignore SIGPIPE signals, which otherwise are sent by the system when trying to
41*6236dae4SAndroid Build Coastguard Workersend data to a socket which is closed in the other end. libcurl makes an
42*6236dae4SAndroid Build Coastguard Workereffort to never cause such SIGPIPE signals to trigger, but some operating
43*6236dae4SAndroid Build Coastguard Workersystems have no way to avoid them and even on those that have there are some
44*6236dae4SAndroid Build Coastguard Workercorner cases when they may still happen, contrary to our desire.
45*6236dae4SAndroid Build Coastguard Worker
46*6236dae4SAndroid Build Coastguard Worker# DEFAULT
47*6236dae4SAndroid Build Coastguard Worker
48*6236dae4SAndroid Build Coastguard Worker0
49*6236dae4SAndroid Build Coastguard Worker
50*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS%
51*6236dae4SAndroid Build Coastguard Worker
52*6236dae4SAndroid Build Coastguard Worker# EXAMPLE
53*6236dae4SAndroid Build Coastguard Worker
54*6236dae4SAndroid Build Coastguard Worker~~~c
55*6236dae4SAndroid Build Coastguard Workerint main(void)
56*6236dae4SAndroid Build Coastguard Worker{
57*6236dae4SAndroid Build Coastguard Worker  CURL *curl = curl_easy_init();
58*6236dae4SAndroid Build Coastguard Worker  if(curl) {
59*6236dae4SAndroid Build Coastguard Worker    CURLcode res;
60*6236dae4SAndroid Build Coastguard Worker    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
61*6236dae4SAndroid Build Coastguard Worker
62*6236dae4SAndroid Build Coastguard Worker    curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
63*6236dae4SAndroid Build Coastguard Worker
64*6236dae4SAndroid Build Coastguard Worker    res = curl_easy_perform(curl);
65*6236dae4SAndroid Build Coastguard Worker
66*6236dae4SAndroid Build Coastguard Worker    curl_easy_cleanup(curl);
67*6236dae4SAndroid Build Coastguard Worker  }
68*6236dae4SAndroid Build Coastguard Worker}
69*6236dae4SAndroid Build Coastguard Worker~~~
70*6236dae4SAndroid Build Coastguard Worker
71*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY%
72*6236dae4SAndroid Build Coastguard Worker
73*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE
74*6236dae4SAndroid Build Coastguard Worker
75*6236dae4SAndroid Build Coastguard WorkerReturns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
76