summaryrefslogtreecommitdiff
path: root/include/haproxy/errors.h
diff options
context:
space:
mode:
authorWilliam Lallemand <wlallemand@haproxy.org>2022-09-26 12:54:39 +0200
committerWilliam Lallemand <wlallemand@haproxy.org>2022-10-13 16:50:22 +0200
commiteba6a54cd4c774fe06cf5f60a86192855ae4fee2 (patch)
tree1251dd3873f0a783050a2e8650c266eda127b00c /include/haproxy/errors.h
parent35df34223b5d45db8b498def39bd720a8d3f810e (diff)
downloadhaproxy-eba6a54cd4c774fe06cf5f60a86192855ae4fee2.tar.gz
MINOR: logs: startup-logs can use a shm for logging the reload
When compiled with USE_SHM_OPEN=1 the startup-logs are now able to use an shm which is used to keep the logs when switching to mworker wait mode. This allows to keep the failed reload logs. When allocating the startup-logs at first start of the process, haproxy will do a shm_open with a unique path using the PID of the process, the file is unlink immediatly so we don't let unwelcomed files be. The fd resulting from this shm is stored in the HAPROXY_STARTUPLOGS_FD environment variable so it can be mmap again when switching to wait mode. When forking children, the process is copying the mmap to a a mallocated ring so we never share the same memory section between the master and the workers. When switching to wait mode, the shm is not used anymore as it is also copied to a mallocated structure. This allow to use the "show startup-logs" command over the master CLI, to get the logs of the latest startup or reload. This way the logs of the latest failed reload are also kept. This is only activated on the linux-glibc target for now.
Diffstat (limited to 'include/haproxy/errors.h')
-rw-r--r--include/haproxy/errors.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/haproxy/errors.h b/include/haproxy/errors.h
index e9ad58835..81a4b2f11 100644
--- a/include/haproxy/errors.h
+++ b/include/haproxy/errors.h
@@ -43,6 +43,7 @@
#define ERR_CODE (ERR_RETRYABLE|ERR_FATAL|ERR_ABORT) /* mask */
+extern struct ring *startup_logs;
/* These codes may be used by config parsing functions which detect errors and
* which need to inform the upper layer about them. They are all prefixed with
@@ -123,6 +124,10 @@ void ha_notice(const char *fmt, ...)
void qfprintf(FILE *out, const char *fmt, ...)
__attribute__ ((format(printf, 2, 3)));
+void startup_logs_init();
+struct ring *startup_logs_dup(struct ring *src);
+void startup_logs_free(struct ring *r);
+
#endif /* _HAPROXY_ERRORS_H */
/*