[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-ncurses] Return value of write() is not properly evaluated
From: |
Dr. Werner Fink |
Subject: |
Re: [bug-ncurses] Return value of write() is not properly evaluated |
Date: |
Wed, 7 Jan 2015 15:35:18 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Dec 31, 2014 at 01:27:32PM +0100, Egmont Koblinger wrote:
> Off:
>
> I find it bizarre that pretty much every piece of software has to
> reimplement this "restart on short read/write or interrupt" pattern,
> yet there's no convenience wrapper for this in any library I'm aware
> of.
There is, from info pages of libc:
-- Macro: TEMP_FAILURE_RETRY (EXPRESSION)
This macro evaluates EXPRESSION once, and examines its value as
type `long int'. If the value equals `-1', that indicates a
failure and `errno' should be set to show what kind of failure.
If it fails and reports error code `EINTR', `TEMP_FAILURE_RETRY'
evaluates it again, and over and over until the result is not a
temporary failure.
The value returned by `TEMP_FAILURE_RETRY' is whatever value
EXPRESSION produced.
Sidemark[1]: repeating without a usleep() on EAGAIN can cause a high load.
Sidemark[2]: using `_BSD_SOURCE' or `_GNU_SOURCE' or with latest glibc
simply using SA_RESTART the problem should not occur
>
> On Wed, Dec 31, 2014 at 11:37 AM, Stian Skjelstad
> <address@hidden> wrote:
> > Rebuilding the debian package without optimization made debug easier :-)
> >
> > With the following patch applied, output is perfect, and no visual noise is
> > present (my software refreshes the screen at a typical rate of 20 fps,
> > typical with changes on every refresh). Checking with strace, it now pushes
> > out the write buffers completely, also when receiving signals like SIGALRM
> >
> >
> > --
> > Stian Skjelstad
> >
> > _______________________________________________
> > Bug-ncurses mailing list
> > address@hidden
> > https://lists.gnu.org/mailman/listinfo/bug-ncurses
> >
>
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-ncurses
--
Dr. Werner Fink -- Software Engineer Consultant
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton, HRB 21284 (AG Nuernberg)
phone: +49-911-740-53-0, fax: +49-911-3206727, www.opensuse.org
---------------------------------------------------------------------------
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr
signature.asc
Description: Digital signature
- Re: [bug-ncurses] Return value of write() is not properly evaluated,
Dr. Werner Fink <=