diff options
author | Frank Ch. Eigler <fche@redhat.com> | 2023-04-11 23:35:25 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@redhat.com> | 2023-04-12 16:29:34 -0400 |
commit | 64242dcba918ae33dcefed495783bbe8c032f9d2 (patch) | |
tree | 1528ce14b189ebb2f5e8edb8cd005d31dd85cace /debuginfod/debuginfod.h.in | |
parent | 6e9718089b05403947d8255423a849d425305925 (diff) | |
download | elfutils-users/fche/try-pr29472e.tar.gz |
PR29472: debuginfod: add metadata query webapi, C api, clientusers/fche/try-pr29472e
This patch extends the debuginfod API with a "metadata query"
operation. It allows clients to request an enumeration of file names
known to debuginfod servers, returning a JSON response including the
matching buildids. This lets clients later download debuginfo for a
range of versions of the same named binaries, in case they need to to
prospective work (like systemtap-based live-patching). It also lets
server operators implement prefetch triggering operations for popular
but slow debuginfo slivers like kernel vdso.debug files on fedora.
Implementation requires a modern enough json-c library.
% debuginfod-find metadata file /bin/ls
% debuginfod-find metadata glob "/usr/local/bin/c*"
Documentation and testing are included.
Signed-off-by: Ryan Goldberg <rgoldber@redhat.com>
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
Diffstat (limited to 'debuginfod/debuginfod.h.in')
-rw-r--r-- | debuginfod/debuginfod.h.in | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/debuginfod/debuginfod.h.in b/debuginfod/debuginfod.h.in index 4a256ba9..3efa877a 100644 --- a/debuginfod/debuginfod.h.in +++ b/debuginfod/debuginfod.h.in @@ -62,9 +62,9 @@ debuginfod_client *debuginfod_begin (void); it is a binary blob of given length. If successful, return a file descriptor to the target, otherwise - return a posix error code. If successful, set *path to a - strdup'd copy of the name of the same file in the cache. - Caller must free() it later. */ + return a negative POSIX error code. If successful, set *path to a + strdup'd copy of the name of the same file in the cache. Caller + must free() it later. */ int debuginfod_find_debuginfo (debuginfod_client *client, const unsigned char *build_id, @@ -88,6 +88,18 @@ int debuginfod_find_section (debuginfod_client *client, const char *section, char **path); +/* Query the urls contained in $DEBUGINFOD_URLS for metadata + with given query key/value. + + If successful, return a file descriptor to the JSON document + describing matches, otherwise return a negative POSIX error code. If + successful, set *path to a strdup'd copy of the name of the same + file in the cache. Caller must free() it later. */ +int debuginfod_find_metadata (debuginfod_client *client, + const char *key, + const char* value, + char **path); + typedef int (*debuginfod_progressfn_t)(debuginfod_client *c, long a, long b); void debuginfod_set_progressfn(debuginfod_client *c, debuginfod_progressfn_t fn); |