mirror of
https://github.com/clearlinux/clr-debug-info.git
synced 2026-09-06 13:51:38 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07a4c3d305 | ||
|
|
ab0e59628f | ||
|
|
af4a3f64f0 | ||
|
|
8c65e96479 | ||
|
|
7ea9a50b19 | ||
|
|
e16ab76926 | ||
|
|
090cb27a34 | ||
|
|
cbaf943fca | ||
|
|
32ae400e7d | ||
|
|
82f03f8e22 |
@@ -4,10 +4,12 @@ clr_debug_fuse
|
||||
clr_debug_daemon
|
||||
clr_debug_prepare
|
||||
.deps/
|
||||
.dirstamp
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
compile
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
@@ -18,3 +20,5 @@ install-sh
|
||||
missing
|
||||
stamp-h1
|
||||
*.tar.gz
|
||||
tags
|
||||
cscope.*
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
EXTRA_DIST = COPYING clr_debug_fuse.service clr_debug_daemon.service debuginfo.conf
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = \
|
||||
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) \
|
||||
--with-systemdtmpfilesdir=$$dc_install_base/$(tmpfilesdir)
|
||||
|
||||
bin_PROGRAMS = clr_debug_fuse clr_debug_daemon clr_debug_prepare
|
||||
|
||||
clr_debug_fuse_SOURCES = src/fuse.c src/client.c
|
||||
|
||||
+13
-5
@@ -2,7 +2,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.66])
|
||||
AC_INIT(clr-debug-info, 11, arjan@linux.intel.com)
|
||||
AC_INIT(clr-debug-info, 22, arjan@linux.intel.com)
|
||||
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
|
||||
AM_SILENT_RULES([yes])
|
||||
AC_PROG_CC
|
||||
@@ -13,11 +13,19 @@ PKG_CHECK_MODULES([curl], [libcurl])
|
||||
PKG_CHECK_MODULES([fuse], [fuse])
|
||||
PKG_CHECK_MODULES([SYSTEMD], [systemd])
|
||||
|
||||
tmpfilesdir=`pkg-config --variable tmpfilesdir systemd`
|
||||
AC_SUBST(tmpfilesdir)
|
||||
dir=""
|
||||
AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
|
||||
[path to systemd system service dir @<:@default=/usr/lib/systemd/system@:>@]), [dir=${withval}],
|
||||
[dir="$($PKG_CONFIG --variable=systemdsystemunitdir systemd)"])
|
||||
test -z "${dir}" && dir=/usr/lib/systemd/system
|
||||
AC_SUBST(systemdsystemunitdir, [${dir}])
|
||||
|
||||
systemdsystemunitdir=`pkg-config --variable systemdsystemunitdir systemd`
|
||||
AC_SUBST(systemdsystemunitdir)
|
||||
dir=""
|
||||
AC_ARG_WITH([systemdtmpfilesdir], AS_HELP_STRING([--with-systemdtmpfilesdir=DIR],
|
||||
[path to systemd tmpfiles dir @<:@default=/usr/lib/tmpfiles.d@:>@]), [dir=${withval}],
|
||||
[dir="$($PKG_CONFIG --variable=tmpfilesdir systemd)"])
|
||||
test -z "${dir}" && dir=/usr/lib/tmpfiles.d
|
||||
AC_SUBST(tmpfilesdir, [${dir}])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -34,6 +34,7 @@ Original copyright notice follows:
|
||||
#include <malloc.h>
|
||||
#include <fuse.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
+18
-4
@@ -41,7 +41,7 @@
|
||||
#include <curl/curl.h>
|
||||
#include <glib.h>
|
||||
|
||||
GStaticMutex dupes_mutex = G_STATIC_MUTEX_INIT;
|
||||
static GMutex dupes_mutex;
|
||||
|
||||
char *urls[2] = {"https://debuginfo.clearlinux.org/debuginfo/", "http://debuginfo.fenrus.org/debuginfo/" };
|
||||
int urlcounter = 1;
|
||||
@@ -53,7 +53,7 @@ static int avoid_dupes(const char *url)
|
||||
{
|
||||
int retval = 0;
|
||||
void *value;
|
||||
g_static_mutex_lock(&dupes_mutex);
|
||||
g_mutex_lock(&dupes_mutex);
|
||||
|
||||
if (hash == NULL)
|
||||
hash = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
@@ -71,7 +71,7 @@ static int avoid_dupes(const char *url)
|
||||
g_hash_table_replace(hash, strdup(url), data);
|
||||
}
|
||||
|
||||
g_static_mutex_unlock(&dupes_mutex);
|
||||
g_mutex_unlock(&dupes_mutex);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,13 @@ static int curl_get_file(const char *url, const char *prefix, time_t timestamp)
|
||||
fflush(file);
|
||||
// printf("HTTP return code is %i\n", ret);
|
||||
|
||||
if (ret != 200 && ret != 404)
|
||||
/* HTTP 304 is returned if (a) the cached debuginfo has the same
|
||||
* timestamp or is newer than that on the server and (b) we haven't
|
||||
* already added the URL to the hash table. So, the first crash for a
|
||||
* boot may result in a 304 if the debuginfo had been downloaded in a
|
||||
* previous boot.
|
||||
*/
|
||||
if (ret != 200 && ret != 404 && ret != 304)
|
||||
urlcounter++;
|
||||
|
||||
if (ret == 200) {
|
||||
@@ -191,6 +197,14 @@ static void *server_thread(void *arg)
|
||||
*path = 0;
|
||||
path++;
|
||||
|
||||
/* GDB and elfutils both stat /usr/lib/debug directly when looking up
|
||||
* debuginfo, so avoid the download for "/.tar"; the associated cache
|
||||
* directories already exist by this point.
|
||||
*/
|
||||
if (strlen(path) == 1 && strcmp(path, "/") == 0) {
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strstr(path, "..") || strstr(prefix, "..") || strstr(path, "'") || strstr(path, ";")) {
|
||||
close(fd);
|
||||
|
||||
Reference in New Issue
Block a user