version 1.4, 2017/01/03 06:53:20 |
version 1.5, 2019/07/05 07:34:40 |
|
|
*/ |
*/ |
/* |
/* |
* log_xxx() routines are used to quickly store traces into a trace buffer. |
* log_xxx() routines are used to quickly store traces into a trace buffer. |
* This allows trances to be collected during time sensitive operations without |
* This allows traces to be collected during time sensitive operations without |
* disturbing them. The buffer can be flushed on standard error later, when |
* disturbing them. The buffer can be flushed on standard error later, when |
* slow syscalls are no longer disruptive, e.g. at the end of the poll() loop. |
* slow syscalls are no longer disruptive, e.g. at the end of the poll() loop. |
*/ |
*/ |
|
|
void |
void |
log_flush(void) |
log_flush(void) |
{ |
{ |
if (log_used == 0) |
if (log_used == 0) |
return; |
return; |
write(STDERR_FILENO, log_buf, log_used); |
write(STDERR_FILENO, log_buf, log_used); |
log_used = 0; |
log_used = 0; |
|
|
} |
} |
|
|
/* |
/* |
* allocate a (small) amount of memory, and abort if it fails |
* allocate 'size' bytes of memory (with size > 0). This functions never |
|
* fails (and never returns NULL), if there isn't enough memory then |
|
* abort the program. |
*/ |
*/ |
void * |
void * |
xmalloc(size_t size) |
xmalloc(size_t size) |