qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning


From: M. Warner Losh
Subject: Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning
Date: Sun, 10 May 2009 19:53:35 -0600 (MDT)

In message: <address@hidden>
            Stuart Brady <address@hidden> writes:
: On Mon, May 11, 2009 at 03:15:11AM +0800, Chih-Min Chao wrote:
: > The patch add error handling to functions with 'warn_unused_result' return
: > value such as write, read, ftruncate, and realpath.
: 
: I'm slightly concerned -- read(), write() and ftruncate() can fail with
: EINTR if a signal is received at an unfortunate time, can't they?

It depends on how the signal mask for the system call is setup.

: Do we mitigate this for the most part, somehow?
: 
: Do kernels try to avoid this behaviour?  If so, under what circumstances
: might EINTR still be returned?

When a signal is received and you are waiting for data, you get
EINTR.  If there's data available, then I believe the behavior is to
return that data and not EINTR.  That's the way Unix works.

: Is it acceptable to have a wrapper around these functions that retries
: if the call fails with EINTR?
: 
: I would guess that for the most part, getting EINTR back is pretty rare,
: as there's an awful lot of code (in QEMU and in other projects) that
: doesn't check for it.

It is very rare...

: BTW, is it be possible for the write in qemu_event_increment() to
: io_thread_fd to fail with EAGAIN?  If so, aborting with perror()
: probably isn't right.

Warner




reply via email to

[Prev in Thread] Current Thread [Next in Thread]