include/uapi/linux/counter.h
Source file repositories/reference/linux-study-clean/include/uapi/linux/counter.h
File Facts
- System
- Linux kernel
- Corpus path
include/uapi/linux/counter.h- Extension
.h- Size
- 4970 bytes
- Lines
- 173
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ioctl.hlinux/types.h
Detected Declarations
struct counter_componentstruct counter_watchstruct counter_eventenum counter_component_typeenum counter_scopeenum counter_event_typeenum counter_count_directionenum counter_count_modeenum counter_functionenum counter_signal_levelenum counter_synapse_actionenum counter_signal_polarity
Annotated Snippet
struct counter_component {
__u8 type;
__u8 scope;
__u8 parent;
__u8 id;
};
/* Event type definitions */
enum counter_event_type {
/* Count value increased past ceiling */
COUNTER_EVENT_OVERFLOW,
/* Count value decreased past floor */
COUNTER_EVENT_UNDERFLOW,
/* Count value increased past ceiling, or decreased past floor */
COUNTER_EVENT_OVERFLOW_UNDERFLOW,
/* Count value reached threshold */
COUNTER_EVENT_THRESHOLD,
/* Index signal detected */
COUNTER_EVENT_INDEX,
/* State of counter is changed */
COUNTER_EVENT_CHANGE_OF_STATE,
/* Count value captured */
COUNTER_EVENT_CAPTURE,
/* Direction change detected */
COUNTER_EVENT_DIRECTION_CHANGE,
};
/**
* struct counter_watch - Counter component watch configuration
* @component: component to watch when event triggers
* @event: event that triggers (one of enum counter_event_type)
* @channel: event channel (typically 0 unless the device supports concurrent
* events of the same type)
*/
struct counter_watch {
struct counter_component component;
__u8 event;
__u8 channel;
};
/*
* Queues a Counter watch for the specified event.
*
* The queued watches will not be applied until COUNTER_ENABLE_EVENTS_IOCTL is
* called.
*/
#define COUNTER_ADD_WATCH_IOCTL _IOW(0x3E, 0x00, struct counter_watch)
/*
* Enables monitoring the events specified by the Counter watches that were
* queued by COUNTER_ADD_WATCH_IOCTL.
*
* If events are already enabled, the new set of watches replaces the old one.
* Calling this ioctl also has the effect of clearing the queue of watches added
* by COUNTER_ADD_WATCH_IOCTL.
*/
#define COUNTER_ENABLE_EVENTS_IOCTL _IO(0x3E, 0x01)
/*
* Stops monitoring the previously enabled events.
*/
#define COUNTER_DISABLE_EVENTS_IOCTL _IO(0x3E, 0x02)
/**
* struct counter_event - Counter event data
* @timestamp: best estimate of time of event occurrence, in nanoseconds
* @value: component value
* @watch: component watch configuration
* @status: return status (system error number)
*/
struct counter_event {
__aligned_u64 timestamp;
__aligned_u64 value;
struct counter_watch watch;
__u8 status;
};
/* Count direction values */
enum counter_count_direction {
COUNTER_COUNT_DIRECTION_FORWARD,
COUNTER_COUNT_DIRECTION_BACKWARD,
};
/* Count mode values */
enum counter_count_mode {
COUNTER_COUNT_MODE_NORMAL,
COUNTER_COUNT_MODE_RANGE_LIMIT,
COUNTER_COUNT_MODE_NON_RECYCLE,
COUNTER_COUNT_MODE_MODULO_N,
COUNTER_COUNT_MODE_INTERRUPT_ON_TERMINAL_COUNT,
COUNTER_COUNT_MODE_HARDWARE_RETRIGGERABLE_ONESHOT,
COUNTER_COUNT_MODE_RATE_GENERATOR,
Annotation
- Immediate include surface: `linux/ioctl.h`, `linux/types.h`.
- Detected declarations: `struct counter_component`, `struct counter_watch`, `struct counter_event`, `enum counter_component_type`, `enum counter_scope`, `enum counter_event_type`, `enum counter_count_direction`, `enum counter_count_mode`, `enum counter_function`, `enum counter_signal_level`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.