1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

hurd: handle EINTR during critical sections

During critical sections, signal handling is deferred and thus RPCs return
EINTR, even if SA_RESTART is set. We thus have to restart the whole critical
section in that case.

This also adds HURD_CRITICAL_UNLOCK in the cases where one wants to
break the section in the middle.
This commit is contained in:
Samuel Thibault
2021-03-23 22:38:54 +00:00
parent a4ea18ec6c
commit c3b287be74
29 changed files with 139 additions and 4 deletions

View File

@@ -31,6 +31,7 @@ __getgroups (int n, gid_t *gidset)
if (n < 0)
return __hurd_fail (EINVAL);
retry:
crit = _hurd_critical_section_lock ();
__mutex_lock (&_hurd_id.lock);
@@ -38,6 +39,9 @@ __getgroups (int n, gid_t *gidset)
{
__mutex_unlock (&_hurd_id.lock);
_hurd_critical_section_unlock (crit);
if (err == EINTR)
/* Got a signal while inside an RPC of the critical section, retry again */
goto retry;
return __hurd_fail (err);
}