/* Check constraints on flags passed to the unshare system call and force unsharing of additional process context as appropriate.  */
static void check_unshare_flags(unsigned long *flags_ptr)
/* Check constraints on flags passed to the unshare system call and force unsharing of additional process context as appropriate.  */
static void check_unshare_flags(unsigned long *flags_ptr)
{
	if (*flags_ptr & CLONE_THREAD)
		*flags_ptr |= CLONE_VM;
	if (*flags_ptr & CLONE_VM)
		*flags_ptr |= CLONE_SIGHAND;
	if ((*flags_ptr & CLONE_SIGHAND) &&
	    (atomic_read(&current->signal->count) > 1))
		*flags_ptr |= CLONE_THREAD;
	if (*flags_ptr & CLONE_NEWNS)
		*flags_ptr |= CLONE_FS;
}