2012-01-07 15:59:58 +01:00
|
|
|
|
/*
|
|
|
|
|
* vim:ts=4:sw=4:expandtab
|
|
|
|
|
*
|
|
|
|
|
* i3 - an improved dynamic tiling window manager
|
2015-04-04 02:17:56 +02:00
|
|
|
|
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
|
2012-01-07 15:59:58 +01:00
|
|
|
|
*
|
|
|
|
|
* The format of the shmlog data structure which i3 development versions use by
|
|
|
|
|
* default (ringbuffer for storing the debug log).
|
|
|
|
|
*
|
|
|
|
|
*/
|
2013-12-29 03:11:50 +01:00
|
|
|
|
#pragma once
|
2012-01-07 15:59:58 +01:00
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2012-08-13 00:57:57 +02:00
|
|
|
|
#include <pthread.h>
|
2012-01-07 15:59:58 +01:00
|
|
|
|
|
2013-06-05 14:59:05 +02:00
|
|
|
|
/* Default shmlog size if not set by user. */
|
|
|
|
|
extern const int default_shmlog_size;
|
|
|
|
|
|
2012-08-13 00:57:57 +02:00
|
|
|
|
/*
|
|
|
|
|
* Header of the shmlog file. Used by i3/src/log.c and i3/i3-dump-log/main.c.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2012-01-07 15:59:58 +01:00
|
|
|
|
typedef struct i3_shmlog_header {
|
2012-08-13 00:57:57 +02:00
|
|
|
|
/* Byte offset where the next line will be written to. */
|
2012-01-07 15:59:58 +01:00
|
|
|
|
uint32_t offset_next_write;
|
2012-08-13 00:57:57 +02:00
|
|
|
|
|
2016-04-04 09:33:59 +02:00
|
|
|
|
/* Byte offset where the last wrap occurred. */
|
2012-01-07 15:59:58 +01:00
|
|
|
|
uint32_t offset_last_wrap;
|
2012-08-13 00:57:57 +02:00
|
|
|
|
|
|
|
|
|
/* The size of the logfile in bytes. Since the size is limited to 25 MiB
|
|
|
|
|
* an uint32_t is sufficient. */
|
2012-01-07 15:59:58 +01:00
|
|
|
|
uint32_t size;
|
2012-08-13 00:57:57 +02:00
|
|
|
|
|
|
|
|
|
/* 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;
|
2012-01-07 15:59:58 +01:00
|
|
|
|
} i3_shmlog_header;
|