QUARK_QUEUE_OPEN(3) Library Functions Manual QUARK_QUEUE_OPEN(3)

quark_queue_openinitialize a quark_queue

#include <quark.h>

int
quark_queue_open(struct quark_queue *qq, struct quark_queue_attr *attr);

quark_queue_open initializes the quark_queue pointed to by qq with the attributes pointed to by attr.

A quark_queue is the main runtime datastructure of quark, it is loosely called a queue as it's where events will originate from. Events will be collected into the queue, buffered, aggregated and filtered if necessary.

The quark_queue_open function does the following:

Default queue behaviour can be tweaked with attr. A default configuration for tweaking can be acquired via quark_queue_default_attr(3). In case attr is NULL, the default configuration is used.

struct quark_queue_attr is defined as:

struct quark_queue_attr {
	int	 flags;
	int	 max_length;
	int	 cache_grace_time;	/* in milliseconds */
	int	 hold_time;		/* in milliseconds */
	...
};
Bitmask of:
Enable the EBPF backend. EBPF is attempted first and falls back to KPROBE if both were specified.
Enable the KPROBE backend, see above.
Shorthand for (QQ_EBPF | QQ_KPROBE).
Include per-thread events, instead of per-process events. This option will be removed in the future, but it may be useful for debugging.
Don't send the initial snapshot of existing processes.
Don't aggregate , and , perform only minimal aggregation.
Include and in . Entry leader is how the process entered the system, it is disabled by default as it is Elastic/ECS specific.
The maximum size of the internal buffering queue in number of events.

Quark buffers each event for a computed interval in order to sort and aggregate multiple events into one. The closer the queue is to being full, the smaller the interval: until quark decides to not buffer events at all.

The grace period for removing an event from the cache.

When a process exits, it is removed from the cache, but only after cache_grace_time, this gives the user a small window where it can still query a terminated process via quark_process_lookup(3).

How long to buffer (hold) an event before delivering it to the user via quark_queue_get_events(3).

Events received from the backend are not immediately forwarded to the user, this allows multiple events to be aggregated as well as ordered by time. In case quark is overloaded, it will use a stepping function where hold_time decreases the more loaded it is.

Details are described in quark(7).

Zero on success, -1 otherwise and errno is set. In the case of an error, the internal state is cleared up and a quark_queue_close(3) should NOT be issued.

quark_event_dump(3), quark_process_lookup(3), quark_queue_block(3), quark_queue_close(3), quark_queue_default_attr(3), quark_queue_get_epollfd(3), quark_queue_get_events(3), quark_queue_get_stats(3), quark(7), quark-btf(8), quark-mon(8), quark-test(8)

October 25, 2024 Linux