* Attempt to handle reference count overflow and underflow. Force the counter * to stay at the saturation value so that a counter overflow cannot trigger * destruction of the containing object and instead leads to a less harmful * memory leak. */
| 49 | * memory leak. |
| 50 | */ |
| 51 | static __inline void |
| 52 | _refcount_update_saturated(volatile u_int *count) |
| 53 | { |
| 54 | #ifdef INVARIANTS |
| 55 | panic("refcount %p wraparound", count); |
| 56 | #else |
| 57 | atomic_store_int(count, REFCOUNT_SATURATION_VALUE); |
| 58 | #endif |
| 59 | } |
| 60 | |
| 61 | static __inline void |
| 62 | refcount_init(volatile u_int *count, u_int value) |
no test coverage detected