1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLSHOPT_USERDATA 5Section: 3 6Source: libcurl 7See-also: 8 - CURLSHOPT_LOCKFUNC (3) 9 - curl_share_cleanup (3) 10 - curl_share_init (3) 11 - curl_share_setopt (3) 12Protocol: 13 - All 14--- 15 16# NAME 17 18CURLSHOPT_USERDATA - pointer passed to the lock and unlock mutex callbacks 19 20# SYNOPSIS 21 22~~~c 23#include <curl/curl.h> 24 25CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_USERDATA, void *clientp); 26~~~ 27 28# DESCRIPTION 29 30The *clientp* parameter is held verbatim by libcurl and is passed on as 31the *clientp* argument to the callbacks set with 32CURLSHOPT_LOCKFUNC(3) and CURLSHOPT_UNLOCKFUNC(3). 33 34# EXAMPLE 35 36~~~c 37struct secrets { 38 void *custom; 39}; 40 41int main(void) 42{ 43 CURLSHcode sh; 44 struct secrets private_stuff; 45 CURLSH *share = curl_share_init(); 46 sh = curl_share_setopt(share, CURLSHOPT_USERDATA, &private_stuff); 47 if(sh) 48 printf("Error: %s\n", curl_share_strerror(sh)); 49} 50~~~ 51 52# AVAILABILITY 53 54Added in 7.10 55 56# RETURN VALUE 57 58CURLSHE_OK (zero) means that the option was set properly, non-zero means an 59error occurred. See libcurl-errors(3) for the full list with 60descriptions. 61