i3-dump-log -f: switch from pthreads to UNIX sockets

fixes #4117
This commit is contained in:
Michael Stapelberg
2021-01-15 16:12:55 +01:00
committed by Michael Stapelberg
parent 131a6158c8
commit dcd6079c9b
14 changed files with 142 additions and 82 deletions

View File

@ -15,6 +15,7 @@ xmacro(I3_CONFIG_PATH) \
xmacro(I3_SYNC) \
xmacro(I3_SHMLOG_PATH) \
xmacro(I3_PID) \
xmacro(I3_LOG_STREAM_SOCKET_PATH) \
xmacro(I3_FLOATING_WINDOW) \
xmacro(_NET_REQUEST_FRAME_EXTENTS) \
xmacro(_NET_FRAME_EXTENTS) \

View File

@ -80,13 +80,6 @@ void ipc_new_client(EV_P_ struct ev_io *w, int revents);
*/
ipc_client *ipc_new_client_on_fd(EV_P_ int fd);
/**
* Creates the UNIX domain socket at the given path, sets it to non-blocking
* mode, bind()s and listen()s on it.
*
*/
int ipc_create_socket(const char *filename);
/**
* Sends the specified event to all IPC clients which are currently connected
* and subscribed to this kind of event.

View File

@ -10,6 +10,7 @@
#pragma once
#include <config.h>
#include <ev.h>
/* We will include libi3.h which define its own version of LOG, ELOG.
* We want *our* version, so we undef the libi3 one. */
@ -31,6 +32,7 @@
extern char *errorfilename;
extern char *shmlogname;
extern int shmlog_size;
extern char *current_log_stream_socket_path;
/**
* Initializes logging by creating an error logfile in /tmp (or
@ -100,3 +102,5 @@ void verboselog(char *fmt, ...)
* failures. This function is invoked automatically when exiting.
*/
void purge_zerobyte_logfile(void);
void log_new_client(EV_P_ struct ev_io *w, int revents);

View File

@ -12,10 +12,6 @@
#include <config.h>
#if !defined(__OpenBSD__)
#include <pthread.h>
#endif
/* Default shmlog size if not set by user. */
extern const int default_shmlog_size;
@ -39,11 +35,4 @@ typedef struct i3_shmlog_header {
* coincidentally be exactly the same as previously). Overflows can happen
* and dont matter — clients use an equality check (==). */
uint32_t wrap_count;
#if !defined(__OpenBSD__)
/* pthread condvar which will be broadcasted whenever there is a new
* message in the log. i3-dump-log uses this to implement -f (follow, like
* tail -f) in an efficient way. */
pthread_cond_t condvar;
#endif
} i3_shmlog_header;