aboutsummaryrefslogtreecommitdiffstats
path: root/init/log.c
diff options
context:
space:
mode:
authorturret <turret@duck.com>2023-12-18 16:13:36 -0600
committerturret <turret@duck.com>2023-12-18 16:13:36 -0600
commit54b308af97b91ceabb0a482f325d3a8595b01aa3 (patch)
treeadbe345bca29943f02f54c86dc1ec17d5aa3528a /init/log.c
parent22cacb4dc96faae8814a9696805314c0fcc455ba (diff)
downloaddiscord-bot-skeleton-54b308af97b91ceabb0a482f325d3a8595b01aa3.tar.gz
discord-bot-skeleton-54b308af97b91ceabb0a482f325d3a8595b01aa3.tar.bz2
discord-bot-skeleton-54b308af97b91ceabb0a482f325d3a8595b01aa3.zip
*: enforce 78 char line limit
Diffstat (limited to 'init/log.c')
-rw-r--r--init/log.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/init/log.c b/init/log.c
index aba141d..75840a2 100644
--- a/init/log.c
+++ b/init/log.c
@@ -8,7 +8,6 @@
#include <sys/syscall.h>
#include <sys/time.h>
#include <unistd.h>
-
#include <log.h>
#include <util.h>
@@ -72,7 +71,8 @@ static int vaprint(const char *fmt, va_list ap)
char tsbuf[64] = "\0";
struct timeval time;
gettimeofday(&time, NULL);
- snprintf(tsbuf, sizeof(tsbuf), "[%5ld.%06ld] ", (long)time.tv_sec % 100000, (long)time.tv_usec);
+ snprintf(tsbuf, sizeof(tsbuf), "[%5ld.%06ld] ",
+ (long)time.tv_sec % 100000, (long)time.tv_usec);
/* spin lock, at the cost of architecture portability
concurrency is something that we need to adjust for, and the
@@ -112,7 +112,9 @@ static int vaprint(const char *fmt, va_list ap)
return 0;
}
-void _panic(const char *fileorigin, const int lineorigin, const char *fmt, ...)
+void _panic(const char *fileorigin,
+ const int lineorigin,
+ const char *fmt, ...)
{
char mode = PANICMODE_DIE;
int pid = getpid();
@@ -132,7 +134,8 @@ void _panic(const char *fileorigin, const int lineorigin, const char *fmt, ...)
void **backtrace_addresses = malloc(sizeof(void*) * 32);
int backtrace_count = backtrace(backtrace_addresses, 32);
- char **backtrace_symbolnames = backtrace_symbols(backtrace_addresses, backtrace_count);
+ char **backtrace_symbolnames =
+ backtrace_symbols(backtrace_addresses, backtrace_count);
__asm__("_panic.spin_lock:");
__asm__("mov rax, 1");
@@ -141,16 +144,19 @@ void _panic(const char *fileorigin, const int lineorigin, const char *fmt, ...)
__asm__("jnz .spin_lock");
print(NOLOCK("5") "------------[ cut here ]------------");
- print(LOG_SOH "\7""0" "%s at %s:%d", mode_to_string[(int)mode], fileorigin, lineorigin);
+ print(LOG_SOH "\7""0" "%s at %s:%d", mode_to_string[(int)mode],
+ fileorigin, lineorigin);
vaprint(_fmt, ap);
print(LOG_SOH "\7""7" "Call Trace:");
for(int i = 0; i < backtrace_count; ++i) {
- print(NOLOCK("7") " [0x%016x] %s", backtrace_addresses[i], backtrace_symbolnames[i]);
+ print(NOLOCK("7") " [0x%016x] %s", backtrace_addresses[i],
+ backtrace_symbolnames[i]);
}
if(mainpid == pid){
print(NOLOCK("7") " <start of main thread>");
} else {
- print(NOLOCK("7") " <start of %s[%d]>", subsystem_get_name(pid), pid);
+ print(NOLOCK("7") " <start of %s[%d]>",
+ subsystem_get_name(pid), pid);
}
/* if we are going to die, we dont really need to clean up */