ps 州代码中的小写字母 t 是什么意思

What does lowercase t means in ps state code

当我 运行 ps xaf 我有以下输出:

所以我的应用程序有状态代码 t+。但是我找不到它是什么意思。在 man ps 中没有这样的状态代码:

是否等于大写T州代码?如果是,为什么我在 kill -SIGSTOP <pid> 时总是只得到 T 状态码?

并非所有 Linux 版本都知道 t 代码。它在 2.6.33 中作为 tracing stop 引入,不同于 T 指示的信号停止。在 proc(5) 的最新版本(2014-07-10 或更高版本)中,您会发现以下内容:

                    T  Stopped (on a signal) or (before Linux 2.6.33)
                       trace stopped
                    t  Tracing stop (Linux 2.6.33 onward)
                    W  Paging (only before Linux 2.6.0)
                    X  Dead (from Linux 2.6.0 onward)
                    x  Dead (Linux 2.6.33 to 3.13 only)
                    K  Wakekill (Linux 2.6.33 to 3.13 only)
                    W  Waking (Linux 2.6.33 to 3.13 only)
                    P  Parked (Linux 3.9 to 3.13 only)

除了通常的 R、S、D、Z、T、W 状态代码。

查看 Michael Kerrisk page 上的最新版本。

根据内核来源的 task_state_array[] 't' 转换为 "tracing stop",而 'T' 只是 "stopped".

/*
 * The task state array is a strange "bitmap" of
 * reasons to sleep. Thus "running" is zero, and
 * you can test for combinations of others with
 * simple bit tests.
 */
static const char * const task_state_array[] = {
    "R (running)",      /*   0 */
    "S (sleeping)",     /*   1 */
    "D (disk sleep)",   /*   2 */
    "T (stopped)",      /*   4 */
    "t (tracing stop)", /*   8 */
    "X (dead)",     /*  16 */
    "Z (zombie)",       /*  32 */
};