openbsd-ports/x11/i3/patches/patch-src_log_c

42 lines
1.3 KiB
Plaintext
Raw Normal View History

2013-08-13 10:01:54 +00:00
$OpenBSD: patch-src_log_c,v 1.6 2013/08/13 10:01:57 dcoppa Exp $
2012-05-09 11:56:49 +00:00
OpenBSD lacks pthread_condattr_setpshared()
2012-05-09 11:56:49 +00:00
2013-08-13 10:01:54 +00:00
--- src/log.c.orig Wed Aug 7 20:50:24 2013
+++ src/log.c Mon Aug 12 15:24:01 2013
@@ -20,7 +20,9 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <errno.h>
2012-05-09 11:56:49 +00:00
+#if !defined(__OpenBSD__)
#include <pthread.h>
2012-05-09 11:56:49 +00:00
+#endif
#if defined(__APPLE__)
#include <sys/types.h>
#include <sys/sysctl.h>
2013-08-13 10:01:54 +00:00
@@ -148,11 +150,13 @@ void open_logbuffer(void) {
2012-05-09 11:56:49 +00:00
header = (i3_shmlog_header*)logbuffer;
2012-05-09 11:56:49 +00:00
+#if !defined(__OpenBSD__)
pthread_condattr_t cond_attr;
pthread_condattr_init(&cond_attr);
if (pthread_condattr_setpshared(&cond_attr, PTHREAD_PROCESS_SHARED) != 0)
2013-08-13 10:01:54 +00:00
fprintf(stderr, "pthread_condattr_setpshared() failed, i3-dump-log -f will not work!\n");
pthread_cond_init(&(header->condvar), &cond_attr);
2012-05-09 11:56:49 +00:00
+#endif
logwalk = logbuffer + sizeof(i3_shmlog_header);
2012-05-09 11:56:49 +00:00
loglastwrap = logbuffer + logbuffer_size;
2013-08-13 10:01:54 +00:00
@@ -258,8 +262,10 @@ static void vlog(const bool print, const char *fmt, va
2012-05-09 11:56:49 +00:00
store_log_markers();
+#if !defined(__OpenBSD__)
/* Wake up all (i3-dump-log) processes waiting for condvar. */
pthread_cond_broadcast(&(header->condvar));
2012-05-09 11:56:49 +00:00
+#endif
2012-05-09 11:56:49 +00:00
if (print)
fwrite(message, len, 1, stdout);