Skip to content

Commit 1990fe5

Browse files
committed
doc: Document process_state
Reviewed-by: Li Wang <liwang@redhat.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
1 parent 703c401 commit 1990fe5

2 files changed

Lines changed: 36 additions & 20 deletions

File tree

doc/developers/api_c_tests.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ Kernel
4343
.. kernel-doc:: ../../include/tst_kernel.h
4444
.. kernel-doc:: ../../include/tst_kvercmp.h
4545

46+
Process state
47+
-------------
48+
49+
.. kernel-doc:: ../../include/tst_process_state.h
50+
4651
NUMA
4752
----
4853
.. kernel-doc:: ../../include/tst_numa.h

include/tst_process_state.h

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,50 @@
1515

1616
#ifdef TST_TEST_H__
1717

18-
/*
19-
* Waits for process state change.
18+
/**
19+
* TST_PROCESS_STATE_WAIT() - Waits for a process state change.
20+
*
21+
* Polls `/proc/$PID/state` for a process state changes.
2022
*
21-
* The state is one of the following:
23+
* @pid: A process pid.
24+
* @state: A state to wait for.
25+
* @msec_timeout: A timeout for the wait.
2226
*
23-
* R - process is running
24-
* S - process is sleeping
25-
* D - process sleeping uninterruptibly
26-
* Z - zombie process
27-
* T - process is traced
27+
* Possible process states (see :manpage:`ps(1)`):
28+
*
29+
* - **R** Process is running.
30+
* - **S** Process is sleeping.
31+
* - **D** Process sleeping uninterruptibly.
32+
* - **Z** Zombie process.
33+
* - **T** Process is traced.
34+
* - **t** Tracing stopped.
35+
* - **X** Process id dead.
2836
*/
2937
#define TST_PROCESS_STATE_WAIT(pid, state, msec_timeout) \
3038
tst_process_state_wait(__FILE__, __LINE__, NULL, \
3139
(pid), (state), (msec_timeout))
3240

33-
/*
34-
* Check that a given pid is present on the system
41+
/**
42+
* TST_PROCESS_EXIT_WAIT() - Waits while pid is present on the system.
43+
*
44+
* Loops until `kill($PID, 0)` succeds or timeout is reached.
45+
*
46+
* @pid: A process pid.
47+
* @msec_timeout: A timeout for the wait.
3548
*/
3649
#define TST_PROCESS_EXIT_WAIT(pid, msec_timeout) \
3750
tst_process_exit_wait((pid), (msec_timeout))
3851

39-
/*
40-
* Waits for thread state change.
52+
/**
53+
* TST_THREAD_STATE_WAIT() - Waits for a thread state change.
54+
*
55+
* Polls `/proc/self/task/$TID/state` for a thread state change.
4156
*
42-
* The state is one of the following:
57+
* Possible thread states are the same as for TST_PROCESS_STATE_WAIT().
4358
*
44-
* R - running
45-
* S - sleeping
46-
* D - disk sleep
47-
* T - stopped
48-
* t - tracing stopped
49-
* Z - zombie
50-
* X - dead
59+
* @tid: A thread tid.
60+
* @state: A state to wait for.
61+
* @msec_timeout: A timeout for the wait.
5162
*/
5263
#define TST_THREAD_STATE_WAIT(tid, state, msec_timeout) \
5364
tst_thread_state_wait((tid), (state), (msec_timeout))

0 commit comments

Comments
 (0)