[CRIU] [PATCH 1/2] pstree: Introduce task_alive() helper

Cyrill Gorcunov gorcunov at gmail.com
Fri Aug 8 03:52:48 PDT 2014


On Thu, Aug 07, 2014 at 01:30:54PM +0400, Pavel Emelyanov wrote:
> +++ b/include/pstree.h
> @@ -40,6 +40,11 @@ static inline int shared_fdtable(struct pstree_item *item) {
>  		item->ids->files_id == item->parent->ids->files_id);
>  }
>  
> +static inline bool task_alive(struct pstree_item *i)
> +{
> +	return (i->state == TASK_ALIVE) || (i->state == TASK_STOPPED);
> +}
> +

I would rather do

static inline bool task_is(struct pstree_item *i, int state)
{
	return i->state == state;
}

#define task_is_alive(i) 	(task_is(i, TASK_ALIVE) || task_is(i, TASK_STOPPED))
#define task_is_dead(i) 	(task_is(i, TASK_DEAD))
#define task_is_helper(i) 	(task_is(i, TASK_HELPER))

?


More information about the CRIU mailing list