tools/include/linux/refcount.h

Source file repositories/reference/linux-study-clean/tools/include/linux/refcount.h

File Facts

System
Linux kernel
Corpus path
tools/include/linux/refcount.h
Extension
.h
Size
4309 bytes
Lines
158
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

if (new > val) {
			REFCOUNT_WARN(new > val, "refcount_t: underflow; use-after-free.\n");
			return false;
		}

		old = atomic_cmpxchg_release(&r->refs, val, new);
		if (old == val)
			break;

		val = old;
	}

	return !new;
}

static inline __refcount_check
bool refcount_dec_and_test(refcount_t *r)
{
	return refcount_sub_and_test(1, r);
}


#endif /* _ATOMIC_LINUX_REFCOUNT_H */

Annotation

Implementation Notes