openbsd-ports/x11/i3/patches/patch-src_log_c
dcoppa 6b4c61c671 Update to i3-4.2
OK jasper@
2012-05-09 11:56:49 +00:00

99 lines
2.6 KiB
Plaintext

$OpenBSD: patch-src_log_c,v 1.3 2012/05/09 11:56:49 dcoppa Exp $
OpenBSD lacks POSIX shared memory support (shm_open() and friends)
--- src/log.c.orig Wed Apr 25 23:21:25 2012
+++ src/log.c Wed May 9 12:21:07 2012
@@ -23,7 +23,9 @@
#include "log.h"
#include "i3.h"
#include "libi3.h"
+#if !defined(__OpenBSD__)
#include "shmlog.h"
+#endif
/* loglevels.h is autogenerated at make time */
#include "loglevels.h"
@@ -35,6 +37,7 @@ char *errorfilename;
/* SHM logging variables */
+#if !defined(__OpenBSD__)
/* The name for the SHM (/i3-log-%pid). Will end up on /dev/shm on most
* systems. Global so that we can clean up at exit. */
char *shmlogname = "";
@@ -66,6 +69,7 @@ static void store_log_markers(void) {
header->offset_last_wrap = (loglastwrap - logbuffer);
header->size = logbuffer_size;
}
+#endif
/*
* Initializes logging by creating an error logfile in /tmp (or
@@ -86,6 +90,7 @@ void init_logging(void) {
}
}
+#if !defined(__OpenBSD__)
/* If this is a debug build (not a release version), we will enable SHM
* logging by default, unless the user turned it off explicitly. */
if (logbuffer == NULL && shmlog_size > 0) {
@@ -122,6 +127,7 @@ void init_logging(void) {
loglastwrap = logbuffer + logbuffer_size;
store_log_markers();
}
+#endif
}
/*
@@ -188,7 +194,9 @@ static void vlog(const bool print, const char *fmt, va
* false true print message only
* false false INVALID, never called
*/
+#if !defined(__OpenBSD__)
if (!logbuffer) {
+#endif
#ifdef DEBUG_TIMING
struct timeval tv;
gettimeofday(&tv, NULL);
@@ -197,6 +205,7 @@ static void vlog(const bool print, const char *fmt, va
printf("%s", message);
#endif
vprintf(fmt, args);
+#if !defined(__OpenBSD__)
} else {
len += vsnprintf(message + len, sizeof(message) - len, fmt, args);
if (len < 0 ) {
@@ -227,6 +236,7 @@ static void vlog(const bool print, const char *fmt, va
if (print)
fwrite(message, len, 1, stdout);
}
+#endif
}
/*
@@ -237,7 +247,11 @@ static void vlog(const bool print, const char *fmt, va
void verboselog(char *fmt, ...) {
va_list args;
+#if !defined(__OpenBSD__)
if (!logbuffer && !verbose)
+#else
+ if (!verbose)
+#endif
return;
va_start(args, fmt);
@@ -272,7 +286,11 @@ void errorlog(char *fmt, ...) {
void debuglog(uint64_t lev, char *fmt, ...) {
va_list args;
+#if !defined(__OpenBSD__)
if (!logbuffer && !(loglevel & lev))
+#else
+ if ((loglevel & lev) == 0)
+#endif
return;
va_start(args, fmt);