Browse Source

original bug diagnosed by sthen: automatic retry in msgbuf_write on

EAGAIN causes spinning.
fix from claudio:
"Let msgbuf_write return -1 with errno EAGAIN. The users then must
check if this was the case and readd the event or poll again.  The
current handling in the imsg code is wrong for sure."
ok gilles
OPENBSD_5_5
benno 11 years ago
parent
commit
82969df044
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/lib/libutil/imsg-buffer.c

+ 3
- 3
src/lib/libutil/imsg-buffer.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: imsg-buffer.c,v 1.2 2012/06/02 21:46:53 gilles Exp $ */
/* $OpenBSD: imsg-buffer.c,v 1.3 2013/11/13 20:40:24 benno Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -159,7 +159,7 @@ ibuf_write(struct msgbuf *msgbuf)
again: again:
if ((n = writev(msgbuf->fd, iov, i)) == -1) { if ((n = writev(msgbuf->fd, iov, i)) == -1) {
if (errno == EAGAIN || errno == EINTR)
if (errno == EINTR)
goto again; goto again;
if (errno == ENOBUFS) if (errno == ENOBUFS)
errno = EAGAIN; errno = EAGAIN;
@ -259,7 +259,7 @@ msgbuf_write(struct msgbuf *msgbuf)
again: again:
if ((n = sendmsg(msgbuf->fd, &msg, 0)) == -1) { if ((n = sendmsg(msgbuf->fd, &msg, 0)) == -1) {
if (errno == EAGAIN || errno == EINTR)
if (errno == EINTR)
goto again; goto again;
if (errno == ENOBUFS) if (errno == ENOBUFS)
errno = EAGAIN; errno = EAGAIN;


Loading…
Cancel
Save