diff options
author | Frank Ch. Eigler <fche@redhat.com> | 2019-11-04 16:33:09 -0500 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2019-11-22 23:26:21 +0100 |
commit | 3d7a08d5d37c3e96151d1be6e6e6eb0556c079c9 (patch) | |
tree | e0e521b088ff051993abb47e77f30414cf485729 /doc/debuginfod_find_debuginfo.3 | |
parent | e27e30cae0468903473641efe3853c12d9294ac3 (diff) | |
download | elfutils-3d7a08d5d37c3e96151d1be6e6e6eb0556c079c9.tar.gz |
debuginfod 3/3: client interruptability
For interactive clients such as gdb, interruptibility is important for
usability during longer downloads. This patchset adds a
download-progress callback function to the debuginfod client library,
with which a caller app can interrupt a download as well as be
notified of its quantitative progress.
Diffstat (limited to 'doc/debuginfod_find_debuginfo.3')
-rw-r--r-- | doc/debuginfod_find_debuginfo.3 | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/doc/debuginfod_find_debuginfo.3 b/doc/debuginfod_find_debuginfo.3 index e0923d8d..d8d9236e 100644 --- a/doc/debuginfod_find_debuginfo.3 +++ b/doc/debuginfod_find_debuginfo.3 @@ -13,7 +13,7 @@ .RE .. -.TH DEBUGINFOD_FIND_DEBUGINFO 3 +.TH DEBUGINFOD_FIND_* 3 .SH NAME debuginfod_find_debuginfo \- request debuginfo from debuginfod @@ -21,9 +21,13 @@ debuginfod_find_debuginfo \- request debuginfo from debuginfod .nf .B #include <elfutils/debuginfod.h> .PP -.BI "debuginfod_find_debuginfo(const unsigned char *" build_id ", int " build_id_len ", char ** " path ");" -.BI "debuginfod_find_executable(const unsigned char *" build_id ", int " build_id_len ", char ** " path ");" -.BI "debuginfod_find_source(const unsigned char *" build_id ", int " build_id_len ", const char *" filename ", char ** " path ");" +.BI "int debuginfod_find_debuginfo(const unsigned char *" build_id ", int " build_id_len ", char ** " path ");" +.BI "int debuginfod_find_executable(const unsigned char *" build_id ", int " build_id_len ", char ** " path ");" +.BI "int debuginfod_find_source(const unsigned char *" build_id ", int " build_id_len ", const char *" filename ", char ** " path ");" +.BI "typedef int (*debuginfo_progressfn_t)(long a, long b);" +.BI "debuginfo_progressfn_t debuginfod_set_progressfn(debuginfo_progressfn_t " progressfn ");" + +Link with \fB-ldebuginfod\fP. .SH DESCRIPTION .BR debuginfod_find_debuginfo (), @@ -57,9 +61,41 @@ debuginfod needs to see too. If \fIpath\fP is not NULL and the query is successful, \fIpath\fP is set to the path of the file in the cache. The caller must \fBfree\fP() this value. -The URLs in \fB$DEBUGINFOD_URLS\fP are queried in parallel. As soon as a -debuginfod server begins transfering the target file all of the connections -to the other servers are closed. +The URLs in \fB$DEBUGINFOD_URLS\fP may be queried in parallel. As soon +as a debuginfod server begins transferring the target file all of the +connections to the other servers are closed. + +These functions are MT-safe. + +.SH "RETURN VALUE" +If a find family function is successful, the resulting file is saved +to the client cache and a file descriptor to that file is returned. +The caller needs to \fBclose\fP() this descriptor. Otherwise, a +negative error code is returned. + +.SH "PROGRESS CALLBACK" + +As the \fBdebuginfod_find_*\fP() functions may block for seconds or longer, a progress +callback function is called periodically, if configured with +.BR debuginfod_set_progressfn (). +This function sets a new progress callback function (or NULL) and +returns the previously set function (or NULL). This function may be +MT-unsafe. + +The given callback function is called from the context of each thread +that is invoking any of the other lookup functions. It is given two +numeric parameters that, if thought of as a numerator \fIa\fP and +denominator \fIb\fP, together represent a completion fraction +\fIa/b\fP. The denominator may be zero initially, until a quantity +such as an exact download size becomes known. + +The progress callback function is also the supported way to +\fIinterrupt\fP the download operation. (The library does \fInot\fP +modify or trigger signals.) The progress callback must return 0 to +continue the work, or any other value to stop work as soon as +possible. Consequently, the \fBdebuginfod_find_*\fP() function will +likely return with an error, but might still succeed. + .SH "CACHE" If the query is successful, the \fBdebuginfod_find_*\fP() functions save @@ -108,11 +144,6 @@ This environment variable governs the location of the cache where downloaded files are kept. It is cleaned periodically as this program is reexecuted. The default is $HOME/.debuginfod_client_cache. -.SH "RETURN VALUE" -If the query is successful, these functions save the target file -to the client cache and return a file descriptor to that file. -Otherwise an error code is returned. - .SH "ERRORS" The following list is not comprehensive. Error codes may also originate from calls to various C Library functions. |