Go to the documentation of this file.
62 const int refresh_freq,
65 const unsigned int flags)
83 O_CREAT | O_TRUNC | O_WRONLY,
150 if (so && so->
fd >= 0)
152 lseek(so->
fd, (off_t)0, SEEK_SET);
161 #if defined(HAVE_FTRUNCATE)
163 const off_t off = lseek(so->
fd, (off_t)0, SEEK_CUR);
164 if (ftruncate(so->
fd, off) != 0)
169 #elif defined(HAVE_CHSIZE)
171 const long off = (long) lseek(so->
fd, (off_t)0, SEEK_CUR);
175 #warning both ftruncate and chsize functions appear to be missing from this OS
199 if (close(so->
fd) < 0)
219 #define STATUS_PRINTF_MAXLEN 512
230 va_start(arglist, format);
252 if (
write(so->
fd, buf, len) != len)
struct status_output * status_open(const char *filename, const int refresh_freq, const int msglevel, const struct virtual_output *vout, const unsigned int flags)
bool status_trigger(struct status_output *so)
static void buf_reset(struct buffer *buf)
#define buf_init(buf, offset)
void buf_null_terminate(struct buffer *buf)
static void event_timeout_init(struct event_timeout *et, interval_t n, const time_t last)
Initialises a timer struct.
bool status_read(struct status_output *so, struct buffer *buf)
#define STATUS_OUTPUT_WRITE
char * string_alloc(const char *str, struct gc_arena *gc)
static bool buf_inc_len(struct buffer *buf, int inc)
void status_reset(struct status_output *so)
static bool buf_write_u8(struct buffer *dest, uint8_t data)
void(* func)(void *arg, const unsigned int flags, const char *str)
void status_printf(struct status_output *so, const char *format,...)
Wrapper structure for dynamically allocated memory.
#define STATUS_PRINTF_MAXLEN
bool status_close(struct status_output *so)
void status_flush(struct status_output *so)
void free_buf(struct buffer *buf)
void set_cloexec(socket_descriptor_t fd)
bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, const int et_const_retry)
This is the principal function for testing and triggering recurring timers.
static const char * print_status_mode(unsigned int flags)
#define ALLOC_OBJ_CLEAR(dptr, type)
static int buf_read_u8(struct buffer *buf)
const struct virtual_output * vout
static void event_timeout_clear(struct event_timeout *et)
Clears the timeout and reset all values to 0.
unsigned int flags_default
struct buffer alloc_buf(size_t size)
#define STATUS_OUTPUT_READ
static bool buf_defined(const struct buffer *buf)