contrib
debian
docs
i3-config-wizard
i3-dump-log
i3-input
i3-msg
i3-nagbar
i3bar
include
i3
all.h
assignments.h
atoms.xmacro
click.h
cmdparse.h
commands.h
commands_parser.h
con.h
config.h
data.h
debug.h
display_version.h
ewmh.h
fake_outputs.h
floating.h
handlers.h
i3.h
ipc.h
key_press.h
libi3.h
load_layout.h
log.h
manage.h
match.h
move.h
output.h
queue.h
randr.h
regex.h
render.h
resize.h
scratchpad.h
sd-daemon.h
shmlog.h
sighandler.h
startup.h
tree.h
util.h
window.h
workspace.h
x.h
xcb.h
xcb_compat.h
xcursor.h
xinerama.h
libi3
man
parser-specs
src
testcases
tests
yajl-fallback
.gitignore
DEPENDS
LICENSE
Makefile
PACKAGE-MAINTAINER
RELEASE-NOTES-4.2
RELEASE-NOTES-4.3
common.mk
generate-command-parser.pl
i3-migrate-config-to-v4
i3-sensible-editor
i3-sensible-pager
i3-sensible-terminal
i3.applications.desktop
i3.config
i3.config.keycodes
i3.xsession.desktop
logo.svg
pseudo-doc.doxygen
This changes the SHM log format, it doesn’t use 0-bytes to separate entries anymore. Instead of using lots of printf() calls in i3-dump-log, we now do precisely one big write(). So, to be clear: i3-dump-log and i3 both need to be upgraded. Mismatching versions will lead to garbage output (no crashes of i3, just garbage output). The -f flag uses an inter-process pthread_cond_t in the shared memory header to broadcast the arrival of new messages to all i3-dump-log processes. This internally uses futexes and thus doesn’t even mean a kernel call in most cases. inter-process pthread_cond_ts require NPTL (the Native Posix Thread Library, introduce in Linux 2.6).
45 lines
1.4 KiB
C
45 lines
1.4 KiB
C
/*
|
||
* vim:ts=4:sw=4:expandtab
|
||
*
|
||
* i3 - an improved dynamic tiling window manager
|
||
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE)
|
||
*
|
||
* The format of the shmlog data structure which i3 development versions use by
|
||
* default (ringbuffer for storing the debug log).
|
||
*
|
||
*/
|
||
#ifndef _I3_SHMLOG_H
|
||
#define _I3_SHMLOG_H
|
||
|
||
#include <stdint.h>
|
||
#include <pthread.h>
|
||
|
||
/*
|
||
* Header of the shmlog file. Used by i3/src/log.c and i3/i3-dump-log/main.c.
|
||
*
|
||
*/
|
||
typedef struct i3_shmlog_header {
|
||
/* Byte offset where the next line will be written to. */
|
||
uint32_t offset_next_write;
|
||
|
||
/* Byte offset where the last wrap occured. */
|
||
uint32_t offset_last_wrap;
|
||
|
||
/* The size of the logfile in bytes. Since the size is limited to 25 MiB
|
||
* an uint32_t is sufficient. */
|
||
uint32_t size;
|
||
|
||
/* wrap counter. We need it to reliably signal to clients that we just
|
||
* wrapped (clients cannot use offset_last_wrap because that might
|
||
* coincidentally be exactly the same as previously). Overflows can happen
|
||
* and don’t matter — clients use an equality check (==). */
|
||
uint32_t wrap_count;
|
||
|
||
/* 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;
|
||
} i3_shmlog_header;
|
||
|
||
#endif
|