On Wed, Dec 10, 2014 at 04:12:25PM -0600, Tyler Hicks wrote: > The parser's copy of the two atomic operations will be removed once the > new API's (aa_match, aa_features, aa_policy_cache, aa_kernel_interface) > are moved from the parser to libapparmor. > > Signed-off-by: Tyler Hicks <[email protected]>
Acked-by: Seth Arnold <[email protected]> Thanks > --- > libraries/libapparmor/src/private.c | 10 ++++++++++ > libraries/libapparmor/src/private.h | 4 ++++ > 2 files changed, 14 insertions(+) > > diff --git a/libraries/libapparmor/src/private.c > b/libraries/libapparmor/src/private.c > index 1143a34..255585f 100644 > --- a/libraries/libapparmor/src/private.c > +++ b/libraries/libapparmor/src/private.c > @@ -52,6 +52,16 @@ static struct ignored_suffix_t ignored_suffixes[] = { > { NULL, 0, 0 } > }; > > +void atomic_inc(unsigned int *v) > +{ > + __sync_add_and_fetch(v, 1); > +} > + > +bool atomic_dec_and_test(unsigned int *v) > +{ > + return __sync_sub_and_fetch(v, 1) == 0; > +} > + > int _aa_is_blacklisted(const char *name, const char *path) > { > int name_len; > diff --git a/libraries/libapparmor/src/private.h > b/libraries/libapparmor/src/private.h > index 3007294..2ef3088 100644 > --- a/libraries/libapparmor/src/private.h > +++ b/libraries/libapparmor/src/private.h > @@ -17,10 +17,14 @@ > #ifndef _AA_PRIVATE_H > #define _AA_PRIVATE_H 1 > > +#include <stdbool.h> > #include <sys/apparmor_private.h> > > #define autofree __attribute((cleanup(_aa_autofree))) > #define autoclose __attribute((cleanup(_aa_autoclose))) > #define autofclose __attribute((cleanup(_aa_autofclose))) > > +void atomic_inc(unsigned int *v); > +bool atomic_dec_and_test(unsigned int *v); > + > #endif /* _AA_PRIVATE_H */ > -- > 2.1.0
signature.asc
Description: Digital signature
-- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
