Projects
Eulaceura:Factory
audit
_service:obs_scm:backport-Use-atomic_uint-if-av...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:backport-Use-atomic_uint-if-available-for-signal-related-flag.patch of Package audit
From 3955b5e29e119122dc2fc0a53ba82529613e4e1c Mon Sep 17 00:00:00 2001 From: Steve Grubb <sgrubb@redhat.com> Date: Fri, 26 Apr 2024 14:03:02 -0400 Subject: [PATCH] Use atomic_uint if available for signal related flags Conflict:NA Reference:https://github.com/linux-audit/audit-userspace/commit/3955b5e29e119122dc2fc0a53ba82529613e4e1c --- audisp/audispd.c | 7 +++++-- audisp/queue.c | 9 ++++++--- configure.ac | 2 ++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/audisp/audispd.c b/audisp/audispd.c index 0902a073..e4e49087 100644 --- a/audisp/audispd.c +++ b/audisp/audispd.c @@ -37,6 +37,9 @@ #include <limits.h> #include <sys/uio.h> #include <getopt.h> +#ifdef HAVE_ATOMIC +#include <stdatomic.h> +#endif #include "audispd-pconfig.h" #include "audispd-config.h" @@ -46,8 +49,8 @@ #include "private.h" /* Global Data */ -static volatile int stop = 0; -volatile int disp_hup = 0; +static volatile ATOMIC_INT stop = 0; +volatile ATOMIC_INT disp_hup = 0; /* Local data */ static daemon_conf_t daemon_config; diff --git a/audisp/queue.c b/audisp/queue.c index 8bd20ea1..183a5af8 100644 --- a/audisp/queue.c +++ b/audisp/queue.c @@ -25,17 +25,20 @@ #include <stdlib.h> #include <unistd.h> #include <syslog.h> +#ifdef HAVE_ATOMIC +#include <stdatomic.h> +#endif #include "queue.h" static volatile event_t **q; static pthread_mutex_t queue_lock; static pthread_cond_t queue_nonempty; -static unsigned int q_next, q_last, q_depth, processing_suspended; -static unsigned int currently_used, max_used, overflowed; +static unsigned int q_next, q_last, q_depth, processing_suspended, overflowed; +static ATOMIC_UNSIGNED currently_used, max_used; static const char *SINGLE = "1"; static const char *HALT = "0"; static int queue_full_warning = 0; -extern volatile int disp_hup; +extern volatile ATOMIC_INT disp_hup; #define QUEUE_FULL_LIMIT 5 void reset_suspended(void) diff --git a/configure.ac b/configure.ac index f0650f3f..969d36e8 100644 --- a/configure.ac +++ b/configure.ac @@ -89,8 +89,10 @@ AC_LINK_IFELSE( AC_CHECK_HEADERS([stdatomic.h], [ AC_DEFINE([HAVE_ATOMIC], 1, [Define to 1 if you have the <stdatomic.h> header file.]) AC_DEFINE([ATOMIC_INT], atomic_int, [Define atomic_int if you have the <stdatomic.h> header file.]) + AC_DEFINE([ATOMIC_UNSIGNED], atomic_uint, [Define atomic_uint if you have the <stdatomic.h> header file.]) ], [ AC_DEFINE([ATOMIC_INT], int, [Define to the type of an int if <stdatomic.h> is not available.]) + AC_DEFINE([ATOMIC_UNSIGNED], unsigned, [Define to the type of an unsigned if <stdatomic.h> is not available.]) ]) AC_MSG_CHECKING(__attr_access support) AC_COMPILE_IFELSE( -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2