aboutsummaryrefslogtreecommitdiffstats
path: root/x11-wm
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2013-03-21 01:19:06 +0800
committerbapt <bapt@FreeBSD.org>2013-03-21 01:19:06 +0800
commit844886bc2e514ad60955cc386522cf8ce48d0cdc (patch)
treedf5fe84dc1316d8ac1709f26f319a464524f7d32 /x11-wm
parent69de3879926ff2186272cfeb7073e696e06e61e6 (diff)
downloadfreebsd-ports-gnome-844886bc2e514ad60955cc386522cf8ce48d0cdc.tar.gz
freebsd-ports-gnome-844886bc2e514ad60955cc386522cf8ce48d0cdc.tar.zst
freebsd-ports-gnome-844886bc2e514ad60955cc386522cf8ce48d0cdc.zip
Add a patch to make the optional shmlog mechanism works on FreeBSD.
This allows users to use i3-dump-log to gets logs out of i3 is it was run with the shmlog-size parameter set to something greater than 0
Diffstat (limited to 'x11-wm')
-rw-r--r--x11-wm/i3/Makefile1
-rw-r--r--x11-wm/i3/files/patch-src__log.c68
2 files changed, 69 insertions, 0 deletions
diff --git a/x11-wm/i3/Makefile b/x11-wm/i3/Makefile
index 1be60e1b52dc..4eda2f3cb8f2 100644
--- a/x11-wm/i3/Makefile
+++ b/x11-wm/i3/Makefile
@@ -3,6 +3,7 @@
PORTNAME= i3
DISTVERSION= 4.5.1
+PORTREVISION= 1
CATEGORIES= x11-wm
MASTER_SITES= http://i3wm.org/downloads/ \
${MASTER_SITE_LOCAL}
diff --git a/x11-wm/i3/files/patch-src__log.c b/x11-wm/i3/files/patch-src__log.c
new file mode 100644
index 000000000000..5c50252eeb57
--- /dev/null
+++ b/x11-wm/i3/files/patch-src__log.c
@@ -0,0 +1,68 @@
+--- ./src/log.c.orig 2013-03-20 15:28:14.746383400 +0100
++++ ./src/log.c 2013-03-20 18:27:56.885378021 +0100
+@@ -81,11 +81,11 @@
+ void init_logging(void) {
+ if (!errorfilename) {
+ if (!(errorfilename = get_process_filename("errorlog")))
+- ELOG("Could not initialize errorlog\n");
++ fprintf(stderr, "Could not initialize errorlog\n");
+ else {
+ errorfile = fopen(errorfilename, "w");
+ if (fcntl(fileno(errorfile), F_SETFD, FD_CLOEXEC)) {
+- ELOG("Could not set close-on-exec flag\n");
++ fprintf(stderr, "Could not set close-on-exec flag\n");
+ }
+ }
+ }
+@@ -107,25 +107,28 @@
+ sysconf(_SC_PAGESIZE);
+ #endif
+ logbuffer_size = min(physical_mem_bytes * 0.01, shmlog_size);
+- sasprintf(&shmlogname, "/i3-log-%d", getpid());
++#if defined(__FreeBSD__)
++ asprintf(&shmlogname, "/tmp/i3-log-%d", getpid());
++#else
++ asprintf(&shmlogname, "/i3-log-%d", getpid());
++#endif
+ logbuffer_shm = shm_open(shmlogname, O_RDWR | O_CREAT, S_IREAD | S_IWRITE);
+ if (logbuffer_shm == -1) {
+- ELOG("Could not shm_open SHM segment for the i3 log: %s\n", strerror(errno));
++ fprintf(stderr, "Could not shm_open SHM segment for the i3 log: %s\n", strerror(errno));
+ return;
+ }
+-
+ if (ftruncate(logbuffer_shm, logbuffer_size) == -1) {
+ close(logbuffer_shm);
+- shm_unlink("/i3-log-");
+- ELOG("Could not ftruncate SHM segment for the i3 log: %s\n", strerror(errno));
++ shm_unlink(shmlogname);
++ fprintf(stderr, "Could not ftruncate SHM segment for the i3 log: %s\n", strerror(errno));
+ return;
+ }
+
+ logbuffer = mmap(NULL, logbuffer_size, PROT_READ | PROT_WRITE, MAP_SHARED, logbuffer_shm, 0);
+ if (logbuffer == MAP_FAILED) {
+ close(logbuffer_shm);
+- shm_unlink("/i3-log-");
+- ELOG("Could not mmap SHM segment for the i3 log: %s\n", strerror(errno));
++ shm_unlink(shmlogname);
++ fprintf(stderr, "Could not mmap SHM segment for the i3 log: %s\n", strerror(errno));
+ logbuffer = NULL;
+ return;
+ }
+@@ -138,13 +141,14 @@
+ 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");
++ fprintf(stderr, "pthread_condattr_setpshared() failed, i3-dump-log -f will not work!\n");
+ pthread_cond_init(&(header->condvar), &cond_attr);
+
+ logwalk = logbuffer + sizeof(i3_shmlog_header);
+ loglastwrap = logbuffer + logbuffer_size;
+ store_log_markers();
+ }
++
+ atexit(purge_zerobyte_logfile);
+ }
+