From 82969df044c856ab72940d8a58c85bdfac18719b Mon Sep 17 00:00:00 2001 From: benno <> Date: Wed, 13 Nov 2013 20:40:24 +0000 Subject: [PATCH] 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 --- src/lib/libutil/imsg-buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/libutil/imsg-buffer.c b/src/lib/libutil/imsg-buffer.c index 9f047577..730959f8 100644 --- a/src/lib/libutil/imsg-buffer.c +++ b/src/lib/libutil/imsg-buffer.c @@ -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 @@ -159,7 +159,7 @@ ibuf_write(struct msgbuf *msgbuf) again: if ((n = writev(msgbuf->fd, iov, i)) == -1) { - if (errno == EAGAIN || errno == EINTR) + if (errno == EINTR) goto again; if (errno == ENOBUFS) errno = EAGAIN; @@ -259,7 +259,7 @@ msgbuf_write(struct msgbuf *msgbuf) again: if ((n = sendmsg(msgbuf->fd, &msg, 0)) == -1) { - if (errno == EAGAIN || errno == EINTR) + if (errno == EINTR) goto again; if (errno == ENOBUFS) errno = EAGAIN;