git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Usermode/libc - Minor fix to memmove
[tpg/acess2.git]
/
Tools
/
nativelib
/
logging.c
diff --git
a/Tools/nativelib/logging.c
b/Tools/nativelib/logging.c
index
0cb3ed3
..
16e6f70
100644
(file)
--- a/
Tools/nativelib/logging.c
+++ b/
Tools/nativelib/logging.c
@@
-1,5
+1,9
@@
/*
/*
- *
+ * Acess2 libnative (Kernel Simulation Library)
+ * - By John Hodge (thePowersGang)
+ *
+ * logging.c
+ * - Logging functions
*/
#include <stdio.h>
#include <stdarg.h>
*/
#include <stdio.h>
#include <stdarg.h>
@@
-8,22
+12,33
@@
#include <acess_logging.h>
#include <ctype.h>
#include <inttypes.h>
#include <acess_logging.h>
#include <ctype.h>
#include <inttypes.h>
+#include <shortlock.h>
-#define LOGHDR(col,type) fprintf(stderr, "\e["col"m[%-8.8s]"type" ", Ident)
+extern int Threads_GetTID();
+
+#define LOGHDR(col,type) fprintf(stderr, "\e["col"m[%-8.8s]"type"%2i ", Ident, Threads_GetTID())
#define LOGTAIL() fprintf(stderr, "\e[0m\n")
#define PUTERR(col,type) {\
#define LOGTAIL() fprintf(stderr, "\e[0m\n")
#define PUTERR(col,type) {\
+ if(!gbThreadInLog) SHORTLOCK(&glDebugLock); \
+ gbThreadInLog ++; \
LOGHDR(col,type);\
va_list args; va_start(args, Message);\
vfprintf(stderr, Message, args);\
va_end(args);\
LOGTAIL();\
LOGHDR(col,type);\
va_list args; va_start(args, Message);\
vfprintf(stderr, Message, args);\
va_end(args);\
LOGTAIL();\
+ gbThreadInLog --; \
+ if(!gbThreadInLog) SHORTREL(&glDebugLock); \
}
}
+// === GLOBALS ===
+int __thread gbThreadInLog;
+tShortSpinlock glDebugLock;
+
// === CODE ===
void Log_KernelPanic(const char *Ident, const char *Message, ...) {
PUTERR("35", "k")
// === CODE ===
void Log_KernelPanic(const char *Ident, const char *Message, ...) {
PUTERR("35", "k")
-
abort(
);
+
exit(-1
);
}
void Log_Panic(const char *Ident, const char *Message, ...)
PUTERR("34", "p")
}
void Log_Panic(const char *Ident, const char *Message, ...)
PUTERR("34", "p")
@@
-38,6
+53,11
@@
void Log_Log(const char *Ident, const char *Message, ...)
void Log_Debug(const char *Ident, const char *Message, ...)
PUTERR("37", "d")
void Log_Debug(const char *Ident, const char *Message, ...)
PUTERR("37", "d")
+void Panic(const char *Message, ...) {
+ const char *Ident = "";
+ PUTERR("35", "k")
+ exit(-1);
+}
void Warning(const char *Message, ...) {
const char *Ident = "";
PUTERR("33", "W")
void Warning(const char *Message, ...) {
const char *Ident = "";
PUTERR("33", "W")
UCC
git Repository :: git.ucc.asn.au