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