summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2019-08-18 19:56:57 -0400
committerFrank Ch. Eigler <fche@redhat.com>2019-08-18 19:56:57 -0400
commit54df42825ff0f44659c64cba18b0dbb0cfbd449c (patch)
tree561c5dbde6c463712d7a2edce5945e3a886ad058
parent8a9cce63efdc5d8bf8119f8eef2882400a5faf19 (diff)
downloadelfutils-dbgserver.pre20190819.tar.gz
dbgserver: document controlling env vars as macros in -client.hdbgserver.pre20190819
-rw-r--r--dbgserver/dbgserver-client.c6
-rw-r--r--dbgserver/dbgserver-client.h44
-rw-r--r--dbgserver/dbgserver-find.c3
-rw-r--r--dbgserver/dbgserver.cxx2
4 files changed, 49 insertions, 6 deletions
diff --git a/dbgserver/dbgserver-client.c b/dbgserver/dbgserver-client.c
index 07ff6076..10c609cc 100644
--- a/dbgserver/dbgserver-client.c
+++ b/dbgserver/dbgserver-client.c
@@ -59,16 +59,16 @@ static const time_t cache_clean_default_interval_s = 600;
/* Location of the cache of files downloaded from dbgservers.
The default parent directory is $HOME, or '/' if $HOME doesn't exist. */
static const char *cache_default_name = ".dbgserver_client_cache";
-static const char *cache_path_envvar = "DBGSERVER_CACHE_PATH";
+static const char *cache_path_envvar = DBGSERVER_CACHE_PATH_ENV_VAR;
/* URLs of dbgservers, separated by url_delim.
This env var must be set for dbgserver-client to run. */
-static const char *server_urls_envvar = "DBGSERVER_URLS";
+static const char *server_urls_envvar = DBGSERVER_URLS_ENV_VAR;
static const char *url_delim = " ";
/* Timeout for dbgservers, in seconds.
This env var must be set for dbgserver-client to run. */
-static const char *server_timeout_envvar = "DBGSERVER_TIMEOUT";
+static const char *server_timeout_envvar = DBGSERVER_TIMEOUT_ENV_VAR;
static int server_timeout = 5;
diff --git a/dbgserver/dbgserver-client.h b/dbgserver/dbgserver-client.h
index 29b97ee1..2d0342e6 100644
--- a/dbgserver/dbgserver-client.h
+++ b/dbgserver/dbgserver-client.h
@@ -1,3 +1,39 @@
+/* External declarations for the libdbgserver client library.
+ Copyright (C) 2019 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _LIBBGSERVER_CLIENT_H
+#define _LIBBGSERVER_CLIENT_H 1
+
+/* Names of environment variables that control the client logic. */
+#define DBGSERVER_URLS_ENV_VAR "DBGSERVER_URLS"
+#define DBGSERVER_CACHE_PATH_ENV_VAR "DBGSERVER_CACHE_PATH"
+#define DBGSERVER_TIMEOUT_ENV_VAR "DBGSERVER_TIMEOUT"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -8,7 +44,10 @@ extern "C" {
it is a binary blob of given legnth.
If successful, return a file descriptor to the target, otherwise
- return a posix error code. */
+ 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. */
+
int dbgserver_find_debuginfo (const unsigned char *build_id_bytes,
int build_id_len,
char **path);
@@ -25,3 +64,6 @@ int dbgserver_find_source (const unsigned char *build_id_bytes,
#ifdef __cplusplus
}
#endif
+
+
+#endif /* _LIBBGSERVER_CLIENT_H */
diff --git a/dbgserver/dbgserver-find.c b/dbgserver/dbgserver-find.c
index 3d25f33d..372aebe6 100644
--- a/dbgserver/dbgserver-find.c
+++ b/dbgserver/dbgserver-find.c
@@ -43,7 +43,8 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT;
/* Short description of program. */
-static const char doc[] = N_("Request debuginfo-related content from dbgservers listed in $DBGSERVER_URLS.");
+static const char doc[] = N_("Request debuginfo-related content "
+ "from dbgservers listed in $" DBGSERVER_URLS_ENV_VAR ".");
/* Strings for arguments in help texts. */
static const char args_doc[] = N_("debuginfo BUILDID\n"
diff --git a/dbgserver/dbgserver.cxx b/dbgserver/dbgserver.cxx
index b1706ad3..e3de9a21 100644
--- a/dbgserver/dbgserver.cxx
+++ b/dbgserver/dbgserver.cxx
@@ -2172,7 +2172,7 @@ main (int argc, char *argv[])
<< (d6 != NULL ? "IPv6 " : "")
<< "port=" << http_port << endl;
- const char* du = getenv("DBGSERVER_URLS");
+ const char* du = getenv(DBGSERVER_URLS_ENV_VAR);
if (du && du[0] != '\0') // set to non-empty string?
obatched(clog) << "Upstream dbgservers: " << du << endl;