CURLSHOPT_USERDATA.3 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. .\" generated by cd2nroff 0.1 from CURLSHOPT_USERDATA.md
  2. .TH CURLSHOPT_USERDATA 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLSHOPT_USERDATA \- pointer passed to the lock and unlock mutex callbacks
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_USERDATA, void *clientp);
  9. .fi
  10. .SH DESCRIPTION
  11. The \fIclientp\fP parameter is held verbatim by libcurl and is passed on as
  12. the \fIclientp\fP argument to the callbacks set with
  13. \fICURLSHOPT_LOCKFUNC(3)\fP and \fICURLSHOPT_UNLOCKFUNC(3)\fP.
  14. .SH PROTOCOLS
  15. This functionality affects all supported protocols
  16. .SH EXAMPLE
  17. .nf
  18. struct secrets {
  19. void *custom;
  20. };
  21. int main(void)
  22. {
  23. CURLSHcode sh;
  24. struct secrets private_stuff;
  25. CURLSH *share = curl_share_init();
  26. sh = curl_share_setopt(share, CURLSHOPT_USERDATA, &private_stuff);
  27. if(sh)
  28. printf("Error: %s\\n", curl_share_strerror(sh));
  29. }
  30. .fi
  31. .SH AVAILABILITY
  32. Added in curl 7.10.3
  33. .SH RETURN VALUE
  34. CURLSHE_OK (zero) means that the option was set properly, non\-zero means an
  35. error occurred. See \fIlibcurl\-errors(3)\fP for the full list with
  36. descriptions.
  37. .SH SEE ALSO
  38. .BR CURLSHOPT_LOCKFUNC (3),
  39. .BR curl_share_cleanup (3),
  40. .BR curl_share_init (3),
  41. .BR curl_share_setopt (3)