|
suricata
|

Go to the source code of this file.
Macros | |
| #define | SC_ATOMIC_MEMORY_ORDER_RELAXED |
| #define | SC_ATOMIC_MEMORY_ORDER_CONSUME |
| #define | SC_ATOMIC_MEMORY_ORDER_ACQUIRE |
| #define | SC_ATOMIC_MEMORY_ORDER_RELEASE |
| #define | SC_ATOMIC_MEMORY_ORDER_ACQ_REL |
| #define | SC_ATOMIC_MEMORY_ORDER_SEQ_CST |
| #define | SCAtomicCompareAndSwap(addr, tv, nv) __sync_bool_compare_and_swap((addr), (tv), (nv)) |
| wrapper for OS/compiler specific atomic compare and swap (CAS) function. More... | |
| #define | SCAtomicFetchAndAdd(addr, value) __sync_fetch_and_add((addr), (value)) |
| wrapper for OS/compiler specific atomic fetch and add function. More... | |
| #define | SCAtomicFetchAndSub(addr, value) __sync_fetch_and_sub((addr), (value)) |
| wrapper for OS/compiler specific atomic fetch and sub function. More... | |
| #define | SCAtomicAddAndFetch(addr, value) __sync_add_and_fetch((addr), (value)) |
| wrapper for OS/compiler specific atomic fetch and add function. More... | |
| #define | SCAtomicSubAndFetch(addr, value) __sync_sub_and_fetch((addr), (value)) |
| wrapper for OS/compiler specific atomic fetch and sub function. More... | |
| #define | SCAtomicFetchAndAnd(addr, value) __sync_fetch_and_and((addr), (value)) |
| wrapper for OS/compiler specific atomic fetch and "AND" function. More... | |
| #define | SCAtomicFetchAndNand(addr, value) __sync_fetch_and_nand((addr), (value)) |
| wrapper for OS/compiler specific atomic fetch and "NAND" function. More... | |
| #define | SCAtomicFetchAndXor(addr, value) __sync_fetch_and_xor((addr), (value)) |
| wrapper for OS/compiler specific atomic fetch and "XOR" function. More... | |
| #define | SCAtomicFetchAndOr(addr, value) __sync_fetch_and_or((addr), (value)) |
| wrapper for OS/compiler specific atomic fetch and or function. More... | |
| #define | SC_ATOMIC_DECLARE(type, name) type name ## _sc_atomic__ |
| wrapper for declaring atomic variables. More... | |
| #define | SC_ATOMIC_EXTERN(type, name) extern type name ## _sc_atomic__ |
| wrapper for referencing an atomic variable declared on another file. More... | |
| #define | SC_ATOMIC_DECL_AND_INIT_WITH_VAL(type, name, val) type name##_sc_atomic__ = val |
| wrapper for declaring an atomic variable and initializing it to a specific value More... | |
| #define | SC_ATOMIC_DECL_AND_INIT(type, name) type name ## _sc_atomic__ = 0 |
| wrapper for declaring an atomic variable and initializing it. More... | |
| #define | SC_ATOMIC_INIT(name) (name ## _sc_atomic__) = 0 |
| wrapper for initializing an atomic variable. More... | |
| #define | SC_ATOMIC_INITPTR(name) (name ## _sc_atomic__) = NULL |
| #define | SC_ATOMIC_RESET(name) (name ## _sc_atomic__) = 0 |
| wrapper for reinitializing an atomic variable. More... | |
| #define | SC_ATOMIC_ADD(name, val) SCAtomicFetchAndAdd(&(name ## _sc_atomic__), (val)) |
| add a value to our atomic variable More... | |
| #define | SC_ATOMIC_SUB(name, val) SCAtomicFetchAndSub(&(name ## _sc_atomic__), (val)) |
| sub a value from our atomic variable More... | |
| #define | SC_ATOMIC_OR(name, val) SCAtomicFetchAndOr(&(name ## _sc_atomic__), (val)) |
| Bitwise OR a value to our atomic variable. More... | |
| #define | SC_ATOMIC_AND(name, val) SCAtomicFetchAndAnd(&(name ## _sc_atomic__), (val)) |
| Bitwise AND a value to our atomic variable. More... | |
| #define | SC_ATOMIC_CAS(name, cmpval, newval) SCAtomicCompareAndSwap((name ## _sc_atomic__), cmpval, newval) |
| atomic Compare and Switch More... | |
| #define | SC_ATOMIC_GET(name) (name ## _sc_atomic__) |
| Get the value from the atomic variable. More... | |
| #define | SC_ATOMIC_LOAD_EXPLICIT(name, order) (name ## _sc_atomic__) |
| #define | SC_ATOMIC_SET(name, val) |
| Set the value for the atomic variable. More... | |
Functions | |
| void | SCAtomicRegisterTests (void) |
API for atomic operations. Uses C11 atomic instructions where available, GCC/clang specific (gnu99) operations otherwise.
To prevent developers from accidentally working with the atomic variables directly instead of through the proper macro's, a marco trick is performed that exposes different variable names than the developer uses. So if the dev uses "somevar", internally "somevar_sc_atomic__" is used.
Definition in file util-atomic.h.
| #define SC_ATOMIC_ADD | ( | name, | |
| val | |||
| ) | SCAtomicFetchAndAdd(&(name ## _sc_atomic__), (val)) |
add a value to our atomic variable
| name | the atomic variable |
| val | the value to add to the variable |
Definition at line 333 of file util-atomic.h.
| #define SC_ATOMIC_AND | ( | name, | |
| val | |||
| ) | SCAtomicFetchAndAnd(&(name ## _sc_atomic__), (val)) |
Bitwise AND a value to our atomic variable.
| name | the atomic variable |
| val | the value to AND to the variable |
Definition at line 360 of file util-atomic.h.
| #define SC_ATOMIC_CAS | ( | name, | |
| cmpval, | |||
| newval | |||
| ) | SCAtomicCompareAndSwap((name ## _sc_atomic__), cmpval, newval) |
atomic Compare and Switch
Definition at line 368 of file util-atomic.h.
wrapper for declaring an atomic variable and initializing it.
Definition at line 309 of file util-atomic.h.
wrapper for declaring an atomic variable and initializing it to a specific value
Definition at line 304 of file util-atomic.h.
wrapper for declaring atomic variables.
| type | Type of the variable (char, short, int, long, long long) |
| name | Name of the variable. |
We just declare the variable here as we rely on atomic operations to modify it, so no need for locks.
Definition at line 281 of file util-atomic.h.
wrapper for referencing an atomic variable declared on another file.
| type | Type of the variable (char, short, int, long, long long) |
| name | Name of the variable. |
We just declare the variable here as we rely on atomic operations to modify it, so no need for locks.
Definition at line 297 of file util-atomic.h.
Get the value from the atomic variable.
| var | value |
Definition at line 376 of file util-atomic.h.
wrapper for initializing an atomic variable.
Definition at line 315 of file util-atomic.h.
Definition at line 318 of file util-atomic.h.
Definition at line 379 of file util-atomic.h.
| #define SC_ATOMIC_MEMORY_ORDER_ACQ_REL |
Definition at line 170 of file util-atomic.h.
| #define SC_ATOMIC_MEMORY_ORDER_ACQUIRE |
Definition at line 168 of file util-atomic.h.
| #define SC_ATOMIC_MEMORY_ORDER_CONSUME |
Definition at line 167 of file util-atomic.h.
| #define SC_ATOMIC_MEMORY_ORDER_RELAXED |
Definition at line 166 of file util-atomic.h.
| #define SC_ATOMIC_MEMORY_ORDER_RELEASE |
Definition at line 169 of file util-atomic.h.
| #define SC_ATOMIC_MEMORY_ORDER_SEQ_CST |
Definition at line 171 of file util-atomic.h.
| #define SC_ATOMIC_OR | ( | name, | |
| val | |||
| ) | SCAtomicFetchAndOr(&(name ## _sc_atomic__), (val)) |
Bitwise OR a value to our atomic variable.
| name | the atomic variable |
| val | the value to OR to the variable |
Definition at line 351 of file util-atomic.h.
wrapper for reinitializing an atomic variable.
Definition at line 324 of file util-atomic.h.
| #define SC_ATOMIC_SET | ( | name, | |
| val | |||
| ) |
Set the value for the atomic variable.
| var | value |
Definition at line 387 of file util-atomic.h.
| #define SC_ATOMIC_SUB | ( | name, | |
| val | |||
| ) | SCAtomicFetchAndSub(&(name ## _sc_atomic__), (val)) |
sub a value from our atomic variable
| name | the atomic variable |
| val | the value to sub from the variable |
Definition at line 342 of file util-atomic.h.
| #define SCAtomicAddAndFetch | ( | addr, | |
| value | |||
| ) | __sync_add_and_fetch((addr), (value)) |
wrapper for OS/compiler specific atomic fetch and add function.
| addr | Address of the variable to add to |
| value | Value to add to the variable at addr |
Definition at line 214 of file util-atomic.h.
wrapper for OS/compiler specific atomic compare and swap (CAS) function.
| addr | Address of the variable to CAS |
| tv | Test value to compare the value at address against |
| nv | New value to set the variable at addr to |
| 0 | CAS failed |
| 1 | CAS succeeded |
Definition at line 184 of file util-atomic.h.
| #define SCAtomicFetchAndAdd | ( | addr, | |
| value | |||
| ) | __sync_fetch_and_add((addr), (value)) |
wrapper for OS/compiler specific atomic fetch and add function.
| addr | Address of the variable to add to |
| value | Value to add to the variable at addr |
Definition at line 194 of file util-atomic.h.
| #define SCAtomicFetchAndAnd | ( | addr, | |
| value | |||
| ) | __sync_fetch_and_and((addr), (value)) |
wrapper for OS/compiler specific atomic fetch and "AND" function.
| addr | Address of the variable to AND to |
| value | Value to add to the variable at addr |
Definition at line 234 of file util-atomic.h.
| #define SCAtomicFetchAndNand | ( | addr, | |
| value | |||
| ) | __sync_fetch_and_nand((addr), (value)) |
wrapper for OS/compiler specific atomic fetch and "NAND" function.
| addr | Address of the variable to NAND to |
| value | Value to add to the variable at addr |
Definition at line 244 of file util-atomic.h.
| #define SCAtomicFetchAndOr | ( | addr, | |
| value | |||
| ) | __sync_fetch_and_or((addr), (value)) |
wrapper for OS/compiler specific atomic fetch and or function.
| addr | Address of the variable to or to |
| value | Value to add to the variable at addr |
Definition at line 264 of file util-atomic.h.
| #define SCAtomicFetchAndSub | ( | addr, | |
| value | |||
| ) | __sync_fetch_and_sub((addr), (value)) |
wrapper for OS/compiler specific atomic fetch and sub function.
| addr | Address of the variable to add to |
| value | Value to sub from the variable at addr |
Definition at line 204 of file util-atomic.h.
| #define SCAtomicFetchAndXor | ( | addr, | |
| value | |||
| ) | __sync_fetch_and_xor((addr), (value)) |
wrapper for OS/compiler specific atomic fetch and "XOR" function.
| addr | Address of the variable to XOR to |
| value | Value to add to the variable at addr |
Definition at line 254 of file util-atomic.h.
| #define SCAtomicSubAndFetch | ( | addr, | |
| value | |||
| ) | __sync_sub_and_fetch((addr), (value)) |
wrapper for OS/compiler specific atomic fetch and sub function.
| addr | Address of the variable to add to |
| value | Value to sub from the variable at addr |
Definition at line 224 of file util-atomic.h.
| void SCAtomicRegisterTests | ( | void | ) |
Definition at line 67 of file util-atomic.c.
References UtRegisterTest().
