openbsd-ports/x11/i3/patches/patch-src_log_c
2013-06-02 11:24:06 +00:00

42 lines
1.3 KiB
Plaintext

$OpenBSD: patch-src_log_c,v 1.5 2013/06/02 11:24:06 dcoppa Exp $
OpenBSD lacks pthread_condattr_setpshared()
--- src/log.c.orig Mon Mar 18 22:43:36 2013
+++ src/log.c Sun Jun 2 11:03:45 2013
@@ -20,7 +20,9 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <errno.h>
+#if !defined(__OpenBSD__)
#include <pthread.h>
+#endif
#if defined(__APPLE__)
#include <sys/types.h>
#include <sys/sysctl.h>
@@ -135,11 +137,13 @@ void init_logging(void) {
header = (i3_shmlog_header*)logbuffer;
+#if !defined(__OpenBSD__)
pthread_condattr_t cond_attr;
pthread_condattr_init(&cond_attr);
if (pthread_condattr_setpshared(&cond_attr, PTHREAD_PROCESS_SHARED) != 0)
ELOG("pthread_condattr_setpshared() failed, i3-dump-log -f will not work!\n");
pthread_cond_init(&(header->condvar), &cond_attr);
+#endif
logwalk = logbuffer + sizeof(i3_shmlog_header);
loglastwrap = logbuffer + logbuffer_size;
@@ -228,8 +232,10 @@ static void vlog(const bool print, const char *fmt, va
store_log_markers();
+#if !defined(__OpenBSD__)
/* Wake up all (i3-dump-log) processes waiting for condvar. */
pthread_cond_broadcast(&(header->condvar));
+#endif
if (print)
fwrite(message, len, 1, stdout);