diff options
Diffstat (limited to 'lib/is_single_threaded.c')
| -rw-r--r-- | lib/is_single_threaded.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/is_single_threaded.c b/lib/is_single_threaded.c index bd2bea963364..8c98b20bfc41 100644 --- a/lib/is_single_threaded.c +++ b/lib/is_single_threaded.c @@ -1,16 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* 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. */ - -#include <linux/sched.h> +#include <linux/sched/signal.h> +#include <linux/sched/task.h> +#include <linux/sched/mm.h> /* * Returns true if the task does not share ->mm with another thread/process. @@ -36,8 +33,7 @@ bool current_is_single_threaded(void) if (unlikely(p == task->group_leader)) continue; - t = p; - do { + for_each_thread(p, t) { if (unlikely(t->mm == mm)) goto found; if (likely(t->mm)) @@ -48,7 +44,7 @@ bool current_is_single_threaded(void) * forked before exiting. */ smp_rmb(); - } while_each_thread(p, t); + } } ret = true; found: |
