From d9a7a8a4d4a23fb65e6319e0e8a435046cc39fea Mon Sep 17 00:00:00 2001 From: comex Date: Sat, 28 Feb 2015 13:16:36 -0500 Subject: Rename ios-bootstrap to darwin-bootstrap; cleanup posixspawn-hook and unrestrict. Not tested yet. --- darwin-bootstrap/ib-log.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 darwin-bootstrap/ib-log.h (limited to 'darwin-bootstrap/ib-log.h') diff --git a/darwin-bootstrap/ib-log.h b/darwin-bootstrap/ib-log.h new file mode 100644 index 0000000..fee70b5 --- /dev/null +++ b/darwin-bootstrap/ib-log.h @@ -0,0 +1,27 @@ +#pragma once +#include +#include +#include + +static FILE *logfp; +static void open_logfp_if_necessary() { + /* syslog() doesn't seem to work from launchd... */ + static dispatch_once_t pred; + dispatch_once(&pred, ^{ + char filename[128]; + sprintf(filename, "/tmp/substitute-" IB_LOG_NAME "-log.%ld", + (long) getpid()); + logfp = fopen(filename, "w"); + if (!logfp) { + /* Ack... */ + logfp = stderr; + } + }); +} +#define ib_log(fmt, args...) do { \ + open_logfp_if_necessary(); \ + fprintf(logfp, fmt "\n", ##args); \ + fflush(logfp); \ +} while(0) + +#define IB_VERBOSE 0 -- cgit v1.2.3