EINTR is a POSIX error code indicating that a system call was interrupted by a signal. Consider using this tag alongside more popular tags such as [signals] or [posix] for questions about this error.
Questions tagged [eintr]
27 questions
44
votes
4 answers
When to check for EINTR and repeat the function call?
I am programming a user application for a embedded Linux system, and I am using the common functions such as open, close, read, ioctl, etc. for the devices. Now, I read about EINTR, indicates that the function was interrupted by a signal, but I am…

stefangachter
- 845
- 2
- 10
- 16
18
votes
3 answers
EINTR and non-blocking calls
As is known, some blocking calls like read and write would return -1 and set errno to EINTR, and we need handle this.
My question is: Does this apply for non-blocking calls, e.g, set socket to O_NONBLOCK?
Since some articles and sources I have read…

haohaolee
- 677
- 1
- 9
- 16
12
votes
3 answers
System call interrupted by a signal still has to be completed
A lot of system calls like close( fd ) Can be interrupted by a signal. In this case usually -1 is returned and errno is set EINTR.
The question is what is the right thing to do? Say, I still want this fd to be closed.
What I can come up with…

Shamdor
- 3,019
- 5
- 22
- 25
7
votes
2 answers
Proper error handling for fclose impossible (according to manpage)?
So I'm studying fclose manpage for quite I while and my conclusion is that if fclose is interrupted by some signal, according to the manpage there is no way to recover...? Am I missing some point?
Usually, with unbuffered POSIX functions (open,…

boo-hoo
- 123
- 1
- 9
7
votes
8 answers
Unit testing error conditions - EINTR
In short, how do you unit test an error condition such as EINTR on a system call.
One particular example I'm working on, which could be a case all by itself, is whether it's necessary to call fclose again when it returns EOF with (errno==EINTR). The…

Michael Smith
- 71
- 1
- 3
6
votes
0 answers
ERROR: could not open file "base/.../...": Interrupted system call
After trying to run PostgreSQL 9.1 on Amazon Web Services this error has been turning up in the database and application logs. Reinstalling on a different AWS VM has not helped. Strangely the error goes a way after a few moments of activity, only to…

Paul R Rogers
- 914
- 1
- 9
- 19
6
votes
4 answers
System calls and EINTR error code
Is there any expert out there that can help me with the following?
I have the following system calls in C:
access()
unlink()
setsockopt()
fcntl()
setsid()
socket()
bind()
listen()
I want to know if they may fail with error code -1 and errno…

Efstathios Chatzikyriakidis
- 1,341
- 2
- 15
- 33
5
votes
1 answer
Why does select() keep failing with EINTR errno?
I have a C++ application that includes this function:
int
mySelect(const int fdMaxPlus1,
fd_set *readFDset,
fd_set *writeFDset,
struct timeval *timeout)
{
retry:
const int selectReturn
= ::select(fdMaxPlus1,…

WilliamKF
- 41,123
- 68
- 193
- 295
4
votes
2 answers
Blocking functions and EINTR
Many POSIX blocking functions return EINTR in case of a signal. The idea is that signal handler sets a flag first (say 'stop' flag in case of SIGINT), then the blocking function unblocks returning EINTR and the application sees the flag and performs…

Martin Sustrik
- 783
- 10
- 22
3
votes
1 answer
python: functions from math and os modules are interrupted by EINTR
I have linux board on samsung SoC s3c6410 (ARM11).
I build rootfs with buildroot:
Python 2.7.1, uClibc-0.9.31.
Linux kernel:
Linux buildroot 2.6.28.6 #177 Mon Oct 3 12:50:57 EEST 2011 armv6l GNU/Linux
My app, written on python, in some mysterios…

void
- 31
- 2
3
votes
2 answers
Handling EINTR (with goto?)
Background: This is a follow-up question to this thread about handling EINTR for system calls in C++ (Linux/GCC). Regardless of whether or not I intend to profile my application, it seems like I should be handling system calls setting errno to…

Chris Tonkinson
- 13,823
- 14
- 58
- 90
3
votes
2 answers
Python: Do I need to catch EINTR in a pipe-reading loop
tl;dr
Should I handle EINTR "system call interrupted" errors when reading a pipe in Python, and if so, how do I test such code?
Description
In the traceback below, self._dataq is a multiprocessing.Queue (technically, I'm using the billiard library,…

wkschwartz
- 3,817
- 2
- 29
- 33
3
votes
1 answer
When does the wait() function (in LINUX) respond to interrupts?
I have c code as such
int childid;
int parentid;
void siginthandler(int param)
{
// if this is the parent process
if(getpid() == parentid){
//handler code which sends SIGINT signal to child process
kill(childid, SIGINT);
}
else // if this is…

piedpiper
- 1,222
- 3
- 14
- 27
2
votes
2 answers
Any workarounds for Python's select and handling of EINTR in Linux?
In one of my recent projects I happened to have in the same process (a Python program, its a multithreaded application):
a Boost::Python module to a library that linked against the AVT PvAPI SDK, i.e. in the widest sense a driver to get image…

moooeeeep
- 31,622
- 22
- 98
- 187
2
votes
1 answer
epoll_wait() returns EINTR infinitely
I have a thread responsible for polling various fds. I am using epoll_wait with timeout set.
Following is the code snippet:
do {
n = epoll_wait(epollFd, eventsList, eventsTotal, timeoutMS);
}
while ((n<0) && (errno == EINTR));
eventsList…

himdeep pathak
- 25
- 5