]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: logs: Use the new _HA_ATOMIC_* macros.
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 8 Mar 2019 17:53:21 +0000 (18:53 +0100)
committerOlivier Houchard <cognet@ci0.org>
Mon, 11 Mar 2019 16:02:38 +0000 (17:02 +0100)
Use the new _HA_ATOMIC_* macros and add barriers where needed.

src/log.c

index 826f50e45ecbf0d1cc6190adbee9df55ec59fd41..9fb5c17626c8ddc9739ca733c5159982da0d67c6 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -1559,7 +1559,7 @@ send:
                        static char once;
 
                        if (errno == EAGAIN)
-                               HA_ATOMIC_ADD(&dropped_logs, 1);
+                               _HA_ATOMIC_ADD(&dropped_logs, 1);
                        else if (!once) {
                                once = 1; /* note: no need for atomic ops here */
                                ha_alert("sendmsg()/writev() failed in logger #%d: %s (errno=%d)\n",
@@ -1698,7 +1698,7 @@ void deinit_log_buffers()
        free(logheader_rfc5424);
        free(logline);
        free(logline_rfc5424);
-       tmp_startup_logs = HA_ATOMIC_XCHG(&startup_logs, NULL);
+       tmp_startup_logs = _HA_ATOMIC_XCHG(&startup_logs, NULL);
        free(tmp_startup_logs);
 
        logheader         = NULL;
@@ -1761,7 +1761,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
                txn = NULL;
                be_conn = NULL;
                s_flags = SF_ERR_PRXCOND | SF_FINST_R;
-               uniq_id = HA_ATOMIC_XADD(&global.req_count, 1);
+               uniq_id = _HA_ATOMIC_XADD(&global.req_count, 1);
 
                /* prepare a valid log structure */
                tmp_strm_log.tv_accept = sess->tv_accept;
@@ -2759,7 +2759,7 @@ void strm_log(struct stream *s)
 
        size = build_logline(s, logline, global.max_syslog_len, &sess->fe->logformat);
        if (size > 0) {
-               HA_ATOMIC_ADD(&sess->fe->log_count, 1);
+               _HA_ATOMIC_ADD(&sess->fe->log_count, 1);
                __send_log(sess->fe, level, logline, size + 1, logline_rfc5424, sd_size);
                s->logs.logwait = 0;
        }
@@ -2797,7 +2797,7 @@ void sess_log(struct session *sess)
 
        size = sess_build_logline(sess, NULL, logline, global.max_syslog_len, &sess->fe->logformat);
        if (size > 0) {
-               HA_ATOMIC_ADD(&sess->fe->log_count, 1);
+               _HA_ATOMIC_ADD(&sess->fe->log_count, 1);
                __send_log(sess->fe, level, logline, size + 1, logline_rfc5424, sd_size);
        }
 }