aboutsummaryrefslogtreecommitdiff
path: root/sysutils/mcelog
diff options
context:
space:
mode:
authorChris Rees <crees@FreeBSD.org>2012-09-25 19:30:36 +0000
committerChris Rees <crees@FreeBSD.org>2012-09-25 19:30:36 +0000
commitfd2c7f38fad9cb53df117faf54613b056785087e (patch)
tree6b7fc62318e7f7b56309106c9ed151804e2ab513 /sysutils/mcelog
parentfbde072cb7cba70d94e72e445a9738aaee8edc71 (diff)
downloadports-fd2c7f38fad9cb53df117faf54613b056785087e.tar.gz
ports-fd2c7f38fad9cb53df117faf54613b056785087e.zip
Notes
Diffstat (limited to 'sysutils/mcelog')
-rw-r--r--sysutils/mcelog/Makefile2
-rw-r--r--sysutils/mcelog/distinfo4
-rw-r--r--sysutils/mcelog/files/patch-Makefile15
-rw-r--r--sysutils/mcelog/files/patch-config.c19
-rw-r--r--sysutils/mcelog/files/patch-eventloop.c22
-rw-r--r--sysutils/mcelog/files/patch-intel.c27
-rw-r--r--sysutils/mcelog/files/patch-mcelog.c81
-rw-r--r--sysutils/mcelog/files/patch-server.c17
-rw-r--r--sysutils/mcelog/pkg-descr9
-rw-r--r--sysutils/mcelog/pkg-message15
10 files changed, 132 insertions, 79 deletions
diff --git a/sysutils/mcelog/Makefile b/sysutils/mcelog/Makefile
index 02cf7e25966c..18927a0c630f 100644
--- a/sysutils/mcelog/Makefile
+++ b/sysutils/mcelog/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= mcelog
-DISTVERSION= 1.0pre2
+DISTVERSION= 1.0pre3
CATEGORIES= sysutils
MASTER_SITES= ftp://ftp.kernel.org/pub/linux/utils/cpu/mce/ \
http://147.52.159.12/mirrors/ftp.kernel.org/pub/linux/utils/cpu/mce/ \
diff --git a/sysutils/mcelog/distinfo b/sysutils/mcelog/distinfo
index 9da29a94e70b..590732aa091c 100644
--- a/sysutils/mcelog/distinfo
+++ b/sysutils/mcelog/distinfo
@@ -1,2 +1,2 @@
-SHA256 (mcelog-1.0pre2.tar.gz) = 39bec2a19e2548afe9dbc80f6f9dcee6664fffa7ccc142aeb5e1f8c217c1705c
-SIZE (mcelog-1.0pre2.tar.gz) = 174553
+SHA256 (mcelog-1.0pre3.tar.gz) = 0782e0aa952fa4bd641071e6b501774a63993a813a4f494ffd7819521a13c50c
+SIZE (mcelog-1.0pre3.tar.gz) = 176649
diff --git a/sysutils/mcelog/files/patch-Makefile b/sysutils/mcelog/files/patch-Makefile
index 96fa1ad39bdd..619bc29bd757 100644
--- a/sysutils/mcelog/files/patch-Makefile
+++ b/sysutils/mcelog/files/patch-Makefile
@@ -1,5 +1,5 @@
---- ./Makefile.orig 2009-12-15 07:18:40.000000000 -0500
-+++ ./Makefile 2011-10-14 22:36:47.000000000 -0400
+--- Makefile.orig 2010-01-20 18:36:52.000000000 -0800
++++ Makefile 2012-09-22 01:50:21.019688386 -0700
@@ -1,5 +1,5 @@
CFLAGS := -g -Os
-prefix := /usr
@@ -7,7 +7,7 @@
etcprefix :=
# Define appropiately for your distribution
# DOCDIR := /usr/share/doc/packages/mcelog
-@@ -28,10 +28,18 @@
+@@ -28,11 +28,18 @@
.PHONY: install clean depend
@@ -15,9 +15,10 @@
OBJ := p4.o k8.o mcelog.o dmi.o tsc.o core2.o bitfield.o intel.o \
nehalem.o dunnington.o tulsa.o config.o memutil.o msg.o \
- eventloop.o leaky-bucket.o memdb.o server.o trigger.o \
-- client.o cache.o sysfs.o yellow.o page.o rbtree.o
+- client.o cache.o sysfs.o yellow.o page.o rbtree.o \
+- xeon75xx.o
+ eventloop.o leaky-bucket.o memdb.o server.o client.o \
-+ cache.o rbtree.o
++ cache.o rbtree.o xeon75xx.o
+ifndef FREEBSD
+OBJ += page.o trigger.o sysfs.o yellow.o
+endif
@@ -28,7 +29,7 @@
DISKDB_OBJ := diskdb.o dimm.o db.o
CLEAN := mcelog dmi tsc dbquery .depend .depend.X dbquery.o ${DISKDB_OBJ}
DOC := mce.pdf
-@@ -47,7 +55,7 @@
+@@ -48,7 +55,7 @@
SRC := $(OBJ:.o=.c)
@@ -37,7 +38,7 @@
# dbquery intentionally not installed by default
install: mcelog
-@@ -81,8 +89,6 @@
+@@ -82,8 +89,6 @@
.depend: ${SRC}
${CC} -MM -I. ${SRC} > .depend.X && mv .depend.X .depend
diff --git a/sysutils/mcelog/files/patch-config.c b/sysutils/mcelog/files/patch-config.c
index d8f716f9b1bb..1819629335be 100644
--- a/sysutils/mcelog/files/patch-config.c
+++ b/sysutils/mcelog/files/patch-config.c
@@ -1,5 +1,5 @@
---- ./config.c.orig 2009-12-15 07:18:40.000000000 -0500
-+++ ./config.c 2011-10-14 22:36:47.000000000 -0400
+--- config.c.orig 2010-01-20 18:36:52.000000000 -0800
++++ config.c 2012-09-22 02:32:52.718116009 -0700
@@ -18,6 +18,9 @@
Author: Andi Kleen
*/
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-@@ -126,6 +129,21 @@
+@@ -127,6 +130,21 @@
return s;
}
@@ -32,3 +32,16 @@
int parse_config_file(const char *fn)
{
FILE *f;
+@@ -304,7 +322,12 @@
+ s = config_string(header, name);
+ if (s) {
+ /* no $PATH */
++#ifdef __Linux_
+ if (trigger_check(s) != 0) {
++#endif
++#ifdef __FreeBSD__
++ if (access(s, R_OK|X_OK) != 0) {
++#endif
+ SYSERRprintf("Trigger `%s' not executable\n", s);
+ exit(1);
+ }
diff --git a/sysutils/mcelog/files/patch-eventloop.c b/sysutils/mcelog/files/patch-eventloop.c
index e9d47c4640cc..4a424eb0831e 100644
--- a/sysutils/mcelog/files/patch-eventloop.c
+++ b/sysutils/mcelog/files/patch-eventloop.c
@@ -1,5 +1,5 @@
---- ./eventloop.c.orig 2009-12-15 07:18:40.000000000 -0500
-+++ ./eventloop.c 2011-10-14 22:36:47.000000000 -0400
+--- eventloop.c.orig 2010-01-20 18:36:52.000000000 -0800
++++ eventloop.c 2012-09-22 02:25:13.281116126 -0700
@@ -38,7 +38,9 @@
static struct pollfd pollfds[MAX_POLLFD];
static struct pollcb pollcbs[MAX_POLLFD];
@@ -18,17 +18,25 @@
int event_signal(int sig)
{
static int first = 1;
-@@ -111,11 +114,17 @@
- return -1;
- return 0;
- }
+@@ -126,17 +129,25 @@
+
+ static int (*ppoll_vec)(struct pollfd *, nfds_t, const struct timespec
+ *, const sigset_t *);
+#endif
void eventloop(void)
{
++#ifdef __Linux__
+ #if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 5 || __GLIBC__ > 2
+ ppoll_vec = ppoll;
+ #endif
+ if (!ppoll_vec)
+ ppoll_vec = ppoll_fallback;
++#endif
+
for (;;) {
+#ifdef __Linux__
- int n = ppoll(pollfds, max_pollfd, NULL, &event_sigs);
+ int n = ppoll_vec(pollfds, max_pollfd, NULL, &event_sigs);
+#endif
+#ifdef __FreeBSD__
+ int n = poll(pollfds, max_pollfd, -1);
diff --git a/sysutils/mcelog/files/patch-intel.c b/sysutils/mcelog/files/patch-intel.c
index 50ba80932891..382f20b4158f 100644
--- a/sysutils/mcelog/files/patch-intel.c
+++ b/sysutils/mcelog/files/patch-intel.c
@@ -1,21 +1,30 @@
---- ./intel.c.orig 2009-12-15 07:18:40.000000000 -0500
-+++ ./intel.c 2011-10-14 22:36:47.000000000 -0400
-@@ -38,7 +38,7 @@
+--- intel.c.orig 2010-01-20 18:36:52.000000000 -0800
++++ intel.c 2012-09-22 01:58:40.204115724 -0700
+@@ -43,7 +43,7 @@
return CPU_CORE2;
else if (model == 0x1d)
return CPU_DUNNINGTON;
- else if (model == 0x1a)
+ else if (model == 0x1a || model == 0x2c) /* Nehalem/Westmere */
return CPU_NEHALEM;
-
- if (model >= 0x1a)
-@@ -79,7 +79,9 @@
+ else if (model == 0x2e)
+ return CPU_XEON75XX;
+@@ -94,14 +94,18 @@
+ if (recordlen > offsetof(struct mce, mcgcap) && m->mcgcap & MCG_CMCI_P)
corr_err_cnt = EXTRACT(m->status, 38, 52);
- memory_error(m, channel, dimm, corr_err_cnt, recordlen);
+ memory_error(m, channel[0], dimm[0], corr_err_cnt, recordlen);
++#ifdef __Linux__
+ account_page_error(m, channel[0], dimm[0]);
++#endif
+ /*
+ * When both DIMMs have a error account the error twice to the page.
+ */
+ if (channel[1] != -1) {
+ memory_error(m, channel[1], dimm[1], corr_err_cnt, recordlen);
+#ifdef __Linux__
- account_page_error(m, channel, dimm, corr_err_cnt);
+ account_page_error(m, channel[1], dimm[1]);
+#endif
+ }
return 1;
- }
diff --git a/sysutils/mcelog/files/patch-mcelog.c b/sysutils/mcelog/files/patch-mcelog.c
index b70bdc8bc416..e7bd47b26991 100644
--- a/sysutils/mcelog/files/patch-mcelog.c
+++ b/sysutils/mcelog/files/patch-mcelog.c
@@ -1,12 +1,13 @@
---- ./mcelog.c.orig 2009-12-15 07:18:40.000000000 -0500
-+++ ./mcelog.c 2011-10-14 22:37:22.000000000 -0400
-@@ -20,8 +20,21 @@
+--- mcelog.c.orig 2010-01-20 18:36:52.000000000 -0800
++++ mcelog.c 2012-09-22 02:34:19.182116917 -0700
+@@ -20,9 +20,22 @@
#define _GNU_SOURCE 1
#include <sys/fcntl.h>
#include <sys/ioctl.h>
+#ifdef __Linux__
#include <asm/types.h>
#include <asm/ioctls.h>
+ #include <linux/limits.h>
+#endif
+#ifdef __FreeBSD__
+#include <sys/types.h>
@@ -22,22 +23,22 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-@@ -57,9 +70,25 @@
+@@ -58,9 +71,25 @@
#include "yellow.h"
#include "page.h"
+struct mca_record {
-+ uint64_t mr_status;
-+ uint64_t mr_addr;
-+ uint64_t mr_misc;
-+ uint64_t mr_tsc;
-+ int mr_apic_id;
-+ int mr_bank;
-+ uint64_t mr_mcg_cap;
-+ uint64_t mr_mcg_status;
-+ int mr_cpu_id;
-+ int mr_cpu_vendor_id;
-+ int mr_cpu;
++ uint64_t mr_status;
++ uint64_t mr_addr;
++ uint64_t mr_misc;
++ uint64_t mr_tsc;
++ int mr_apic_id;
++ int mr_bank;
++ uint64_t mr_mcg_cap;
++ uint64_t mr_mcg_status;
++ int mr_cpu_id;
++ int mr_cpu_vendor_id;
++ int mr_cpu;
+};
+
enum cputype cputype = CPU_GENERIC;
@@ -48,7 +49,7 @@
int ignore_nodev;
int filter_bogus = 1;
-@@ -70,12 +99,18 @@
+@@ -71,12 +100,18 @@
int dump_raw_ascii;
int daemon_mode;
static char *inputfile;
@@ -67,7 +68,7 @@
static void check_cpu(void);
-@@ -388,6 +423,7 @@
+@@ -393,6 +428,7 @@
Wprintf("\n");
}
@@ -75,7 +76,7 @@
void check_cpu(void)
{
enum {
-@@ -455,7 +491,44 @@
+@@ -460,7 +496,45 @@
} else
Eprintf("warning: Cannot open /proc/cpuinfo\n");
}
@@ -92,6 +93,7 @@
+
+ if (checked)
+ return;
++
+ checked = 1;
+
+ do_cpuid(0, regs);
@@ -104,23 +106,23 @@
+ cpu_id = regs[0];
+ family = CPUID_TO_FAMILY(cpu_id);
+ model = CPUID_TO_MODEL(cpu_id);
-
-+ if (cpu_forced)
++
++ if (cpu_forced)
+ ;
-+ else if (!strcmp(vendor,"AuthenticAMD") &&
++ else if (!strcmp(vendor,"AuthenticAMD") &&
+ (family == 15 || family == 16 || family == 17))
+ cputype = CPU_K8;
+ else if (!strcmp(vendor,"GenuineIntel"))
+ cputype = select_intel_cputype(family, model);
-+ /* Add checks for other CPUs here */
++ /* Add checks for other CPUs here */
+}
+#endif
-+
+
+#ifdef __Linux__
static char *skipspace(char *s)
{
while (isspace(*s))
-@@ -479,6 +552,7 @@
+@@ -484,6 +558,7 @@
}
return skipspace(s);
}
@@ -128,15 +130,15 @@
static void dump_mce_final(struct mce *m, char *symbol, int missing, int recordlen,
int dseen)
-@@ -501,6 +575,7 @@
- if (recordlen < endof_field(struct mce, f)) \
+@@ -507,6 +582,7 @@
recordlen = endof_field(struct mce, f)
-+#ifdef __Linux__
/* Decode ASCII input for fatal messages */
++#ifdef __Linux__
static void decodefatal(FILE *inf)
{
-@@ -646,6 +721,227 @@
+ struct mce m;
+@@ -651,6 +727,227 @@
if (data)
dump_mce_final(&m, symbol, missing, recordlen, disclaimer_seen);
}
@@ -364,18 +366,18 @@
static void remove_pidfile(void)
{
-@@ -686,6 +982,10 @@
+@@ -709,6 +1006,10 @@
" mcelog [options] --ascii < log\n"
" mcelog [options] --ascii --file log\n"
"Decode machine check ASCII output from kernel logs\n"
-+#ifdef __FreeBSD__
++#ifdef __FreeBSD_
+" mcelog [options] -M vmcore -N kernel\n"
+"Decode machine check error records from kernel crashdump.\n"
+#endif
"Options:\n"
"--cpu CPU Set CPU type CPU to decode (see below for valid types)\n"
"--cpumhz MHZ Set CPU Mhz to decode time (output unreliable, not needed on new kernels)\n"
-@@ -866,6 +1166,14 @@
+@@ -889,6 +1190,14 @@
case O_CONFIG_FILE:
/* parsed in config.c */
break;
@@ -390,7 +392,7 @@
case 0:
break;
default:
-@@ -900,8 +1208,10 @@
+@@ -923,8 +1232,10 @@
static void general_setup(void)
{
@@ -401,7 +403,7 @@
config_cred("global", "run-credentials", &runcred);
if (config_bool("global", "filter-memory-errors") == 1)
filter_memory_errors = 1;
-@@ -924,6 +1234,7 @@
+@@ -947,6 +1258,7 @@
}
}
@@ -409,7 +411,7 @@
static void process(int fd, unsigned recordlen, unsigned loglen, char *buf)
{
int i;
-@@ -964,6 +1275,173 @@
+@@ -987,6 +1299,173 @@
if (finish)
exit(0);
}
@@ -583,7 +585,7 @@
static void noargs(int ac, char **av)
{
-@@ -1022,22 +1500,30 @@
+@@ -1045,22 +1524,30 @@
char *buf;
};
@@ -607,16 +609,15 @@
parse_config(av);
-- while ((opt = getopt_long(ac, av, "", options, NULL)) != -1) {
+#ifdef __FreeBSD__
-+ while ((opt = getopt_long(ac, av, "M:N:", options, NULL)) != -1) {
++ while ((opt = getopt_long(ac, av, "M:N:", options, NULL)) != -1) {
+#else
-+ while ((opt = getopt_long(ac, av, "", options, NULL)) != -1) {
+ while ((opt = getopt_long(ac, av, "", options, NULL)) != -1) {
+#endif
if (opt == '?') {
usage();
} else if (combined_modifier(opt) > 0) {
-@@ -1057,13 +1543,21 @@
+@@ -1080,13 +1567,21 @@
} else if (opt == 0)
break;
}
@@ -638,7 +639,7 @@
fd = open(logfn, O_RDONLY);
if (fd < 0) {
if (ignore_nodev)
-@@ -1078,24 +1572,39 @@
+@@ -1101,24 +1596,39 @@
err("MCE_GET_LOG_LEN");
d.buf = xalloc(d.recordlen * d.loglen);
diff --git a/sysutils/mcelog/files/patch-server.c b/sysutils/mcelog/files/patch-server.c
index 372265eb3282..4b2107c2aa72 100644
--- a/sysutils/mcelog/files/patch-server.c
+++ b/sysutils/mcelog/files/patch-server.c
@@ -1,5 +1,5 @@
---- ./server.c.orig 2009-12-15 07:18:40.000000000 -0500
-+++ ./server.c 2011-10-14 22:36:47.000000000 -0400
+--- server.c.orig 2010-01-20 18:36:52.000000000 -0800
++++ server.c 2012-09-22 02:39:04.991117023 -0700
@@ -101,7 +101,9 @@
static void dispatch_pages(FILE *fh)
@@ -77,3 +77,16 @@
cc = xalloc(sizeof(struct clientcon));
if (register_pollcb(nfd, POLLIN, client_event, cc) < 0) {
+@@ -300,7 +336,12 @@
+ sigaction(SIGALRM, &sa, &oldsa);
+ if (sigsetjmp(ping_timeout_ctx, 1) == 0) {
+ alarm(initial_ping_timeout);
++#ifdef __Linux__
+ if (connect(fd, un, sizeof(struct sockaddr_un)) < 0)
++#endif
++#ifdef __FreeBSD__
++ if (connect(fd, (struct sockaddr *) un, sizeof(struct sockaddr_un)) < 0)
++#endif
+ goto cleanup;
+ if (write(fd, PAIR("ping\n")) < 0)
+ goto cleanup; \ No newline at end of file
diff --git a/sysutils/mcelog/pkg-descr b/sysutils/mcelog/pkg-descr
index 53655b16adb8..c87e691716d2 100644
--- a/sysutils/mcelog/pkg-descr
+++ b/sysutils/mcelog/pkg-descr
@@ -4,9 +4,12 @@ produces human-readable output.
This software is heavily patched to work on FreeBSD systems,
and thus provides an extremely limited subset of features as
-of this writing. The primary purpose is to provide a way to
-decode MCE output from the FreeBSD kernel into something more
-human-readable using the command 'mcelog --no-dmi --ascii'
+of this writing (for example, daemon mode is not currently
+supported).
+
+The primary purpose is to provide a way to decode MCE output
+from the FreeBSD kernel into something more human-readable
+using the command 'mcelog --no-dmi --ascii'.
FreeBSD conversion patches were originally written by John
Baldwin <jhb@freebsd.org> and later incorporated into this
diff --git a/sysutils/mcelog/pkg-message b/sysutils/mcelog/pkg-message
index 80710e89cfd8..35c5d5d52aa1 100644
--- a/sysutils/mcelog/pkg-message
+++ b/sysutils/mcelog/pkg-message
@@ -1,7 +1,12 @@
-=================================================
-You can decode MCE output from the FreeBSD kernel
-by using the following command:
+======================================================
+You can decode MCE output from the FreeBSD kernel by
+using the following command:
-mcelog --no-dmi --ascii --file /path/to/log
+ mcelog --no-dmi --ascii --file /path/to/log
-=================================================
+Or if you wish to paste the MCE via stdin:
+
+ mcelog --no-dmi --ascii
+ {...paste MCE and send EOF/press Ctrl-D...}
+
+======================================================