task_current_syscall(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ task_current_syscall(9) ✨

ok so this is a page from the Kernel API Manual, section 9, and it's literally called task_current_syscall β€” bestie, it lets you peek at what a blocked task is actually doing πŸ’…


🌸 NAME 🌸

task_current_syscall β€” discover what a blocked task is doing πŸ‘€


πŸ¦‹ SYNOPSIS πŸ¦‹

int task_current_syscall (struct task_struct *target , struct syscall_info *info );

πŸŽ€ ARGUMENTS πŸŽ€

  • target β€” the thread to examine πŸ” (yes, that thread, the one you're being nosy about)
  • info β€” a structure with these fields, and bestie, pay attention to each one:
    • .sp β€” filled with the user stack pointer 🧚
    • .data.nr β€” filled with the system call number, or -1 πŸ’€
    • .data.args β€” filled with the maxargs system call arguments πŸ“
    • .data.instruction_pointer β€” filled with the user PC ⭐

πŸ’œ DESCRIPTION πŸ’œ

So here's the vibe: if target is blocked in a system call, this returns zero, with info.data.nr set to the call's number and info.data.args filled in with its arguments. 🫢 Registers not used for system call arguments may not be available, and listen β€” it is not kosher to use struct user_regset calls while the system call is still in progress. πŸ™ˆ Ngl, that's the rules.

Heads up: we may get this result if target has finished its system call but not yet returned to user mode β€” like when it's stopped for signal handling or syscall exit tracing. So don't @ me if it looks done but isn't done done. 😭

Now, if target is blocked in the kernel during a fault or exception, it returns zero with *info.data.nr set to -1 and does not fill in info.data.args. 🌈 But good news: if that's the case, it's now safe to examine target using struct user_regset get calls β€” as long as we're sure target won't return to user mode. πŸ‘‘

And if target does not remain blocked? Returns -EAGAIN. Periodt. πŸ’€


πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./lib/syscall.c β€” go read it, iykyk πŸ“–

and that's the whole manual, no cap ✨

kisses, this page came from ./lib, dated October 2026, and it'll live forever in your heart as task_current_syscall(9) πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from