public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 1/2] doc: Document process_state
Date: Tue, 16 Dec 2025 12:27:09 +0100	[thread overview]
Message-ID: <20251216112709.GC307257@pevik> (raw)
In-Reply-To: <20251215124404.16395-1-chrubis@suse.cz>

> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---
>  doc/developers/api_c_tests.rst |  5 ++++
>  include/tst_process_state.h    | 55 +++++++++++++++++++++-------------
>  2 files changed, 40 insertions(+), 20 deletions(-)

> New in v2.

> diff --git a/doc/developers/api_c_tests.rst b/doc/developers/api_c_tests.rst
> index 2ca0f0464..13fc8651b 100644
> --- a/doc/developers/api_c_tests.rst
> +++ b/doc/developers/api_c_tests.rst
> @@ -43,6 +43,11 @@ Kernel
>  .. kernel-doc:: ../../include/tst_kernel.h
>  .. kernel-doc:: ../../include/tst_kvercmp.h

> +Process state
> +-------------
> +
> +.. kernel-doc:: ../../include/tst_process_state.h
> +
>  NUMA
>  ----
>  .. kernel-doc:: ../../include/tst_numa.h
> diff --git a/include/tst_process_state.h b/include/tst_process_state.h
> index b1d83e109..3691bba7a 100644
> --- a/include/tst_process_state.h
> +++ b/include/tst_process_state.h
> @@ -15,39 +15,54 @@

>  #ifdef TST_TEST_H__

> -/*
> - * Waits for process state change.
> +/**
> + * TST_PROCESS_STATE_WAIT() - Waits for a process state change.
> + *
> + * Polls `/proc/$PID/state` for a process state changes.
>   *
> - * The state is one of the following:
> + * @pid: A process pid.
> + * @state: A state to wait for.
> + * @msec_timeout: A timeout for the wait.
>   *
> - * R - process is running
> - * S - process is sleeping
> - * D - process sleeping uninterruptibly
> - * Z - zombie process
> - * T - process is traced
> + * Possible process states:
Maybe: use link to https://man7.org/linux/man-pages/man1/ps.1.html ?

-* Possible process states:
+* Possible process states (see :man1:`ps`):

> + *
> + * - **R** Process is running.
> + * - **S** Process is sleeping.
> + * - **D** Process sleeping uninterruptibly.
> + * - **Z** Zombie process.
> + * - **T** Process is traced.
> + * - **t** Tracing stopped.
> + * - **X** Process id dead.

Process state is outdated, man ps(1) lists:

               D    uninterruptible sleep (usually I/O)
               I    idle kernel thread
               R    running or runnable (on run queue)
               S    interruptible sleep (waiting for an
                    event to complete)
               T    stopped by job control signal
               t    stopped by debugger during the tracing
               W    paging (not valid since Linux 2.6)
               X    dead (should never be seen)
               Z    defunct (“zombie”) process, terminated
                    but not reaped by its parent

We miss:
* I (from kernel 4.2, maybe not relevant when we use it for a child which
is userspace)
* W (irrelevant as it is not valid)
* Z

Also, do we want specify the process states in both TST_PROCESS_STATE_WAIT() and
TST_THREAD_STATE_WAIT(), or just specify it in one and mention in the other that
they specify it? (via :ref: or c:func:).

Otherwise LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2025-12-16 11:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 12:44 [LTP] [PATCH v2 1/2] doc: Document process_state Cyril Hrubis
2025-12-15 12:44 ` [LTP] [PATCH v2 2/2] doc: Add ground rules page Cyril Hrubis
2025-12-15 13:32   ` Li Wang via ltp
2025-12-15 14:03     ` Li Wang via ltp
2025-12-15 14:25       ` Anrea Cervesato via ltp
2025-12-15 14:30       ` Petr Vorel
2025-12-15 15:00         ` Andrea Cervesato via ltp
2025-12-16  7:07           ` Li Wang via ltp
2025-12-16  7:27         ` Li Wang via ltp
2025-12-16 10:11           ` Petr Vorel
2025-12-16 10:42             ` Li Wang via ltp
2025-12-16 11:08               ` Andrea Cervesato via ltp
2025-12-16 11:23                 ` Li Wang via ltp
2025-12-16 11:23     ` Cyril Hrubis
2025-12-16 11:24       ` Li Wang via ltp
2025-12-21 10:30     ` Petr Vorel
2025-12-15 14:52   ` Andrea Cervesato via ltp
2025-12-16 10:54   ` Petr Vorel
2025-12-16 11:01   ` Petr Vorel
2025-12-16 11:27 ` Petr Vorel [this message]
2026-01-06 12:47   ` [LTP] [PATCH v2 1/2] doc: Document process_state Cyril Hrubis
2026-01-06 13:21     ` Cyril Hrubis
2026-01-06 13:56       ` Petr Vorel
2026-01-06 15:15         ` Cyril Hrubis
2026-01-07  7:46           ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251216112709.GC307257@pevik \
    --to=pvorel@suse.cz \
    --cc=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox