|
libzypp 17.38.15
|
Load libcurl with dlopen() on first use instead of a DT_NEEDED entry. More...
#include <curl/curl.h>#include <dlfcn.h>#include <pthread.h>#include <stdarg.h>#include <stdio.h>
Go to the source code of this file.
Macros | |
| #define | CURL_DL_FN(ret, name, proto, args, errret) |
| #define | CURL_DL_FN_VOID(name, proto, args) |
Functions | |
| CURL_DL_FN (CURLcode, curl_global_init,(long flags),(flags), CURLE_FAILED_INIT) CURL_DL_FN(CURL * | |
| nullptr | CURL_DL_FN_VOID (curl_easy_cleanup,(CURL *handle),(handle)) CURL_DL_FN_VOID(curl_easy_reset |
| nullptr CURL handle | CURL_DL_FN (const char *, curl_easy_strerror,(CURLcode code),(code), "libcurl is not available") CURL_DL_FN_VOID(curl_free |
| nullptr CURL handle void p | CURL_DL_FN (char *, curl_unescape,(const char *str, int length),(str, length), nullptr) CURL_DL_FN(curl_version_info_data * |
| nullptr CURL handle void p CURLversion nullptr | CURL_DL_FN (struct curl_slist *, curl_slist_append,(struct curl_slist *list, const char *str),(list, str), nullptr) CURL_DL_FN_VOID(curl_slist_free_all |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list | CURL_DL_FN (CURLM *, curl_multi_init,(void),(), nullptr) CURL_DL_FN(CURLMcode |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR | CURL_DL_FN (CURLMcode, curl_multi_add_handle,(CURLM *multi, CURL *handle),(multi, handle), CURLM_INTERNAL_ERROR) CURL_DL_FN(CURLMcode |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR | CURL_DL_FN (CURLMsg *, curl_multi_info_read,(CURLM *multi, int *msgs_in_queue),(multi, msgs_in_queue), nullptr) CURL_DL_FN(CURLMcode |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int CURLM_INTERNAL_ERROR | CURL_DL_FN (const char *, curl_multi_strerror,(CURLMcode code),(code), "libcurl is not available") CURLcode curl_easy_getinfo(CURL *handle |
| if (!fn) *(void **) &fn | |
| if (!fn) return CURLE_FAILED_INIT | |
| va_start (ap, info) | |
| va_end (ap) | |
| return | fn (handle, info, arg) |
| CURLcode | curl_easy_setopt (CURL *handle, CURLoption option,...) |
| CURLMcode | curl_multi_setopt (CURLM *multi, CURLMoption option,...) |
Variables | |
| curl_easy_init | |
| void | |
| nullptr CURL * | handle |
| nullptr CURL handle void * | p |
| nullptr CURL handle void p | curl_version_info |
| nullptr CURL handle void p CURLversion | age |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist * | list |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list | curl_multi_cleanup |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM * | multi |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR | curl_multi_remove_handle |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR | curl_multi_socket_action |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t | s |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int | ev_bitmask |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int * | running_handles |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int CURLM_INTERNAL_ERROR CURLINFO | info |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int CURLM_INTERNAL_ERROR CURLINFO va_list | ap |
| void * | arg = va_arg( ap, void * ) |
Load libcurl with dlopen() on first use instead of a DT_NEEDED entry.
The distro libcurl pulls ~30 shared objects (TLS, ssh, ldap, idn, kerberos, ...) into every process that links it, costing ~2ms of startup per exec - paid even by runs that never touch the network (zypper –help, cached info/search).
This file defines every libcurl symbol libzypp references. Each wrapper resolves the real function from libcurl.so.4 on first call, so the library and its dependency closure are only mapped when a download actually happens. All other code keeps calling plain curl_* functions and stays oblivious.
Keep the list in sync with the real usage: nm -D –undefined-only libzypp.so | grep ' curl_' A missing wrapper resurfaces as a DT_NEEDED on libcurl again (the linker pulls it from CURL_LIBRARIES if someone re-adds it) or as a link error, never as silent misbehavior.
curl_easy_setopt, curl_multi_setopt and curl_easy_getinfo are variadic in the libcurl ABI. getinfo always takes one pointer; the setopt argument class is defined by the CURLOPTTYPE_* range of the option id, exactly the rule libcurl documents for bindings.
Definition in file curl_dl.cc.
| #define CURL_DL_FN | ( | ret, | |
| name, | |||
| proto, | |||
| args, | |||
| errret ) |
| #define CURL_DL_FN_VOID | ( | name, | |
| proto, | |||
| args ) |
| CURL_DL_FN | ( | CURLcode | , |
| curl_global_init | , | ||
| (long flags) | , | ||
| (flags) | , | ||
| CURLE_FAILED_INIT | ) |
| nullptr CURL handle CURL_DL_FN | ( | const char * | , |
| curl_easy_strerror | , | ||
| (CURLcode code) | , | ||
| (code) | , | ||
| "libcurl is not available" | ) |
| nullptr CURL handle void p CURL_DL_FN | ( | char * | , |
| curl_unescape | , | ||
| (const char *str, int length) | , | ||
| (str, length) | , | ||
| nullptr | ) |
| nullptr CURL handle void p CURLversion nullptr CURL_DL_FN | ( | struct curl_slist * | , |
| curl_slist_append | , | ||
| (struct curl_slist *list, const char *str) | , | ||
| (list, str) | , | ||
| nullptr | ) |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURL_DL_FN | ( | CURLM * | , |
| curl_multi_init | , | ||
| (void) | , | ||
| () | , | ||
| nullptr | ) |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURL_DL_FN | ( | CURLMcode | , |
| curl_multi_add_handle | , | ||
| (CURLM *multi, CURL *handle) | , | ||
| (multi, handle) | , | ||
| CURLM_INTERNAL_ERROR | ) |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURL_DL_FN | ( | CURLMsg * | , |
| curl_multi_info_read | , | ||
| (CURLM *multi, int *msgs_in_queue) | , | ||
| (multi, msgs_in_queue) | , | ||
| nullptr | ) |
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int CURLM_INTERNAL_ERROR CURL_DL_FN | ( | const char * | , |
| curl_multi_strerror | , | ||
| (CURLMcode code) | , | ||
| (code) | , | ||
| "libcurl is not available" | ) |
| if | ( | ! | fn | ) | & |
| if | ( | ! | fn | ) |
| va_end | ( | ap | ) |
| CURLcode curl_easy_setopt | ( | CURL * | handle, |
| CURLoption | option, | ||
| ... ) |
Definition at line 132 of file curl_dl.cc.
| CURLMcode curl_multi_setopt | ( | CURLM * | multi, |
| CURLMoption | option, | ||
| ... ) |
Definition at line 154 of file curl_dl.cc.
| curl_easy_init |
Definition at line 94 of file curl_dl.cc.
| void |
Definition at line 94 of file curl_dl.cc.
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL handle |
Definition at line 96 of file curl_dl.cc.
Definition at line 99 of file curl_dl.cc.
Definition at line 101 of file curl_dl.cc.
Definition at line 101 of file curl_dl.cc.
Definition at line 104 of file curl_dl.cc.
Definition at line 107 of file curl_dl.cc.
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int multi |
Definition at line 107 of file curl_dl.cc.
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR curl_multi_remove_handle |
Definition at line 109 of file curl_dl.cc.
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR curl_multi_socket_action |
Definition at line 111 of file curl_dl.cc.
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int s |
Definition at line 111 of file curl_dl.cc.
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int ev_bitmask |
Definition at line 111 of file curl_dl.cc.
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int running_handles |
Definition at line 111 of file curl_dl.cc.
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int CURLM_INTERNAL_ERROR CURLINFO info |
Definition at line 117 of file curl_dl.cc.
| nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int CURLM_INTERNAL_ERROR CURLINFO va_list ap |
Definition at line 120 of file curl_dl.cc.
Definition at line 121 of file curl_dl.cc.