[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning
From: |
Paul Brook |
Subject: |
Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning |
Date: |
Mon, 11 May 2009 17:02:28 +0100 |
User-agent: |
KMail/1.9.9 |
On Monday 11 May 2009, Stuart Brady wrote:
> On Sun, May 10, 2009 at 07:53:35PM -0600, M. Warner Losh wrote:
> > 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.
>
> So if I do a read() from a file over NFS, and there's an awful lot of
> latency (and perhaps even connection problems), and the process gets a
> signal -- does that mean that the signal will only be delivered once
> data is returned?
The signal should be delivered immediately. Depending on various factors the
kernel will either restart the syscall, fail with EINTR or return a partial
read.
> If not, then I would really start to wonder whether /all/ code dealing
> with read(), write(), etc. should be written to cope with EINTR (and
> also partial reads/writes?) regardless of whatever is done with threads
> and signal masks, as doing otherwise seems only to be asking for trouble
> at some point. (I'd be especially concerned about signals intended for
> libraries that are not under the developer's control...)
If your application uses signals (directly or indirectly via libraries) then
all uses of read/write need to be tolerant of EINTR and partial reads.
Paul
- [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, Chih-Min Chao, 2009/05/10
- Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, Paul Brook, 2009/05/10
- Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, Stuart Brady, 2009/05/10
- Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, Anthony Liguori, 2009/05/10
- Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, M. Warner Losh, 2009/05/10
- Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, Stuart Brady, 2009/05/11
- Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning,
Paul Brook <=
- Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, Anthony Liguori, 2009/05/11
- Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, Daniel P. Berrange, 2009/05/11
- Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, Anthony Liguori, 2009/05/11
- Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, Jamie Lokier, 2009/05/12
- Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, Jamie Lokier, 2009/05/11
Re: [Qemu-devel] [PATCH] suppress 'warn_unused_result' warning, Daniel P. Berrange, 2009/05/11