| /* Function to determine if a thread group is single threaded or not |
| * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. |
| * Written by David Howells (dhowells@redhat.com) |
| * - Derived from security/selinux/hooks.c |
| * This program is free software; you can redistribute it and/or |
| * modify it under the terms of the GNU General Public Licence |
| * as published by the Free Software Foundation; either version |
| * 2 of the Licence, or (at your option) any later version. |
| * Returns true if the task does not share ->mm with another thread/process. |
| bool current_is_single_threaded(void) |
| struct task_struct *task = current; |
| struct mm_struct *mm = task->mm; |
| struct task_struct *p, *t; |
| if (atomic_read(&task->signal->live) != 1) |
| if (atomic_read(&mm->mm_users) == 1) |
| if (unlikely(p->flags & PF_KTHREAD)) |
| if (unlikely(p == task->group_leader)) |
| if (unlikely(t->mm == mm)) |
| * t->mm == NULL. Make sure next_thread/next_task |
| * will see other CLONE_VM tasks which might be |
| } while_each_thread(p, t); |