jcs's openbsd hax
openbsd
at jcs 28 lines 635 B view raw
1/* $OpenBSD: rthread_debug.c,v 1.3 2017/09/05 02:40:54 guenther Exp $ */ 2 3/* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ 4 5#include <pthread.h> 6#include <stdarg.h> 7#include <stdio.h> 8#include <unistd.h> 9 10#include "rthread.h" 11 12/* 13 * format and send output to stderr if the given "level" is less than or 14 * equal to the current debug level. Messages with a level <= 0 will 15 * always be printed. 16 */ 17void 18_rthread_debug(int level, const char *fmt, ...) 19{ 20 if (_rthread_debug_level >= level) { 21 va_list ap; 22 va_start(ap, fmt); 23 vdprintf(STDERR_FILENO, fmt, ap); 24 va_end(ap); 25 } 26} 27DEF_STRONG(_rthread_debug); 28