trace_seq_to_user(9)
π« trace_seq_to_user (9) π«
okay so bestie, you found a kernel API manpage β and not just any, this one is from the Kernel API Manual and it's literally called trace_seq_to_user. Yes, kernel people have their own manual section, iykyk. Let's get into it π«Ά
πΈ NAME πΈ
trace_seq_to_user β copy the sequence buffer to user space β¨
π SYNOPSIS π
int trace_seq_to_user (struct trace_seq *s , char __user *ubuf , int cnt
);
that's the whole vibe. three args, one int coming back at you π
π¦ ARGUMENTS π¦
sβ the trace sequence descriptor, aka the main character of this whole operation πubufβ the userspace memory location you're copying to π―cntβ the amount to copy, like how much you're willing to share π
π DESCRIPTION π
So here's the tea: this function copies the sequence buffer into the userspace memory that ubuf points at. Not complicated, but the way it does it is lowkey kind of iconic π
It starts from the last read position β that's s->readpos β and writes up to cnt characters, or it keeps going till it hits the end of the content in the buffer (s->len), whichever comes first. Literally whichever one shows up to the party first π
On success? It returns a positive number β that's the number of bytes it copied. Slay π
On failure it returns -EBUSY if all of the content in the sequence has already been read. And yes, that includes when there's nothing in the sequence at all, meaning s->len == s->readpos π« like babe there is nothing left to read, the buffer is empty, go home.
It also returns -EFAULT if the copy to userspace fails π that's the "something went wrong on the way out" error.
ngl the two failure modes are very different vibes:-EBUSYis "already read everything,"-EFAULTis "the copy itself broke." don't mix them up bestie π
π SEE ALSO π
go check out the kernel file ./kernel/trace/trace_seq.c β plus these absolute icons:
trace_print_seq(9)trace_seq_printf(9)trace_seq_bitmask(9)trace_seq_bitmask_list(9)trace_seq_vprintf(9)trace_seq_bprintf(9)trace_seq_puts(9)trace_seq_putc(9)trace_seq_putmem(9)trace_seq_putmem_hex(9)trace_seq_path(9)
and that's the whole page, bestie π§ this one lives in ./kernel/trace and it's dated October 2026 β so yeah, it's giving future energy β go forth and copy those bytes responsibly π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms