1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-31 14:36:39 +00:00

Changed crashcatcher's uname system info retrieval and cleaned indentation

This commit is contained in:
pvdk 2014-01-04 21:46:38 +01:00
parent 356b53bd22
commit 92234cf783

View file

@ -6,6 +6,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/ucontext.h> #include <sys/ucontext.h>
#include <sys/utsname.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
@ -54,18 +55,18 @@ static const struct {
const char *name; const char *name;
int signum; int signum;
} signals[] = { } signals[] = {
{ "Segmentation fault", SIGSEGV }, { "Segmentation fault", SIGSEGV },
{ "Illegal instruction", SIGILL }, { "Illegal instruction", SIGILL },
{ "FPU exception", SIGFPE }, { "FPU exception", SIGFPE },
{ "System BUS error", SIGBUS }, { "System BUS error", SIGBUS },
{ NULL, 0 } { NULL, 0 }
}; };
static const struct { static const struct {
int code; int code;
const char *name; const char *name;
} sigill_codes[] = { } sigill_codes[] = {
#ifndef __FreeBSD__ #ifndef __FreeBSD__
{ ILL_ILLOPC, "Illegal opcode" }, { ILL_ILLOPC, "Illegal opcode" },
{ ILL_ILLOPN, "Illegal operand" }, { ILL_ILLOPN, "Illegal operand" },
{ ILL_ILLADR, "Illegal addressing mode" }, { ILL_ILLADR, "Illegal addressing mode" },
@ -74,7 +75,7 @@ static const struct {
{ ILL_PRVREG, "Privileged register" }, { ILL_PRVREG, "Privileged register" },
{ ILL_COPROC, "Coprocessor error" }, { ILL_COPROC, "Coprocessor error" },
{ ILL_BADSTK, "Internal stack error" }, { ILL_BADSTK, "Internal stack error" },
#endif #endif
{ 0, NULL } { 0, NULL }
}; };
@ -97,10 +98,10 @@ static const struct {
int code; int code;
const char *name; const char *name;
} sigsegv_codes[] = { } sigsegv_codes[] = {
#ifndef __FreeBSD__ #ifndef __FreeBSD__
{ SEGV_MAPERR, "Address not mapped to object" }, { SEGV_MAPERR, "Address not mapped to object" },
{ SEGV_ACCERR, "Invalid permissions for mapped object" }, { SEGV_ACCERR, "Invalid permissions for mapped object" },
#endif #endif
{ 0, NULL } { 0, NULL }
}; };
@ -108,11 +109,11 @@ static const struct {
int code; int code;
const char *name; const char *name;
} sigbus_codes[] = { } sigbus_codes[] = {
#ifndef __FreeBSD__ #ifndef __FreeBSD__
{ BUS_ADRALN, "Invalid address alignment" }, { BUS_ADRALN, "Invalid address alignment" },
{ BUS_ADRERR, "Non-existent physical address" }, { BUS_ADRERR, "Non-existent physical address" },
{ BUS_OBJERR, "Object specific hardware error" }, { BUS_OBJERR, "Object specific hardware error" },
#endif #endif
{ 0, NULL } { 0, NULL }
}; };
@ -175,13 +176,17 @@ static void gdb_info(pid_t pid)
static void sys_info(void) static void sys_info(void)
{ {
#ifdef __unix__ #ifdef __unix__
system("echo \"System: `uname -a`\""); struct utsname info;
putchar('\n'); if(!uname(&info))
printf("!!! Failed to get system information\n");
else
printf("System: %s %s %s %s %s\n",
info.sysname, info.nodename, info.release, info.version, info.machine);
fflush(stdout); fflush(stdout);
#endif #endif
} }
static size_t safe_write(int fd, const void *buf, size_t len) static size_t safe_write(int fd, const void *buf, size_t len)
{ {
size_t ret = 0; size_t ret = 0;