1*340aa6c7Santon /* $OpenBSD: extern.h,v 1.1 2020/12/03 19:16:57 anton Exp $ */ 2*340aa6c7Santon 3*340aa6c7Santon /* 4*340aa6c7Santon * Copyright (c) 2020 Anton Lindqvist <anton@openbsd.org> 5*340aa6c7Santon * 6*340aa6c7Santon * Permission to use, copy, modify, and distribute this software for any 7*340aa6c7Santon * purpose with or without fee is hereby granted, provided that the above 8*340aa6c7Santon * copyright notice and this permission notice appear in all copies. 9*340aa6c7Santon * 10*340aa6c7Santon * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11*340aa6c7Santon * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12*340aa6c7Santon * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13*340aa6c7Santon * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14*340aa6c7Santon * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15*340aa6c7Santon * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16*340aa6c7Santon * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17*340aa6c7Santon */ 18*340aa6c7Santon 19*340aa6c7Santon #define LOG(l, x...) do { if (loglevel >= l) logit(x); } while (0) 20*340aa6c7Santon 21*340aa6c7Santon struct context { 22*340aa6c7Santon const char *c_path; 23*340aa6c7Santon int c_iterations; 24*340aa6c7Santon }; 25*340aa6c7Santon 26*340aa6c7Santon int ctx_abort(struct context *); 27*340aa6c7Santon 28*340aa6c7Santon void logit(const char *, ...) __attribute__((__format__ (printf, 1, 2))); 29*340aa6c7Santon 30*340aa6c7Santon int test_deadlock(struct context *); 31*340aa6c7Santon 32*340aa6c7Santon extern int loglevel; 33