Jens Axboe | bf84eac | 2010-03-19 16:41:52 +0100 | [diff] [blame^] | 1 | #include <stdarg.h> |
| 2 | #include <sys/types.h> |
| 3 | #include <unistd.h> |
| 4 | #include "debug.h" |
| 5 | |
| 6 | void __dprint(int type, const char *str, ...) |
| 7 | { |
| 8 | va_list args; |
| 9 | pid_t pid; |
| 10 | |
| 11 | assert(type < FD_DEBUG_MAX); |
| 12 | |
| 13 | if ((((1 << type)) & fio_debug) == 0) |
| 14 | return; |
| 15 | |
| 16 | pid = getpid(); |
| 17 | if (fio_debug_jobp && *fio_debug_jobp != -1U |
| 18 | && pid != *fio_debug_jobp) |
| 19 | return; |
| 20 | |
| 21 | log_info("%-8s ", debug_levels[(type)].name); |
| 22 | log_info("%-5u ", (int) pid); |
| 23 | |
| 24 | va_start(args, str); |
| 25 | vfprintf(f_out, str, args); |
| 26 | va_end(args); |
| 27 | } |