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
|
|
|
|
2013-06-02 11:24:06 +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
|
2013-06-02 11:24:06 +00:00
|
|
|
@@ -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__)
|
2013-06-02 11:24:06 +00:00
|
|
|
#include <pthread.h>
|
2012-05-09 11:56:49 +00:00
|
|
|
+#endif
|
2013-06-02 11:24:06 +00:00
|
|
|
#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
|
|
|
|
2013-06-02 11:24:06 +00:00
|
|
|
header = (i3_shmlog_header*)logbuffer;
|
2012-05-09 11:56:49 +00:00
|
|
|
|
|
|
|
+#if !defined(__OpenBSD__)
|
2013-06-02 11:24:06 +00:00
|
|
|
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");
|
2013-06-02 11:24:06 +00:00
|
|
|
pthread_cond_init(&(header->condvar), &cond_attr);
|
2012-05-09 11:56:49 +00:00
|
|
|
+#endif
|
|
|
|
|
2013-06-02 11:24:06 +00:00
|
|
|
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
|
2013-06-02 11:24:06 +00:00
|
|
|
|
2012-05-09 11:56:49 +00:00
|
|
|
store_log_markers();
|
|
|
|
|
|
|
|
+#if !defined(__OpenBSD__)
|
2013-06-02 11:24:06 +00:00
|
|
|
/* Wake up all (i3-dump-log) processes waiting for condvar. */
|
|
|
|
pthread_cond_broadcast(&(header->condvar));
|
2012-05-09 11:56:49 +00:00
|
|
|
+#endif
|
2013-06-02 11:24:06 +00:00
|
|
|
|
2012-05-09 11:56:49 +00:00
|
|
|
if (print)
|
|
|
|
fwrite(message, len, 1, stdout);
|