mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Improve logger API (#262)
This breaking change improves naming consistency. - Rename LOGF to INFOF - Rename recently introduced ANYF to LOGF - Remove V* log calls, as they are not being used
This commit is contained in:
parent
50937be752
commit
0584684a82
13 changed files with 174 additions and 261 deletions
|
@ -591,7 +591,7 @@ void plm_video_decode_sequence_header(plm_video_t *self) {
|
||||||
|
|
||||||
self->has_sequence_header = true;
|
self->has_sequence_header = true;
|
||||||
|
|
||||||
LOGF("%s:\n"
|
INFOF("%s:\n"
|
||||||
"\t%-20s = %15d;\n"
|
"\t%-20s = %15d;\n"
|
||||||
"\t%-20s = %15d;\n"
|
"\t%-20s = %15d;\n"
|
||||||
"\t%-20s = %15f;\n"
|
"\t%-20s = %15f;\n"
|
||||||
|
@ -1082,7 +1082,7 @@ static plm_frame_t *plm_video_decode_impl(plm_video_t *self) {
|
||||||
plm_frame_t *plm_video_decode(plm_video_t *self) {
|
plm_frame_t *plm_video_decode(plm_video_t *self) {
|
||||||
long double tsc;
|
long double tsc;
|
||||||
plm_frame_t *res;
|
plm_frame_t *res;
|
||||||
LOGF("plm_video_decode");
|
INFOF("plm_video_decode");
|
||||||
tsc = nowl();
|
tsc = nowl();
|
||||||
res = plm_video_decode_impl(self);
|
res = plm_video_decode_impl(self);
|
||||||
plmpegdecode_latency_ = lroundl((nowl() - tsc) * 1e6l);
|
plmpegdecode_latency_ = lroundl((nowl() - tsc) * 1e6l);
|
||||||
|
|
|
@ -73,7 +73,7 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
(LEVEL) <= __log_level)
|
(LEVEL) <= __log_level)
|
||||||
|
|
||||||
// log a message with the specified log level (not checking if LOGGABLE)
|
// log a message with the specified log level (not checking if LOGGABLE)
|
||||||
#define ANYF(LEVEL, FMT, ...) \
|
#define LOGF(LEVEL, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
++ftrace; \
|
++ftrace; \
|
||||||
flogf(LEVEL, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
flogf(LEVEL, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \
|
||||||
|
@ -114,7 +114,7 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define LOGF(FMT, ...) \
|
#define INFOF(FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (LOGGABLE(kLogInfo)) { \
|
if (LOGGABLE(kLogInfo)) { \
|
||||||
++ftrace; \
|
++ftrace; \
|
||||||
|
@ -150,15 +150,6 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define VFLOG(FMT, VA) \
|
|
||||||
do { \
|
|
||||||
if (LOGGABLE(kLogInfo)) { \
|
|
||||||
++ftrace; \
|
|
||||||
vflogf(kLogInfo, __FILE__, __LINE__, NULL, FMT, VA); \
|
|
||||||
--ftrace; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define FLOGF(F, FMT, ...) \
|
#define FLOGF(F, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (LOGGABLE(kLogInfo)) { \
|
if (LOGGABLE(kLogInfo)) { \
|
||||||
|
@ -168,24 +159,6 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define VFLOGF(F, FMT, VA) \
|
|
||||||
do { \
|
|
||||||
if (LOGGABLE(kLogInfo)) { \
|
|
||||||
++ftrace; \
|
|
||||||
vflogf(kLogInfo, __FILE__, __LINE__, F, FMT, VA); \
|
|
||||||
--ftrace; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define VWARNF(FMT, VA) \
|
|
||||||
do { \
|
|
||||||
if (LOGGABLE(kLogWarn)) { \
|
|
||||||
++ftrace; \
|
|
||||||
vflogf(kLogWarn, __FILE__, __LINE__, NULL, FMT, VA); \
|
|
||||||
--ftrace; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define FWARNF(F, FMT, ...) \
|
#define FWARNF(F, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (LOGGABLE(kLogWarn)) { \
|
if (LOGGABLE(kLogWarn)) { \
|
||||||
|
@ -195,22 +168,6 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define VFWARNF(F, FMT, VA) \
|
|
||||||
do { \
|
|
||||||
if (LOGGABLE(kLogWarn)) { \
|
|
||||||
++ftrace; \
|
|
||||||
vflogf(kLogWarn, __FILE__, __LINE__, F, FMT, VA); \
|
|
||||||
--ftrace; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define VFATALF(FMT, VA) \
|
|
||||||
do { \
|
|
||||||
++ftrace; \
|
|
||||||
vffatalf(kLogFatal, __FILE__, __LINE__, NULL, FMT, VA); \
|
|
||||||
unreachable; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define FFATALF(F, FMT, ...) \
|
#define FFATALF(F, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
++ftrace; \
|
++ftrace; \
|
||||||
|
@ -218,22 +175,6 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
unreachable; \
|
unreachable; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define VFFATALF(F, FMT, VA) \
|
|
||||||
do { \
|
|
||||||
++ftrace; \
|
|
||||||
vffatalf(kLogFatal, __FILE__, __LINE__, F, FMT, VA); \
|
|
||||||
unreachable; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define VDEBUGF(FMT, VA) \
|
|
||||||
do { \
|
|
||||||
if (UNLIKELY(LOGGABLE(kLogDebug))) { \
|
|
||||||
++ftrace; \
|
|
||||||
vfdebugf(kLogDebug, __FILE__, __LINE__, NULL, FMT, VA); \
|
|
||||||
--ftrace; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define FDEBUGF(F, FMT, ...) \
|
#define FDEBUGF(F, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (UNLIKELY(LOGGABLE(kLogDebug))) { \
|
if (UNLIKELY(LOGGABLE(kLogDebug))) { \
|
||||||
|
@ -243,33 +184,6 @@ extern unsigned __log_level; /* log level for runtime check */
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define VFVERBOSEF(F, FMT, VA) \
|
|
||||||
do { \
|
|
||||||
if (LOGGABLE(kLogVerbose)) { \
|
|
||||||
++ftrace; \
|
|
||||||
vfverbosef(kLogVerbose, __FILE__, __LINE__, F, FMT, VA); \
|
|
||||||
--ftrace; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define VFDEBUGF(F, FMT, VA) \
|
|
||||||
do { \
|
|
||||||
if (LOGGABLE(kLogDebug)) { \
|
|
||||||
++ftrace; \
|
|
||||||
vfdebugf(kLogDebug, __FILE__, __LINE__, F, FMT, VA); \
|
|
||||||
--ftrace; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define VNOISEF(FMT, VA) \
|
|
||||||
do { \
|
|
||||||
if (UNLIKELY(LOGGABLE(kLogNoise))) { \
|
|
||||||
++ftrace; \
|
|
||||||
vfnoisef(kLogNoise, __FILE__, __LINE__, NULL, FMT, VA); \
|
|
||||||
--ftrace; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define FNOISEF(F, FMT, ...) \
|
#define FNOISEF(F, FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (UNLIKELY(LOGGABLE(kLogNoise))) { \
|
if (UNLIKELY(LOGGABLE(kLogNoise))) { \
|
||||||
|
|
|
@ -65,9 +65,9 @@ void vflogf_onfail(FILE *f) {
|
||||||
* will display microseconsd as a delta elapsed time. This is useful if
|
* will display microseconsd as a delta elapsed time. This is useful if
|
||||||
* you do something like:
|
* you do something like:
|
||||||
*
|
*
|
||||||
* LOGF("connecting to foo");
|
* INFOF("connecting to foo");
|
||||||
* connect(...)
|
* connect(...)
|
||||||
* LOGF("connected to foo");
|
* INFOF("connected to foo");
|
||||||
*
|
*
|
||||||
* In that case, the second log entry will always display the amount of
|
* In that case, the second log entry will always display the amount of
|
||||||
* time that it took to connect. This is great in forking applications.
|
* time that it took to connect. This is great in forking applications.
|
||||||
|
@ -101,7 +101,6 @@ void(vflogf)(unsigned level, const char *file, int line, FILE *f,
|
||||||
vflogf_onfail(f);
|
vflogf_onfail(f);
|
||||||
}
|
}
|
||||||
(vfprintf)(f, fmt, va);
|
(vfprintf)(f, fmt, va);
|
||||||
va_end(va);
|
|
||||||
fputs("\n", f);
|
fputs("\n", f);
|
||||||
if (bufmode == _IOLBF) {
|
if (bufmode == _IOLBF) {
|
||||||
f->bufmode = _IOLBF;
|
f->bufmode = _IOLBF;
|
||||||
|
|
|
@ -109,7 +109,7 @@ int UncacheSslSession(void *data, mbedtls_ssl_session *session) {
|
||||||
mbedtls_x509_crt *cert;
|
mbedtls_x509_crt *cert;
|
||||||
struct SslCacheEntry *e;
|
struct SslCacheEntry *e;
|
||||||
uint32_t i, hash, ticketlen;
|
uint32_t i, hash, ticketlen;
|
||||||
LOGF("uncache");
|
INFOF("uncache");
|
||||||
cache = data;
|
cache = data;
|
||||||
hash = HashSslSession(session);
|
hash = HashSslSession(session);
|
||||||
i = hash & cache->mask;
|
i = hash & cache->mask;
|
||||||
|
|
2
third_party/mbedtls/ssl_srv.c
vendored
2
third_party/mbedtls/ssl_srv.c
vendored
|
@ -4473,7 +4473,7 @@ int mbedtls_ssl_handshake_server_step( mbedtls_ssl_context *ssl )
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_SSL_PROTO_DTLS */
|
#endif /* MBEDTLS_SSL_PROTO_DTLS */
|
||||||
/* LOGF("handshake step %s", GetSslStateName(ssl->state)); */
|
/* INFOF("handshake step %s", GetSslStateName(ssl->state)); */
|
||||||
switch( ssl->state )
|
switch( ssl->state )
|
||||||
{
|
{
|
||||||
case MBEDTLS_SSL_HELLO_REQUEST:
|
case MBEDTLS_SSL_HELLO_REQUEST:
|
||||||
|
|
|
@ -581,7 +581,7 @@ static void TuiRejuvinate(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OnQ(void) {
|
static void OnQ(void) {
|
||||||
LOGF("OnQ");
|
INFOF("OnQ");
|
||||||
action |= EXIT;
|
action |= EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ void TuiSetup(void) {
|
||||||
static bool once;
|
static bool once;
|
||||||
report = false;
|
report = false;
|
||||||
if (!once) {
|
if (!once) {
|
||||||
LOGF("loaded program %s\n%s", codepath, gc(FormatPml4t(m)));
|
INFOF("loaded program %s\n%s", codepath, gc(FormatPml4t(m)));
|
||||||
CommonSetup();
|
CommonSetup();
|
||||||
ioctl(ttyout, TCGETS, &oldterm);
|
ioctl(ttyout, TCGETS, &oldterm);
|
||||||
xsigaction(SIGINT, OnSigInt, 0, 0, oldsig + 3);
|
xsigaction(SIGINT, OnSigInt, 0, 0, oldsig + 3);
|
||||||
|
@ -1504,14 +1504,14 @@ static void CheckFramePointerImpl(void) {
|
||||||
sp = Read64(m->sp);
|
sp = Read64(m->sp);
|
||||||
while (bp) {
|
while (bp) {
|
||||||
if (!(r = FindReal(m, Read64(m->ss) + bp))) {
|
if (!(r = FindReal(m, Read64(m->ss) + bp))) {
|
||||||
LOGF("corrupt frame: %012lx", bp & 0x0000ffffffffffff);
|
INFOF("corrupt frame: %012lx", bp & 0x0000ffffffffffff);
|
||||||
ThrowProtectionFault(m);
|
ThrowProtectionFault(m);
|
||||||
}
|
}
|
||||||
sp = bp;
|
sp = bp;
|
||||||
bp = Read64(r + 0) - 0;
|
bp = Read64(r + 0) - 0;
|
||||||
rp = Read64(r + 8) - 1;
|
rp = Read64(r + 8) - 1;
|
||||||
if (!bp && !(m->bofram[0] <= rp && rp <= m->bofram[1])) {
|
if (!bp && !(m->bofram[0] <= rp && rp <= m->bofram[1])) {
|
||||||
LOGF("bad frame !(%012lx <= %012lx <= %012lx)", m->bofram[0], rp,
|
INFOF("bad frame !(%012lx <= %012lx <= %012lx)", m->bofram[0], rp,
|
||||||
m->bofram[1]);
|
m->bofram[1]);
|
||||||
ThrowProtectionFault(m);
|
ThrowProtectionFault(m);
|
||||||
}
|
}
|
||||||
|
@ -1620,7 +1620,7 @@ static void Redraw(void) {
|
||||||
DrawStatus(&pan.status);
|
DrawStatus(&pan.status);
|
||||||
PreventBufferbloat();
|
PreventBufferbloat();
|
||||||
if (PrintPanels(ttyout, ARRAYLEN(pan.p), pan.p, tyn, txn) == -1) {
|
if (PrintPanels(ttyout, ARRAYLEN(pan.p), pan.p, tyn, txn) == -1) {
|
||||||
LOGF("PrintPanels Interrupted");
|
INFOF("PrintPanels Interrupted");
|
||||||
CHECK_EQ(EINTR, errno);
|
CHECK_EQ(EINTR, errno);
|
||||||
}
|
}
|
||||||
last_opcount = opcount;
|
last_opcount = opcount;
|
||||||
|
@ -1815,7 +1815,7 @@ static const struct MachineFdCb kMachineFdCbPty = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void LaunchDebuggerReactively(void) {
|
static void LaunchDebuggerReactively(void) {
|
||||||
LOGF("%s", systemfailure);
|
INFOF("%s", systemfailure);
|
||||||
if (tuimode) {
|
if (tuimode) {
|
||||||
action |= FAILURE;
|
action |= FAILURE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2099,7 +2099,7 @@ static void OnApmService(void) {
|
||||||
} else if (Read16(m->ax) == 0x5301 && Read16(m->bx) == 0x0000) {
|
} else if (Read16(m->ax) == 0x5301 && Read16(m->bx) == 0x0000) {
|
||||||
SetCarry(false);
|
SetCarry(false);
|
||||||
} else if (Read16(m->ax) == 0x5307 && m->bx[0] == 1 && m->cx[0] == 3) {
|
} else if (Read16(m->ax) == 0x5307 && m->bx[0] == 1 && m->cx[0] == 3) {
|
||||||
LOGF("APM SHUTDOWN");
|
INFOF("APM SHUTDOWN");
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
SetCarry(true);
|
SetCarry(true);
|
||||||
|
@ -2193,7 +2193,7 @@ static void OnBinbase(struct Machine *m) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
int64_t skew;
|
int64_t skew;
|
||||||
skew = m->xedd->op.disp * 512;
|
skew = m->xedd->op.disp * 512;
|
||||||
LOGF("skew binbase %,ld @ %012lx", skew, GetIp() & 0x0000ffffffffffff);
|
INFOF("skew binbase %,ld @ %012lx", skew, GetIp() & 0x0000ffffffffffff);
|
||||||
for (i = 0; i < dis->syms.i; ++i) dis->syms.p[i].addr += skew;
|
for (i = 0; i < dis->syms.i; ++i) dis->syms.p[i].addr += skew;
|
||||||
for (i = 0; i < dis->loads.i; ++i) dis->loads.p[i].addr += skew;
|
for (i = 0; i < dis->loads.i; ++i) dis->loads.p[i].addr += skew;
|
||||||
for (i = 0; i < breakpoints.i; ++i) breakpoints.p[i].addr += skew;
|
for (i = 0; i < breakpoints.i; ++i) breakpoints.p[i].addr += skew;
|
||||||
|
@ -2460,7 +2460,7 @@ static void ReadKeyboard(void) {
|
||||||
dialog = NULL;
|
dialog = NULL;
|
||||||
if (readansi(ttyin, buf, sizeof(buf)) == -1) {
|
if (readansi(ttyin, buf, sizeof(buf)) == -1) {
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
LOGF("ReadKeyboard interrupted");
|
INFOF("ReadKeyboard interrupted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FATALF("ReadKeyboard failed: %s", strerror(errno));
|
FATALF("ReadKeyboard failed: %s", strerror(errno));
|
||||||
|
@ -2566,7 +2566,7 @@ static void Exec(void) {
|
||||||
if (!(interrupt = setjmp(m->onhalt))) {
|
if (!(interrupt = setjmp(m->onhalt))) {
|
||||||
if (!(action & CONTINUE) &&
|
if (!(action & CONTINUE) &&
|
||||||
(bp = IsAtBreakpoint(&breakpoints, GetIp())) != -1) {
|
(bp = IsAtBreakpoint(&breakpoints, GetIp())) != -1) {
|
||||||
LOGF("BREAK1 %012lx", breakpoints.p[bp].addr & 0x0000ffffffffffff);
|
INFOF("BREAK1 %012lx", breakpoints.p[bp].addr & 0x0000ffffffffffff);
|
||||||
tuimode = true;
|
tuimode = true;
|
||||||
LoadInstruction(m);
|
LoadInstruction(m);
|
||||||
ExecuteInstruction(m);
|
ExecuteInstruction(m);
|
||||||
|
@ -2577,7 +2577,7 @@ static void Exec(void) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
LoadInstruction(m);
|
LoadInstruction(m);
|
||||||
if ((bp = IsAtBreakpoint(&breakpoints, GetIp())) != -1) {
|
if ((bp = IsAtBreakpoint(&breakpoints, GetIp())) != -1) {
|
||||||
LOGF("BREAK2 %012lx", breakpoints.p[bp].addr & 0x0000ffffffffffff);
|
INFOF("BREAK2 %012lx", breakpoints.p[bp].addr & 0x0000ffffffffffff);
|
||||||
action &= ~(FINISH | NEXT | CONTINUE);
|
action &= ~(FINISH | NEXT | CONTINUE);
|
||||||
tuimode = true;
|
tuimode = true;
|
||||||
break;
|
break;
|
||||||
|
@ -2592,13 +2592,13 @@ static void Exec(void) {
|
||||||
action &= ~ALARM;
|
action &= ~ALARM;
|
||||||
}
|
}
|
||||||
if (action & EXIT) {
|
if (action & EXIT) {
|
||||||
LOGF("EXEC EXIT");
|
INFOF("EXEC EXIT");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (action & INT) {
|
if (action & INT) {
|
||||||
LOGF("EXEC INT");
|
INFOF("EXEC INT");
|
||||||
if (react) {
|
if (react) {
|
||||||
LOGF("REACT");
|
INFOF("REACT");
|
||||||
action &= ~(INT | STEP | FINISH | NEXT);
|
action &= ~(INT | STEP | FINISH | NEXT);
|
||||||
tuimode = true;
|
tuimode = true;
|
||||||
}
|
}
|
||||||
|
@ -2618,7 +2618,7 @@ static void Tui(void) {
|
||||||
ssize_t bp;
|
ssize_t bp;
|
||||||
int interrupt;
|
int interrupt;
|
||||||
bool interactive;
|
bool interactive;
|
||||||
LOGF("TUI");
|
INFOF("TUI");
|
||||||
TuiSetup();
|
TuiSetup();
|
||||||
SetupDraw();
|
SetupDraw();
|
||||||
ScrollOp(&pan.disassembly, GetDisIndex());
|
ScrollOp(&pan.disassembly, GetDisIndex());
|
||||||
|
@ -2629,7 +2629,7 @@ static void Tui(void) {
|
||||||
if ((action & (FINISH | NEXT | CONTINUE)) &&
|
if ((action & (FINISH | NEXT | CONTINUE)) &&
|
||||||
(bp = IsAtBreakpoint(&breakpoints, GetIp())) != -1) {
|
(bp = IsAtBreakpoint(&breakpoints, GetIp())) != -1) {
|
||||||
action &= ~(FINISH | NEXT | CONTINUE);
|
action &= ~(FINISH | NEXT | CONTINUE);
|
||||||
LOGF("BREAK %012lx", breakpoints.p[bp].addr & 0x0000ffffffffffff);
|
INFOF("BREAK %012lx", breakpoints.p[bp].addr & 0x0000ffffffffffff);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m->xedd = (struct XedDecodedInst *)m->icache[0];
|
m->xedd = (struct XedDecodedInst *)m->icache[0];
|
||||||
|
@ -2659,11 +2659,11 @@ static void Tui(void) {
|
||||||
PrintMessageBox(ttyout, dialog, tyn, txn);
|
PrintMessageBox(ttyout, dialog, tyn, txn);
|
||||||
}
|
}
|
||||||
if (action & FAILURE) {
|
if (action & FAILURE) {
|
||||||
LOGF("TUI FAILURE");
|
INFOF("TUI FAILURE");
|
||||||
PrintMessageBox(ttyout, systemfailure, tyn, txn);
|
PrintMessageBox(ttyout, systemfailure, tyn, txn);
|
||||||
ReadKeyboard();
|
ReadKeyboard();
|
||||||
if (action & INT) {
|
if (action & INT) {
|
||||||
LOGF("TUI INT");
|
INFOF("TUI INT");
|
||||||
LeaveScreen();
|
LeaveScreen();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -2673,7 +2673,7 @@ static void Tui(void) {
|
||||||
ReadKeyboard();
|
ReadKeyboard();
|
||||||
}
|
}
|
||||||
if (action & INT) {
|
if (action & INT) {
|
||||||
LOGF("TUI INT");
|
INFOF("TUI INT");
|
||||||
action &= ~INT;
|
action &= ~INT;
|
||||||
if (action & (CONTINUE | NEXT | FINISH)) {
|
if (action & (CONTINUE | NEXT | FINISH)) {
|
||||||
action &= ~(CONTINUE | NEXT | FINISH);
|
action &= ~(CONTINUE | NEXT | FINISH);
|
||||||
|
@ -2683,17 +2683,17 @@ static void Tui(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (action & EXIT) {
|
if (action & EXIT) {
|
||||||
LOGF("TUI EXIT");
|
INFOF("TUI EXIT");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (action & QUIT) {
|
if (action & QUIT) {
|
||||||
LOGF("TUI QUIT");
|
INFOF("TUI QUIT");
|
||||||
action &= ~QUIT;
|
action &= ~QUIT;
|
||||||
raise(SIGQUIT);
|
raise(SIGQUIT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (action & RESTART) {
|
if (action & RESTART) {
|
||||||
LOGF("TUI RESTART");
|
INFOF("TUI RESTART");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (IsExecuting()) {
|
if (IsExecuting()) {
|
||||||
|
|
|
@ -79,7 +79,7 @@ static void SgdtMs(struct Machine *m, uint32_t rde) {
|
||||||
|
|
||||||
static void LgdtMs(struct Machine *m, uint32_t rde) {
|
static void LgdtMs(struct Machine *m, uint32_t rde) {
|
||||||
LoadDescriptorTable(m, rde, &m->gdt_limit, &m->gdt_base);
|
LoadDescriptorTable(m, rde, &m->gdt_limit, &m->gdt_base);
|
||||||
LOGF("set gdt %p lim %,d", m->gdt_base, m->gdt_limit);
|
INFOF("set gdt %p lim %,d", m->gdt_base, m->gdt_limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SidtMs(struct Machine *m, uint32_t rde) {
|
static void SidtMs(struct Machine *m, uint32_t rde) {
|
||||||
|
@ -88,7 +88,7 @@ static void SidtMs(struct Machine *m, uint32_t rde) {
|
||||||
|
|
||||||
static void LidtMs(struct Machine *m, uint32_t rde) {
|
static void LidtMs(struct Machine *m, uint32_t rde) {
|
||||||
LoadDescriptorTable(m, rde, &m->idt_limit, &m->idt_base);
|
LoadDescriptorTable(m, rde, &m->idt_limit, &m->idt_base);
|
||||||
LOGF("set idt %p lim %,d", m->idt_base, m->idt_limit);
|
INFOF("set idt %p lim %,d", m->idt_base, m->idt_limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Monitor(struct Machine *m, uint32_t rde) {
|
static void Monitor(struct Machine *m, uint32_t rde) {
|
||||||
|
|
|
@ -622,7 +622,7 @@ void CompressLowEntropyReadOnlyDataSections(struct Package *pkg,
|
||||||
".rodata") &&
|
".rodata") &&
|
||||||
rlencode(&rle, p, shdr->sh_size) != -1) {
|
rlencode(&rle, p, shdr->sh_size) != -1) {
|
||||||
isprofitable = rle.i * sizeof(rle.p[0]) <= shdr->sh_size / 2;
|
isprofitable = rle.i * sizeof(rle.p[0]) <= shdr->sh_size / 2;
|
||||||
LOGF("%s(%s): rlencode()%s on %s is%s profitable (%,zu → %,zu bytes)",
|
INFOF("%s(%s): rlencode()%s on %s is%s profitable (%,zu → %,zu bytes)",
|
||||||
&pkg->strings.p[pkg->path], &pkg->strings.p[obj->path],
|
&pkg->strings.p[pkg->path], &pkg->strings.p[obj->path],
|
||||||
haverldecode ? "" : " [NOT LINKED]", name,
|
haverldecode ? "" : " [NOT LINKED]", name,
|
||||||
isprofitable ? "" : " NOT", shdr->sh_size, rle.i * sizeof(rle.p[0]));
|
isprofitable ? "" : " NOT", shdr->sh_size, rle.i * sizeof(rle.p[0]));
|
||||||
|
|
|
@ -204,7 +204,7 @@ void StartTcpServer(void) {
|
||||||
CHECK_NE(-1, listen(g_servfd, 10));
|
CHECK_NE(-1, listen(g_servfd, 10));
|
||||||
asize = sizeof(g_servaddr);
|
asize = sizeof(g_servaddr);
|
||||||
CHECK_NE(-1, getsockname(g_servfd, &g_servaddr, &asize));
|
CHECK_NE(-1, getsockname(g_servfd, &g_servaddr, &asize));
|
||||||
LOGF("%s:%s", "listening on tcp", gc(DescribeAddress(&g_servaddr)));
|
INFOF("%s:%s", "listening on tcp", gc(DescribeAddress(&g_servaddr)));
|
||||||
if (g_sendready) {
|
if (g_sendready) {
|
||||||
printf("ready %hu\n", ntohs(g_servaddr.sin_port));
|
printf("ready %hu\n", ntohs(g_servaddr.sin_port));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -306,7 +306,7 @@ void HandleClient(void) {
|
||||||
exename = gc(calloc(1, namesize + 1));
|
exename = gc(calloc(1, namesize + 1));
|
||||||
Recv(exename, namesize);
|
Recv(exename, namesize);
|
||||||
g_exepath = gc(xasprintf("o/%d.%s", getpid(), basename(exename)));
|
g_exepath = gc(xasprintf("o/%d.%s", getpid(), basename(exename)));
|
||||||
LOGF("%s asked we run %`'s (%,u bytes @ %`'s)", addrstr, exename, filesize,
|
INFOF("%s asked we run %`'s (%,u bytes @ %`'s)", addrstr, exename, filesize,
|
||||||
g_exepath);
|
g_exepath);
|
||||||
|
|
||||||
exe = malloc(filesize);
|
exe = malloc(filesize);
|
||||||
|
@ -428,9 +428,9 @@ int Serve(void) {
|
||||||
}
|
}
|
||||||
close(g_servfd);
|
close(g_servfd);
|
||||||
if (!g_timeout) {
|
if (!g_timeout) {
|
||||||
LOGF("timeout expired, shutting down");
|
INFOF("timeout expired, shutting down");
|
||||||
} else {
|
} else {
|
||||||
LOGF("got ctrl-c, shutting down");
|
INFOF("got ctrl-c, shutting down");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ void AddSocket(const struct Socket *s) {
|
||||||
|
|
||||||
void RemoveSocket(size_t i) {
|
void RemoveSocket(size_t i) {
|
||||||
DCHECK_LT(i, g_sockets.i);
|
DCHECK_LT(i, g_sockets.i);
|
||||||
LOGF("removing: %s", gc(DescribeSocket(&g_sockets.p[i])));
|
INFOF("removing: %s", gc(DescribeSocket(&g_sockets.p[i])));
|
||||||
CHECK_NE(-1, close(g_sockets.p[i].fd));
|
CHECK_NE(-1, close(g_sockets.p[i].fd));
|
||||||
while (g_sockets.p[i].egress.i) {
|
while (g_sockets.p[i].egress.i) {
|
||||||
free(g_sockets.p[i].egress.p[g_sockets.p[i].egress.i - 1].data.iov_base);
|
free(g_sockets.p[i].egress.p[g_sockets.p[i].egress.i - 1].data.iov_base);
|
||||||
|
@ -189,7 +189,7 @@ void BeginListeningForIncomingTraffic(void) {
|
||||||
}
|
}
|
||||||
uint32_t addrsize = sizeof(s->addr);
|
uint32_t addrsize = sizeof(s->addr);
|
||||||
CHECK_NE(-1, getsockname(s->fd, &s->addr, &addrsize));
|
CHECK_NE(-1, getsockname(s->fd, &s->addr, &addrsize));
|
||||||
LOGF("listening on %s", gc(DescribeSocket(s)));
|
INFOF("listening on %s", gc(DescribeSocket(s)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ void AcceptConnection(size_t i) {
|
||||||
client.protocol = server->protocol;
|
client.protocol = server->protocol;
|
||||||
uint32_t addrsize = sizeof(client.addr);
|
uint32_t addrsize = sizeof(client.addr);
|
||||||
CHECK_NE(-1L, (client.fd = accept(server->fd, &client.addr, &addrsize)));
|
CHECK_NE(-1L, (client.fd = accept(server->fd, &client.addr, &addrsize)));
|
||||||
LOGF("%s accepted %s", gc(DescribeSocket(server)),
|
INFOF("%s accepted %s", gc(DescribeSocket(server)),
|
||||||
gc(DescribeSocket(&client)));
|
gc(DescribeSocket(&client)));
|
||||||
AddSocket(&client);
|
AddSocket(&client);
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ bool ReceiveData(size_t i) {
|
||||||
msg.data.iov_len, 0, isudp ? &msg.dest : NULL,
|
msg.data.iov_len, 0, isudp ? &msg.dest : NULL,
|
||||||
isudp ? &msg.destsize : NULL)));
|
isudp ? &msg.destsize : NULL)));
|
||||||
if (0 < got && got <= msg.data.iov_len) {
|
if (0 < got && got <= msg.data.iov_len) {
|
||||||
LOGF("%s received %lu bytes from %s", gc(DescribeSocket(&g_sockets.p[i])),
|
INFOF("%s received %lu bytes from %s", gc(DescribeSocket(&g_sockets.p[i])),
|
||||||
got, gc(DescribeAddress(&msg.dest)));
|
got, gc(DescribeAddress(&msg.dest)));
|
||||||
msg.data.iov_base = xrealloc(msg.data.iov_base, (msg.data.iov_len = got));
|
msg.data.iov_base = xrealloc(msg.data.iov_base, (msg.data.iov_len = got));
|
||||||
append(&g_sockets.p[i].egress, &msg);
|
append(&g_sockets.p[i].egress, &msg);
|
||||||
|
@ -241,7 +241,7 @@ void SendData(size_t i) {
|
||||||
CHECK_NE(-1L, (sent = sendto(s->fd, msg->data.iov_base, msg->data.iov_len, 0,
|
CHECK_NE(-1L, (sent = sendto(s->fd, msg->data.iov_base, msg->data.iov_len, 0,
|
||||||
isudp ? &msg->dest : NULL,
|
isudp ? &msg->dest : NULL,
|
||||||
isudp ? msg->destsize : 0)));
|
isudp ? msg->destsize : 0)));
|
||||||
LOGF("%s sent %lu bytes to %s", gc(DescribeSocket(s)), msg->data.iov_len,
|
INFOF("%s sent %lu bytes to %s", gc(DescribeSocket(s)), msg->data.iov_len,
|
||||||
gc(DescribeAddress(&msg->dest)));
|
gc(DescribeAddress(&msg->dest)));
|
||||||
if (!(msg->data.iov_len -= min((size_t)sent, (size_t)msg->data.iov_len))) {
|
if (!(msg->data.iov_len -= min((size_t)sent, (size_t)msg->data.iov_len))) {
|
||||||
free_s(&msg->data.iov_base);
|
free_s(&msg->data.iov_base);
|
||||||
|
@ -290,7 +290,7 @@ int main(int argc, char *argv[]) {
|
||||||
memset(&icall, 0, sizeof(icall));
|
memset(&icall, 0, sizeof(icall));
|
||||||
interruptiblecall(&icall, (void *)EchoServer, 0, 0, 0, 0);
|
interruptiblecall(&icall, (void *)EchoServer, 0, 0, 0, 0);
|
||||||
fputc('\r', stderr);
|
fputc('\r', stderr);
|
||||||
LOGF("%s", "shutting down...");
|
INFOF("%s", "shutting down...");
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = g_sockets.i; i; --i) RemoveSocket(i - 1);
|
for (i = g_sockets.i; i; --i) RemoveSocket(i - 1);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1118,7 +1118,7 @@ static void ReportWorkerResources(int pid, struct rusage *ru) {
|
||||||
AppendResourceReport(&b, ru, "\n");
|
AppendResourceReport(&b, ru, "\n");
|
||||||
if (b) {
|
if (b) {
|
||||||
if ((s = IndentLines(b, appendz(b).i - 1, 0, 1))) {
|
if ((s = IndentLines(b, appendz(b).i - 1, 0, 1))) {
|
||||||
ANYF(kLogDebug, "(stat) resource report for pid %d\n%s", pid, s);
|
LOGF(kLogDebug, "(stat) resource report for pid %d\n%s", pid, s);
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
free(b);
|
free(b);
|
||||||
|
@ -3470,7 +3470,7 @@ static void LogMessage(const char *d, const char *s, size_t n) {
|
||||||
while (n && (s[n - 1] == '\r' || s[n - 1] == '\n')) --n;
|
while (n && (s[n - 1] == '\r' || s[n - 1] == '\n')) --n;
|
||||||
if ((s2 = DecodeLatin1(s, n, &n2))) {
|
if ((s2 = DecodeLatin1(s, n, &n2))) {
|
||||||
if ((s3 = IndentLines(s2, n2, &n3, 1))) {
|
if ((s3 = IndentLines(s2, n2, &n3, 1))) {
|
||||||
LOGF("(stat) %s %,ld byte message\n%.*s", d, n, n3, s3);
|
INFOF("(stat) %s %,ld byte message\n%.*s", d, n, n3, s3);
|
||||||
free(s3);
|
free(s3);
|
||||||
}
|
}
|
||||||
free(s2);
|
free(s2);
|
||||||
|
@ -3485,7 +3485,7 @@ static void LogBody(const char *d, const char *s, size_t n) {
|
||||||
while (n && (s[n - 1] == '\r' || s[n - 1] == '\n')) --n;
|
while (n && (s[n - 1] == '\r' || s[n - 1] == '\n')) --n;
|
||||||
if ((s2 = VisualizeControlCodes(s, n, &n2))) {
|
if ((s2 = VisualizeControlCodes(s, n, &n2))) {
|
||||||
if ((s3 = IndentLines(s2, n2, &n3, 1))) {
|
if ((s3 = IndentLines(s2, n2, &n3, 1))) {
|
||||||
LOGF("(stat) %s %,ld byte payload\n%.*s", d, n, n3, s3);
|
INFOF("(stat) %s %,ld byte payload\n%.*s", d, n, n3, s3);
|
||||||
free(s3);
|
free(s3);
|
||||||
}
|
}
|
||||||
free(s2);
|
free(s2);
|
||||||
|
@ -5373,7 +5373,7 @@ static const char *DescribeClose(void) {
|
||||||
static void LogClose(const char *reason) {
|
static void LogClose(const char *reason) {
|
||||||
if (amtread || meltdown || killed) {
|
if (amtread || meltdown || killed) {
|
||||||
LockInc(&shared->c.fumbles);
|
LockInc(&shared->c.fumbles);
|
||||||
LOGF("(stat) %s %s with %,ld unprocessed and %,d handled (%,d workers)",
|
INFOF("(stat) %s %s with %,ld unprocessed and %,d handled (%,d workers)",
|
||||||
DescribeClient(), reason, amtread, messageshandled, shared->workers);
|
DescribeClient(), reason, amtread, messageshandled, shared->workers);
|
||||||
} else {
|
} else {
|
||||||
DEBUGF("(stat) %s %s with %,d requests handled", DescribeClient(), reason,
|
DEBUGF("(stat) %s %s with %,d requests handled", DescribeClient(), reason,
|
||||||
|
@ -5513,7 +5513,7 @@ static char *HandlePayloadReadError(void) {
|
||||||
return ServeFailure(408, "Request Timeout");
|
return ServeFailure(408, "Request Timeout");
|
||||||
} else {
|
} else {
|
||||||
LockInc(&shared->c.readerrors);
|
LockInc(&shared->c.readerrors);
|
||||||
LOGF("(clnt) %s payload read error %s", DescribeClient(), strerror(errno));
|
INFOF("(clnt) %s payload read error %s", DescribeClient(), strerror(errno));
|
||||||
return ServeFailure(500, "Internal Server Error");
|
return ServeFailure(500, "Internal Server Error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5775,7 +5775,7 @@ static char *HandleRequest(void) {
|
||||||
LockInc(&shared->c.urisrefused);
|
LockInc(&shared->c.urisrefused);
|
||||||
return ServeFailure(400, "Bad URI");
|
return ServeFailure(400, "Bad URI");
|
||||||
}
|
}
|
||||||
LOGF("(req) received %s HTTP%02d %.*s %s %`'.*s %`'.*s", DescribeClient(),
|
INFOF("(req) received %s HTTP%02d %.*s %s %`'.*s %`'.*s", DescribeClient(),
|
||||||
msg.version, msg.xmethod.b - msg.xmethod.a, inbuf.p + msg.xmethod.a,
|
msg.version, msg.xmethod.b - msg.xmethod.a, inbuf.p + msg.xmethod.a,
|
||||||
FreeLater(EncodeUrl(&url, 0)), HeaderLength(kHttpReferer),
|
FreeLater(EncodeUrl(&url, 0)), HeaderLength(kHttpReferer),
|
||||||
HeaderData(kHttpReferer), HeaderLength(kHttpUserAgent),
|
HeaderData(kHttpReferer), HeaderLength(kHttpUserAgent),
|
||||||
|
@ -6094,7 +6094,7 @@ static bool HandleMessageAcutal(void) {
|
||||||
LockInc(&shared->c.badmessages);
|
LockInc(&shared->c.badmessages);
|
||||||
connectionclose = true;
|
connectionclose = true;
|
||||||
if ((p = DumpHexc(inbuf.p, MIN(amtread, 256), 0))) {
|
if ((p = DumpHexc(inbuf.p, MIN(amtread, 256), 0))) {
|
||||||
LOGF("(clnt) %s sent garbage %s", DescribeClient(), p);
|
INFOF("(clnt) %s sent garbage %s", DescribeClient(), p);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6122,7 +6122,7 @@ static bool HandleMessageAcutal(void) {
|
||||||
LockInc(&shared->c.messageshandled);
|
LockInc(&shared->c.messageshandled);
|
||||||
++messageshandled;
|
++messageshandled;
|
||||||
if (loglatency || LOGGABLE(kLogDebug)) {
|
if (loglatency || LOGGABLE(kLogDebug)) {
|
||||||
ANYF(kLogDebug, "(stat) %`'.*s latency %,ldµs", msg.uri.b - msg.uri.a, inbuf.p + msg.uri.a,
|
LOGF(kLogDebug, "(stat) %`'.*s latency %,ldµs", msg.uri.b - msg.uri.a, inbuf.p + msg.uri.a,
|
||||||
(long)((nowl() - startrequest) * 1e6L));
|
(long)((nowl() - startrequest) * 1e6L));
|
||||||
}
|
}
|
||||||
if (!generator) {
|
if (!generator) {
|
||||||
|
@ -6473,7 +6473,7 @@ static void Listen(void) {
|
||||||
port = ntohs(servers.p[n].addr.sin_port);
|
port = ntohs(servers.p[n].addr.sin_port);
|
||||||
ip = ntohl(servers.p[n].addr.sin_addr.s_addr);
|
ip = ntohl(servers.p[n].addr.sin_addr.s_addr);
|
||||||
if (ip == INADDR_ANY) ip = INADDR_LOOPBACK;
|
if (ip == INADDR_ANY) ip = INADDR_LOOPBACK;
|
||||||
LOGF("(srvr) listen http://%hhu.%hhu.%hhu.%hhu:%d", ip >> 24, ip >> 16, ip >> 8,
|
INFOF("(srvr) listen http://%hhu.%hhu.%hhu.%hhu:%d", ip >> 24, ip >> 16, ip >> 8,
|
||||||
ip, port);
|
ip, port);
|
||||||
if (printport && !ports.p[j]) {
|
if (printport && !ports.p[j]) {
|
||||||
printf("%d\n", port);
|
printf("%d\n", port);
|
||||||
|
@ -6493,9 +6493,9 @@ static void Listen(void) {
|
||||||
static void HandleShutdown(void) {
|
static void HandleShutdown(void) {
|
||||||
CloseServerFds();
|
CloseServerFds();
|
||||||
if (keyboardinterrupt) {
|
if (keyboardinterrupt) {
|
||||||
LOGF("(srvr) received keyboard interrupt");
|
INFOF("(srvr) received keyboard interrupt");
|
||||||
} else {
|
} else {
|
||||||
LOGF("(srvr) received term signal");
|
INFOF("(srvr) received term signal");
|
||||||
if (!killed) {
|
if (!killed) {
|
||||||
terminated = false;
|
terminated = false;
|
||||||
}
|
}
|
||||||
|
@ -6688,7 +6688,7 @@ void RedBean(int argc, char *argv[]) {
|
||||||
TlsDestroy();
|
TlsDestroy();
|
||||||
MemDestroy();
|
MemDestroy();
|
||||||
}
|
}
|
||||||
LOGF("(srvr) shutdown complete");
|
INFOF("(srvr) shutdown complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
|
@ -192,7 +192,7 @@ void YCbCrComputeSamplingSolution(struct YCbCrSamplingSolution *scale, long dyn,
|
||||||
fabs(scale->rx - rx) > .001 || fabs(scale->oy - oy) > .001 ||
|
fabs(scale->rx - rx) > .001 || fabs(scale->oy - oy) > .001 ||
|
||||||
fabs(scale->ox - ox) > .001 || fabs(scale->py - py) > .001 ||
|
fabs(scale->ox - ox) > .001 || fabs(scale->py - py) > .001 ||
|
||||||
fabs(scale->px - px) > .001) {
|
fabs(scale->px - px) > .001) {
|
||||||
LOGF("recomputing sampling solution");
|
INFOF("recomputing sampling solution");
|
||||||
FreeSamplingSolution(scale->cy), scale->cy = NULL;
|
FreeSamplingSolution(scale->cy), scale->cy = NULL;
|
||||||
FreeSamplingSolution(scale->cx), scale->cx = NULL;
|
FreeSamplingSolution(scale->cx), scale->cx = NULL;
|
||||||
scale->cy = ComputeSamplingSolution(dyn, syn, ry, oy, py);
|
scale->cy = ComputeSamplingSolution(dyn, syn, ry, oy, py);
|
||||||
|
@ -297,7 +297,7 @@ void YCbCr2RgbScaler(struct YCbCr *me, long dyn, long dxn,
|
||||||
yox = sxn / scxn / 2 - prx * .5;
|
yox = sxn / scxn / 2 - prx * .5;
|
||||||
coy = syn / scyn / 2 - pry * .5;
|
coy = syn / scyn / 2 - pry * .5;
|
||||||
cox = sxn / scxn / 2 - prx * .5;
|
cox = sxn / scxn / 2 - prx * .5;
|
||||||
LOGF("gyarados pry=%.3f prx=%.3f syn=%.3f sxn=%.3f dyn=%ld dxn=%ld "
|
INFOF("gyarados pry=%.3f prx=%.3f syn=%.3f sxn=%.3f dyn=%ld dxn=%ld "
|
||||||
"yyn=%ld "
|
"yyn=%ld "
|
||||||
"yxn=%ld cyn=%ld cxn=%ld yry=%.3f yrx=%.3f cry=%.3f crx=%.3f "
|
"yxn=%ld cyn=%ld cxn=%ld yry=%.3f yrx=%.3f cry=%.3f crx=%.3f "
|
||||||
"yoy=%.3f "
|
"yoy=%.3f "
|
||||||
|
@ -318,7 +318,7 @@ void YCbCr2RgbScaler(struct YCbCr *me, long dyn, long dxn,
|
||||||
me->chroma.cy, me->chroma.cx, false);
|
me->chroma.cy, me->chroma.cx, false);
|
||||||
gyarados_latency_ = lround((nowl() - ts) * 1e6l);
|
gyarados_latency_ = lround((nowl() - ts) * 1e6l);
|
||||||
YCbCrConvert(me, dyn, dxn, RGB, yys, yxs, Y, cys, cxs, Cb, Cr);
|
YCbCrConvert(me, dyn, dxn, RGB, yys, yxs, Y, cys, cxs, Cb, Cr);
|
||||||
LOGF("done");
|
INFOF("done");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ void *YCbCr2RgbScale(long dyn, long dxn,
|
||||||
CHECK_LE(yxn, yxs);
|
CHECK_LE(yxn, yxs);
|
||||||
CHECK_LE(cyn, cys);
|
CHECK_LE(cyn, cys);
|
||||||
CHECK_LE(cxn, cxs);
|
CHECK_LE(cxn, cxs);
|
||||||
LOGF("magikarp2x");
|
INFOF("magikarp2x");
|
||||||
magikarp_start_ = nowl();
|
magikarp_start_ = nowl();
|
||||||
minyys = MAX(ceil(syn), MAX(yyn, ceil(dyn * pry)));
|
minyys = MAX(ceil(syn), MAX(yyn, ceil(dyn * pry)));
|
||||||
minyxs = MAX(ceil(sxn), MAX(yxn, ceil(dxn * prx)));
|
minyxs = MAX(ceil(sxn), MAX(yxn, ceil(dxn * prx)));
|
||||||
|
|
|
@ -171,7 +171,7 @@ mode.\n\
|
||||||
|
|
||||||
#define BALLOC(B, A, N, NAME) \
|
#define BALLOC(B, A, N, NAME) \
|
||||||
({ \
|
({ \
|
||||||
LOGF("balloc/%s %,zu bytes", NAME, N); \
|
INFOF("balloc/%s %,zu bytes", NAME, N); \
|
||||||
balloc(B, A, N); \
|
balloc(B, A, N); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ static bool CloseSpeaker(void) {
|
||||||
int rc, wstatus;
|
int rc, wstatus;
|
||||||
rc = 0;
|
rc = 0;
|
||||||
sched_yield();
|
sched_yield();
|
||||||
LOGF("CloseSpeaker");
|
INFOF("CloseSpeaker");
|
||||||
if (playfd_) {
|
if (playfd_) {
|
||||||
rc |= close(playfd_);
|
rc |= close(playfd_);
|
||||||
playfd_ = -1;
|
playfd_ = -1;
|
||||||
|
@ -443,7 +443,7 @@ static void DimensionDisplay(void) {
|
||||||
yn = ROUNDDOWN(yn, 2);
|
yn = ROUNDDOWN(yn, 2);
|
||||||
xn = ROUNDDOWN(xn, 2);
|
xn = ROUNDDOWN(xn, 2);
|
||||||
g2_ = resizegraphic(&graphic_[1], yn, xn);
|
g2_ = resizegraphic(&graphic_[1], yn, xn);
|
||||||
LOGF("%s 𝑑(%hu×%hu)×(%d,%d): 𝑔₁(%zu×%zu,r=%f) → 𝑔₂(%zu×%zu)",
|
INFOF("%s 𝑑(%hu×%hu)×(%d,%d): 𝑔₁(%zu×%zu,r=%f) → 𝑔₂(%zu×%zu)",
|
||||||
"DimensionDisplay", wsize_.ws_row, wsize_.ws_col, g1_->yn, g1_->xn,
|
"DimensionDisplay", wsize_.ws_row, wsize_.ws_col, g1_->yn, g1_->xn,
|
||||||
ratio, yn, xn);
|
ratio, yn, xn);
|
||||||
BALLOC(&xtcodes_, 64, ((g2_->yn) * g2_->xn + 8) * sizeof(struct TtyRgb),
|
BALLOC(&xtcodes_, 64, ((g2_->yn) * g2_->xn + 8) * sizeof(struct TtyRgb),
|
||||||
|
@ -818,7 +818,7 @@ static void TranscodeVideo(plm_frame_t *pf) {
|
||||||
TIMEIT(t4, RenderIt());
|
TIMEIT(t4, RenderIt());
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGF("𝑓%zu(%u×%u) %,zub (%f BPP) "
|
INFOF("𝑓%zu(%u×%u) %,zub (%f BPP) "
|
||||||
"ycbcr=%,zuns "
|
"ycbcr=%,zuns "
|
||||||
"scale=%,zuns "
|
"scale=%,zuns "
|
||||||
"lace=%,zuns "
|
"lace=%,zuns "
|
||||||
|
@ -847,7 +847,7 @@ static void OnVideo(plm_t *mpeg, plm_frame_t *pf, void *user) {
|
||||||
static void OpenVideo(void) {
|
static void OpenVideo(void) {
|
||||||
size_t yn, xn;
|
size_t yn, xn;
|
||||||
playfd_ = -1;
|
playfd_ = -1;
|
||||||
LOGF("%s(%`'s)", "OpenVideo", patharg_);
|
INFOF("%s(%`'s)", "OpenVideo", patharg_);
|
||||||
CHECK_NOTNULL((plm_ = plm_create_with_filename(patharg_)));
|
CHECK_NOTNULL((plm_ = plm_create_with_filename(patharg_)));
|
||||||
swing_ = 219;
|
swing_ = 219;
|
||||||
xn = plm_get_width(plm_);
|
xn = plm_get_width(plm_);
|
||||||
|
@ -1304,7 +1304,7 @@ static void HandleSignals(void) {
|
||||||
static void PrintVideo(void) {
|
static void PrintVideo(void) {
|
||||||
long double decode_last, decode_end, next_tick, lag;
|
long double decode_last, decode_end, next_tick, lag;
|
||||||
dura_ = MIN(MAX_FRAMERATE, 1 / plm_get_framerate(plm_));
|
dura_ = MIN(MAX_FRAMERATE, 1 / plm_get_framerate(plm_));
|
||||||
LOGF("framerate=%f dura=%f", plm_get_framerate(plm_), dura_);
|
INFOF("framerate=%f dura=%f", plm_get_framerate(plm_), dura_);
|
||||||
next_tick = deadline_ = decode_last = nowl();
|
next_tick = deadline_ = decode_last = nowl();
|
||||||
next_tick += dura_;
|
next_tick += dura_;
|
||||||
deadline_ += dura_;
|
deadline_ += dura_;
|
||||||
|
@ -1319,7 +1319,7 @@ static void PrintVideo(void) {
|
||||||
deadline_ = next_tick - lag;
|
deadline_ = next_tick - lag;
|
||||||
if (gotvideo_ || !plm_get_video_enabled(plm_)) {
|
if (gotvideo_ || !plm_get_video_enabled(plm_)) {
|
||||||
gotvideo_ = false;
|
gotvideo_ = false;
|
||||||
LOGF("entering printvideo event loop (lag=%,ldns, grace=%,ldns)",
|
INFOF("entering printvideo event loop (lag=%,ldns, grace=%,ldns)",
|
||||||
AsNanoseconds(lag), AsNanoseconds(GetGraceTime()));
|
AsNanoseconds(lag), AsNanoseconds(GetGraceTime()));
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
@ -1452,68 +1452,68 @@ static void TryToOpenFrameBuffer(void) {
|
||||||
}
|
}
|
||||||
if ((fb0_.fd = open(fb0_.path, O_RDWR)) != -1) {
|
if ((fb0_.fd = open(fb0_.path, O_RDWR)) != -1) {
|
||||||
CHECK_NE(-1, (rc = ioctl(fb0_.fd, FBIOGET_FSCREENINFO, &fb0_.fscreen)));
|
CHECK_NE(-1, (rc = ioctl(fb0_.fd, FBIOGET_FSCREENINFO, &fb0_.fscreen)));
|
||||||
LOGF("ioctl(%s) → %d", "FBIOGET_FSCREENINFO", rc);
|
INFOF("ioctl(%s) → %d", "FBIOGET_FSCREENINFO", rc);
|
||||||
LOGF("%s.%s=%.*s", "fb0_.fscreen", "id", sizeof(fb0_.fscreen.id),
|
INFOF("%s.%s=%.*s", "fb0_.fscreen", "id", sizeof(fb0_.fscreen.id),
|
||||||
fb0_.fscreen.id);
|
fb0_.fscreen.id);
|
||||||
LOGF("%s.%s=%p", "fb0_.fscreen", "smem_start", fb0_.fscreen.smem_start);
|
INFOF("%s.%s=%p", "fb0_.fscreen", "smem_start", fb0_.fscreen.smem_start);
|
||||||
LOGF("%s.%s=%u", "fb0_.fscreen", "smem_len", fb0_.fscreen.smem_len);
|
INFOF("%s.%s=%u", "fb0_.fscreen", "smem_len", fb0_.fscreen.smem_len);
|
||||||
LOGF("%s.%s=%u", "fb0_.fscreen", "type", fb0_.fscreen.type);
|
INFOF("%s.%s=%u", "fb0_.fscreen", "type", fb0_.fscreen.type);
|
||||||
LOGF("%s.%s=%u", "fb0_.fscreen", "type_aux", fb0_.fscreen.type_aux);
|
INFOF("%s.%s=%u", "fb0_.fscreen", "type_aux", fb0_.fscreen.type_aux);
|
||||||
LOGF("%s.%s=%u", "fb0_.fscreen", "visual", fb0_.fscreen.visual);
|
INFOF("%s.%s=%u", "fb0_.fscreen", "visual", fb0_.fscreen.visual);
|
||||||
LOGF("%s.%s=%hu", "fb0_.fscreen", "xpanstep", fb0_.fscreen.xpanstep);
|
INFOF("%s.%s=%hu", "fb0_.fscreen", "xpanstep", fb0_.fscreen.xpanstep);
|
||||||
LOGF("%s.%s=%hu", "fb0_.fscreen", "ypanstep", fb0_.fscreen.ypanstep);
|
INFOF("%s.%s=%hu", "fb0_.fscreen", "ypanstep", fb0_.fscreen.ypanstep);
|
||||||
LOGF("%s.%s=%hu", "fb0_.fscreen", "ywrapstep", fb0_.fscreen.ywrapstep);
|
INFOF("%s.%s=%hu", "fb0_.fscreen", "ywrapstep", fb0_.fscreen.ywrapstep);
|
||||||
LOGF("%s.%s=%u", "fb0_.fscreen", "line_length", fb0_.fscreen.line_length);
|
INFOF("%s.%s=%u", "fb0_.fscreen", "line_length", fb0_.fscreen.line_length);
|
||||||
LOGF("%s.%s=%p", "fb0_.fscreen", "mmio_start", fb0_.fscreen.mmio_start);
|
INFOF("%s.%s=%p", "fb0_.fscreen", "mmio_start", fb0_.fscreen.mmio_start);
|
||||||
LOGF("%s.%s=%u", "fb0_.fscreen", "mmio_len", fb0_.fscreen.mmio_len);
|
INFOF("%s.%s=%u", "fb0_.fscreen", "mmio_len", fb0_.fscreen.mmio_len);
|
||||||
LOGF("%s.%s=%u", "fb0_.fscreen", "accel", fb0_.fscreen.accel);
|
INFOF("%s.%s=%u", "fb0_.fscreen", "accel", fb0_.fscreen.accel);
|
||||||
LOGF("%s.%s=%#b", "fb0_.fscreen", "capabilities",
|
INFOF("%s.%s=%#b", "fb0_.fscreen", "capabilities",
|
||||||
fb0_.fscreen.capabilities);
|
fb0_.fscreen.capabilities);
|
||||||
CHECK_NE(-1, (rc = ioctl(fb0_.fd, FBIOGET_VSCREENINFO, &fb0_.vscreen)));
|
CHECK_NE(-1, (rc = ioctl(fb0_.fd, FBIOGET_VSCREENINFO, &fb0_.vscreen)));
|
||||||
LOGF("ioctl(%s) → %d", "FBIOGET_VSCREENINFO", rc);
|
INFOF("ioctl(%s) → %d", "FBIOGET_VSCREENINFO", rc);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "xres", fb0_.vscreen.xres);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "xres", fb0_.vscreen.xres);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "yres", fb0_.vscreen.yres);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "yres", fb0_.vscreen.yres);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "xres_virtual", fb0_.vscreen.xres_virtual);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "xres_virtual", fb0_.vscreen.xres_virtual);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "yres_virtual", fb0_.vscreen.yres_virtual);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "yres_virtual", fb0_.vscreen.yres_virtual);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "xoffset", fb0_.vscreen.xoffset);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "xoffset", fb0_.vscreen.xoffset);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "yoffset", fb0_.vscreen.yoffset);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "yoffset", fb0_.vscreen.yoffset);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "bits_per_pixel",
|
INFOF("%s.%s=%u", "fb0_.vscreen", "bits_per_pixel",
|
||||||
fb0_.vscreen.bits_per_pixel);
|
fb0_.vscreen.bits_per_pixel);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "grayscale", fb0_.vscreen.grayscale);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "grayscale", fb0_.vscreen.grayscale);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.red", "offset", fb0_.vscreen.red.offset);
|
INFOF("%s.%s=%u", "fb0_.vscreen.red", "offset", fb0_.vscreen.red.offset);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.red", "length", fb0_.vscreen.red.length);
|
INFOF("%s.%s=%u", "fb0_.vscreen.red", "length", fb0_.vscreen.red.length);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.red", "msb_right",
|
INFOF("%s.%s=%u", "fb0_.vscreen.red", "msb_right",
|
||||||
fb0_.vscreen.red.msb_right);
|
fb0_.vscreen.red.msb_right);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.green", "offset", fb0_.vscreen.green.offset);
|
INFOF("%s.%s=%u", "fb0_.vscreen.green", "offset", fb0_.vscreen.green.offset);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.green", "length", fb0_.vscreen.green.length);
|
INFOF("%s.%s=%u", "fb0_.vscreen.green", "length", fb0_.vscreen.green.length);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.green", "msb_right",
|
INFOF("%s.%s=%u", "fb0_.vscreen.green", "msb_right",
|
||||||
fb0_.vscreen.green.msb_right);
|
fb0_.vscreen.green.msb_right);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.blue", "offset", fb0_.vscreen.blue.offset);
|
INFOF("%s.%s=%u", "fb0_.vscreen.blue", "offset", fb0_.vscreen.blue.offset);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.blue", "length", fb0_.vscreen.blue.length);
|
INFOF("%s.%s=%u", "fb0_.vscreen.blue", "length", fb0_.vscreen.blue.length);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.blue", "msb_right",
|
INFOF("%s.%s=%u", "fb0_.vscreen.blue", "msb_right",
|
||||||
fb0_.vscreen.blue.msb_right);
|
fb0_.vscreen.blue.msb_right);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.transp", "offset",
|
INFOF("%s.%s=%u", "fb0_.vscreen.transp", "offset",
|
||||||
fb0_.vscreen.transp.offset);
|
fb0_.vscreen.transp.offset);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.transp", "length",
|
INFOF("%s.%s=%u", "fb0_.vscreen.transp", "length",
|
||||||
fb0_.vscreen.transp.length);
|
fb0_.vscreen.transp.length);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen.transp", "msb_right",
|
INFOF("%s.%s=%u", "fb0_.vscreen.transp", "msb_right",
|
||||||
fb0_.vscreen.transp.msb_right);
|
fb0_.vscreen.transp.msb_right);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "nonstd", fb0_.vscreen.nonstd);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "nonstd", fb0_.vscreen.nonstd);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "activate", fb0_.vscreen.activate);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "activate", fb0_.vscreen.activate);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "height", fb0_.vscreen.height);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "height", fb0_.vscreen.height);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "width", fb0_.vscreen.width);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "width", fb0_.vscreen.width);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "accel_flags", fb0_.vscreen.accel_flags);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "accel_flags", fb0_.vscreen.accel_flags);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "pixclock", fb0_.vscreen.pixclock);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "pixclock", fb0_.vscreen.pixclock);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "left_margin", fb0_.vscreen.left_margin);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "left_margin", fb0_.vscreen.left_margin);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "right_margin", fb0_.vscreen.right_margin);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "right_margin", fb0_.vscreen.right_margin);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "upper_margin", fb0_.vscreen.upper_margin);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "upper_margin", fb0_.vscreen.upper_margin);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "lower_margin", fb0_.vscreen.lower_margin);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "lower_margin", fb0_.vscreen.lower_margin);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "hsync_len", fb0_.vscreen.hsync_len);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "hsync_len", fb0_.vscreen.hsync_len);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "vsync_len", fb0_.vscreen.vsync_len);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "vsync_len", fb0_.vscreen.vsync_len);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "sync", fb0_.vscreen.sync);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "sync", fb0_.vscreen.sync);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "vmode", fb0_.vscreen.vmode);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "vmode", fb0_.vscreen.vmode);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "rotate", fb0_.vscreen.rotate);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "rotate", fb0_.vscreen.rotate);
|
||||||
LOGF("%s.%s=%u", "fb0_.vscreen", "colorspace", fb0_.vscreen.colorspace);
|
INFOF("%s.%s=%u", "fb0_.vscreen", "colorspace", fb0_.vscreen.colorspace);
|
||||||
fb0_.size = fb0_.fscreen.smem_len;
|
fb0_.size = fb0_.fscreen.smem_len;
|
||||||
CHECK_NE(MAP_FAILED,
|
CHECK_NE(MAP_FAILED,
|
||||||
(fb0_.map = mmap(NULL, fb0_.size, PROT_READ | PROT_WRITE,
|
(fb0_.map = mmap(NULL, fb0_.size, PROT_READ | PROT_WRITE,
|
||||||
|
@ -1565,6 +1565,6 @@ int main(int argc, char *argv[]) {
|
||||||
starttime_ = nowl();
|
starttime_ = nowl();
|
||||||
PrintVideo();
|
PrintVideo();
|
||||||
}
|
}
|
||||||
LOGF("jb_ triggered");
|
INFOF("jb_ triggered");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue