Introduce TASK_UTRACED state, will be used by utrace instead of TASK_TRACED.
Note: this state is reported as "t (tracing stop)" to the user-space to avoid the confusion. IOW, it looks like TASK_TRACED in /proc/pid/status. Signed-off-by: Oleg Nesterov <o...@redhat.com> --- fs/proc/array.c | 11 ++++++----- include/linux/sched.h | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/fs/proc/array.c b/fs/proc/array.c index 496fef3..bfaa998 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -138,11 +138,12 @@ static const char * const task_state_array[] = { "D (disk sleep)", /* 2 */ "T (stopped)", /* 4 */ "t (tracing stop)", /* 8 */ - "Z (zombie)", /* 16 */ - "X (dead)", /* 32 */ - "x (dead)", /* 64 */ - "K (wakekill)", /* 128 */ - "W (waking)", /* 256 */ + "t (tracing stop)", /* 16 (stopped by utrace) */ + "Z (zombie)", /* 32 */ + "X (dead)", /* 64 */ + "x (dead)", /* 128 */ + "K (wakekill)", /* 256 */ + "W (waking)", /* 512 */ }; static inline const char *get_task_state(struct task_struct *tsk) diff --git a/include/linux/sched.h b/include/linux/sched.h index b87de83..7a0008c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -184,16 +184,17 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) #define TASK_UNINTERRUPTIBLE 2 #define __TASK_STOPPED 4 #define __TASK_TRACED 8 +#define __TASK_UTRACED 16 /* in tsk->exit_state */ -#define EXIT_ZOMBIE 16 -#define EXIT_DEAD 32 +#define EXIT_ZOMBIE 32 +#define EXIT_DEAD 64 /* in tsk->state again */ -#define TASK_DEAD 64 -#define TASK_WAKEKILL 128 -#define TASK_WAKING 256 -#define TASK_STATE_MAX 512 +#define TASK_DEAD 128 +#define TASK_WAKEKILL 256 +#define TASK_WAKING 512 +#define TASK_STATE_MAX 1024 -#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKW" +#define TASK_STATE_TO_CHAR_STR "RSDTtUZXxKW" extern char ___assert_task_state[1 - 2*!!( sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; @@ -202,15 +203,16 @@ extern char ___assert_task_state[1 - 2*!!( #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) #define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED) #define TASK_TRACED (TASK_WAKEKILL | __TASK_TRACED) +#define TASK_UTRACED (TASK_WAKEKILL | __TASK_UTRACED) /* Convenience macros for the sake of wake_up */ #define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE) -#define TASK_ALL (TASK_NORMAL | __TASK_STOPPED | __TASK_TRACED) +#define TASK_ALL (TASK_NORMAL | __TASK_STOPPED | __TASK_TRACED | __TASK_UTRACED) /* get_task_state() */ #define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \ TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \ - __TASK_TRACED) + __TASK_TRACED | __TASK_UTRACED) #define task_is_traced(task) ((task->state & __TASK_TRACED) != 0) #define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0) -- 1.5.5.1