-/* $OpenBSD: kern_exec.c,v 1.251 2023/09/29 12:47:34 claudio Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.252 2023/10/30 07:13:10 claudio Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
return (0);
}
- /* get other threads to stop */
- if ((error = single_thread_set(p, SINGLE_UNWIND | SINGLE_DEEP)))
- return (error);
+ /*
+ * Get other threads to stop, if contested return ERESTART,
+ * so the syscall is restarted after halting in userret.
+ */
+ if (single_thread_set(p, SINGLE_UNWIND | SINGLE_DEEP))
+ return (ERESTART);
/*
* Cheap solution to complicated problems.