]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdebuginfod: Add the default progress callback function to the public API
authorAaron Merey <amerey@redhat.com>
Wed, 11 Mar 2026 14:01:38 +0000 (10:01 -0400)
committerAaron Merey <amerey@redhat.com>
Fri, 13 Mar 2026 21:56:16 +0000 (17:56 -0400)
Rename default_progressfn to debuginfod_default_progressfn and expose it
in libdebuginfod's public API.  Previously this function could only be
indirectly invoked by clients by setting the DEBUGINFOD_PROGRESS
environment variable and not explicitly setting a progress callback
function with debuginfod_set_progressfn.

The purpose of this change is to make debuginfod_default_progressfn
directly callable so that custom progress callback functions can
delegate progress reporting to it.

Signed-off-by: Aaron Merey <amerey@redhat.com>
debuginfod/debuginfod-client.c
debuginfod/debuginfod.h.in
debuginfod/libdebuginfod.map
doc/debuginfod_default_progressfn.3 [new file with mode: 0644]
doc/debuginfod_find_debuginfo.3

index c5bc8a4f4c7c28720cd4e2232f03107eab432c3e..68fa95111063ce9ef9995ec1bb112a1179743183 100644 (file)
@@ -752,8 +752,8 @@ add_headers_from_file(debuginfod_client *client, const char* filename)
 
 
 /* Offer a basic form of progress tracing */
-static int
-default_progressfn (debuginfod_client *c, long a, long b)
+int
+debuginfod_default_progressfn (debuginfod_client *c, long a, long b)
 {
   const char* url = debuginfod_get_url (c);
   int len = 0;
@@ -2567,7 +2567,7 @@ debuginfod_begin (void)
   if (client != NULL)
     {
       if (getenv(DEBUGINFOD_PROGRESS_ENV_VAR))
-       client->progressfn = default_progressfn;
+       client->progressfn = debuginfod_default_progressfn;
       if (getenv(DEBUGINFOD_VERBOSE_ENV_VAR))
        client->verbose_fd = STDERR_FILENO;
       else
index 0a6a4a22efd92e7b34b8e927c3d9ee379d642c38..2f5bd3011d97f668cfa82145fd69ff8afd691220 100644 (file)
@@ -105,6 +105,8 @@ int debuginfod_find_metadata (debuginfod_client *client,
                               const char* value,
                               char **path);
 
+int debuginfod_default_progressfn(debuginfod_client *c, long a, long b);
+
 typedef int (*debuginfod_progressfn_t)(debuginfod_client *c, long a, long b);
 void debuginfod_set_progressfn(debuginfod_client *c,
                               debuginfod_progressfn_t fn);
index 9cee91cd79aa9eb62f5f55e771381aaf91e07031..7e59a495b760f5f9abfc07f9def359a1743c0b93 100644 (file)
@@ -25,3 +25,6 @@ ELFUTILS_0.188 {
 ELFUTILS_0.192 {
   debuginfod_find_metadata;
 } ELFUTILS_0.188;
+ELFUTILS_0.195 {
+  debuginfod_default_progressfn;
+} ELFUTILS_0.192;
diff --git a/doc/debuginfod_default_progressfn.3 b/doc/debuginfod_default_progressfn.3
new file mode 100644 (file)
index 0000000..1627993
--- /dev/null
@@ -0,0 +1 @@
+.so man3/debuginfod_find_debuginfo.3
index 589a2c2b63b461e074ef2a6f466b8f591285406b..ab7fc09e6807178981e963e1b0483391d9b3ac32 100644 (file)
@@ -57,9 +57,11 @@ LOOKUP FUNCTIONS
 OPTIONAL FUNCTIONS
 
 .BI "typedef int (*debuginfod_progressfn_t)(debuginfod_client *" client ","
-.BI "                                       long a, long b);"
+.BI "                                       long " a ", long " b ");"
 .BI "void debuginfod_set_progressfn(debuginfod_client *" client ","
 .BI "                               debuginfod_progressfn_t " progressfn ");"
+.BI "int debuginfod_default_progressfn(debuginfod_client *" client ","
+.BI "                                  long " a ", long " b ");"
 .BI "void debuginfod_set_verbose_fd(debuginfod_client *" client ","
 .BI "                               int " fd ");"
 .BI "void debuginfod_set_user_data(debuginfod_client *" client ","
@@ -177,6 +179,17 @@ 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.
 
+.BR debuginfod_default_progressfn ()
+is the progress callback function set by the debuginfod client library
+when the
+.B DEBUGINFOD_PROGRESS
+environment variable is set and no progressfn is explicitly set. For more
+information see
+.B DEBUGINFOD_PROGRESS
+below. Custom progress callback functions may call
+.BR debuginfod_default_progressfn ()
+directly to report download status.
+
 .SS "VERBOSE OUTPUT"
 
 The \fBdebuginfod_find_*\fP() functions may use several techniques