Module task

Linux task interface.

Class task

task:comm () Returns the command name (comm) of the task, i.e., the executable.
task:cpu () Returns the CPU the task last ran on.
task:current () Gets an object representing the current kernel task.
task:pid () Returns the process ID (PID) of the task.
task:prio () Returns the dynamic priority of the task.
task:tgid () Returns the thread group ID (TGID) of the task.


Class task

A Linux task.
task:comm ()
Returns the command name (comm) of the task, i.e., the executable. This is truncated to TASKCOMMLEN (16) characters by the kernel.

Returns:

    string command name of the task
task:cpu ()
Returns the CPU the task last ran on.

Returns:

    integer CPU index
task:current ()
Gets an object representing the current kernel task.

Returns:

    task task object for the current task.

Usage:

    local task = require("task")
    local t = task.current()
    print(t:pid(), t:comm())
task:pid ()
Returns the process ID (PID) of the task. For threads, this is the thread ID (TID) unique to each thread.

Returns:

    integer pid of the task
task:prio ()
Returns the dynamic priority of the task. Ranges from 0 (highest) to 139 (lowest); normal tasks are 100-139, real-time tasks are 0-99.

Returns:

    integer priority of the task
task:tgid ()
Returns the thread group ID (TGID) of the task. For the main thread, TGID equals PID. For other threads in the group, TGID is the PID of the main thread.

Returns:

    integer tgid of the task
generated by LDoc 1.5.0 Last updated 2026-09-05 12:27:44