i3/include/shmlog.h
Michael Stapelberg d638e3029a don’t use reversed identifiers for include guards (Thanks Markus)
Done with:

    sed -in 's/\(ifndef\|define\) _\([0-9A-Z_]*\)$/\1 I3_\2/' include/**/*.h

fixes #804
2012-09-21 15:36:25 +02:00

45 lines
1.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 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_I3_SHMLOG_H
#define I3_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 dont 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