mirror of
https://github.com/clearlinux/clr-debug-info.git
synced 2026-09-06 13:51:38 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
670069d659 | ||
|
|
be74f893e6 | ||
|
|
7a5e4a9acd | ||
|
|
07a4c3d305 | ||
|
|
ab0e59628f | ||
|
|
af4a3f64f0 | ||
|
|
8c65e96479 | ||
|
|
7ea9a50b19 | ||
|
|
e16ab76926 | ||
|
|
090cb27a34 | ||
|
|
cbaf943fca | ||
|
|
32ae400e7d | ||
|
|
82f03f8e22 | ||
|
|
c1f45d9f3c |
@@ -4,10 +4,12 @@ clr_debug_fuse
|
|||||||
clr_debug_daemon
|
clr_debug_daemon
|
||||||
clr_debug_prepare
|
clr_debug_prepare
|
||||||
.deps/
|
.deps/
|
||||||
|
.dirstamp
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
autom4te.cache/
|
autom4te.cache/
|
||||||
|
compile
|
||||||
config.h
|
config.h
|
||||||
config.h.in
|
config.h.in
|
||||||
config.log
|
config.log
|
||||||
@@ -18,3 +20,5 @@ install-sh
|
|||||||
missing
|
missing
|
||||||
stamp-h1
|
stamp-h1
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
|
tags
|
||||||
|
cscope.*
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
EXTRA_DIST = COPYING clr_debug_fuse.service clr_debug_daemon.service debuginfo.conf
|
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
|
bin_PROGRAMS = clr_debug_fuse clr_debug_daemon clr_debug_prepare
|
||||||
|
|
||||||
clr_debug_fuse_SOURCES = src/fuse.c src/client.c
|
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.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_PREREQ([2.66])
|
AC_PREREQ([2.66])
|
||||||
AC_INIT(clr-debug-info, 11, arjan@linux.intel.com)
|
AC_INIT(clr-debug-info, 30, arjan@linux.intel.com)
|
||||||
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
|
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
@@ -13,11 +13,19 @@ PKG_CHECK_MODULES([curl], [libcurl])
|
|||||||
PKG_CHECK_MODULES([fuse], [fuse])
|
PKG_CHECK_MODULES([fuse], [fuse])
|
||||||
PKG_CHECK_MODULES([SYSTEMD], [systemd])
|
PKG_CHECK_MODULES([SYSTEMD], [systemd])
|
||||||
|
|
||||||
tmpfilesdir=`pkg-config --variable tmpfilesdir systemd`
|
dir=""
|
||||||
AC_SUBST(tmpfilesdir)
|
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`
|
dir=""
|
||||||
AC_SUBST(systemdsystemunitdir)
|
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_CONFIG_FILES([Makefile])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ Original copyright notice follows:
|
|||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <fuse.h>
|
#include <fuse.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|||||||
+30
-7
@@ -41,9 +41,9 @@
|
|||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
GStaticMutex dupes_mutex = G_STATIC_MUTEX_INIT;
|
static GMutex dupes_mutex;
|
||||||
|
|
||||||
char *urls[2] = {"http://debuginfo.clearlinux.org/debuginfo/", "http://debuginfo.fenrus.org/debuginfo/" };
|
char *urls[2] = {"https://debuginfo.clearlinux.org/debuginfo/", "https://debuginfo.clearlinux.org/debuginfo/" };
|
||||||
int urlcounter = 1;
|
int urlcounter = 1;
|
||||||
|
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ static int avoid_dupes(const char *url)
|
|||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
void *value;
|
void *value;
|
||||||
g_static_mutex_lock(&dupes_mutex);
|
g_mutex_lock(&dupes_mutex);
|
||||||
|
|
||||||
if (hash == NULL)
|
if (hash == NULL)
|
||||||
hash = g_hash_table_new(g_str_hash, g_str_equal);
|
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_hash_table_replace(hash, strdup(url), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_static_mutex_unlock(&dupes_mutex);
|
g_mutex_unlock(&dupes_mutex);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +122,13 @@ static int curl_get_file(const char *url, const char *prefix, time_t timestamp)
|
|||||||
fflush(file);
|
fflush(file);
|
||||||
// printf("HTTP return code is %i\n", ret);
|
// 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++;
|
urlcounter++;
|
||||||
|
|
||||||
if (ret == 200) {
|
if (ret == 200) {
|
||||||
@@ -191,6 +197,14 @@ static void *server_thread(void *arg)
|
|||||||
*path = 0;
|
*path = 0;
|
||||||
path++;
|
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, ";")) {
|
if (strstr(path, "..") || strstr(prefix, "..") || strstr(path, "'") || strstr(path, ";")) {
|
||||||
close(fd);
|
close(fd);
|
||||||
@@ -211,8 +225,17 @@ static void *server_thread(void *arg)
|
|||||||
// printf("Getting url %s %i:%06i\n", url, before.tv_sec, before.tv_usec);
|
// printf("Getting url %s %i:%06i\n", url, before.tv_sec, before.tv_usec);
|
||||||
ret = curl_get_file(url, prefix, timestamp);
|
ret = curl_get_file(url, prefix, timestamp);
|
||||||
|
|
||||||
if (ret != 200)
|
switch (ret) {
|
||||||
printf("Request for %s resulted in error %i\n", url, ret);
|
case 200:
|
||||||
|
case 300:
|
||||||
|
case 304:
|
||||||
|
case 404:
|
||||||
|
// ignore these error codes
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("Request for %s resulted in error %i\n", url, ret);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
gettimeofday(&after, NULL);
|
gettimeofday(&after, NULL);
|
||||||
if (timedelta(before, after) > 0.6)
|
if (timedelta(before, after) > 0.6)
|
||||||
|
|||||||
Reference in New Issue
Block a user