Home

ERESTARTSYS

ERESTARTSYS is a Linux kernel error code used to indicate that a system call was interrupted by a signal and should be restarted if the signal’s disposition allows restart (for example when SA_RESTART is in effect). It is part of the kernel’s mechanism for restartable system calls and is primarily an internal signal-handling aid.

When a process is executing a blocking system call and a signal is delivered, the kernel may

In user space, ERESTARTSYS is largely an implementation detail of the kernel and C library. Glibc and

Compatibility and scope: ERESTARTSYS is Linux-specific and tied to the kernel’s restartable syscall feature. It is

See also: EINTR, ERESTARTNOINTR, SA_RESTART.

return
-ERESTARTSYS
to
indicate
that
the
call
can
be
automatically
restarted.
Whether
the
system
call
is
actually
restarted
depends
on
the
signal
handler’s
flags
and
the
kernel’s
restart
policy
for
the
affected
syscall.
If
SA_RESTART
is
set
for
the
signal,
many
blocking
syscalls
are
resumed
by
retrying
the
call;
if
not,
the
syscall
may
terminate
with
an
error
such
as
EINTR.
other
libraries
usually
handle
restartable
behavior
by
automatically
retrying
eligible
syscalls
when
SA_RESTART
is
enabled,
so
applications
may
not
observe
ERESTARTSYS
directly.
In
some
debugging
or
low-level
contexts,
the
kernel’s
internal
ERESTARTSYS
code
paths
may
appear
in
traces
or
in
kernel
logs,
but
ordinary
programs
typically
see
EINTR
for
interrupted
syscalls
unless
automatic
restart
is
performed.
distinct
from
the
more
widely
exposed
errno
value
EINTR,
which
represents
an
interrupt
without
automatic
restart.
The
exact
behavior
can
vary
by
architecture
and
kernel
version,
and
not
all
syscalls
are
restartable.