From cce741c409bbd77b7a648dcf9bed8f7fba169352 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 30 Apr 2008 19:09:40 +0000 Subject: [PATCH] * sysv_msg.cc: Add fix from upstream version 1.65. (msgsnd): Call msleep with timeout value. Handle EWOULDBLOCK. Make sure it's clear from where msleep has been called in debug output. (msgrcv): Make sure it's clear from where msleep has been called in debug output. --- winsup/cygserver/ChangeLog | 8 ++++++++ winsup/cygserver/sysv_msg.cc | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/winsup/cygserver/ChangeLog b/winsup/cygserver/ChangeLog index c8693eeac..f05f253b4 100644 --- a/winsup/cygserver/ChangeLog +++ b/winsup/cygserver/ChangeLog @@ -1,3 +1,11 @@ +2008-04-30 Corinna Vinschen + + * sysv_msg.cc: Add fix from upstream version 1.65. + (msgsnd): Call msleep with timeout value. Handle EWOULDBLOCK. Make + sure it's clear from where msleep has been called in debug output. + (msgrcv): Make sure it's clear from where msleep has been called in + debug output. + 2008-02-06 Corinna Vinschen * bsd_helper.cc: Replace %E __small_printf format specifier with %lu diff --git a/winsup/cygserver/sysv_msg.cc b/winsup/cygserver/sysv_msg.cc index 5ad3b659b..217cc1d97 100644 --- a/winsup/cygserver/sysv_msg.cc +++ b/winsup/cygserver/sysv_msg.cc @@ -722,10 +722,14 @@ msgsnd(struct thread *td, struct msgsnd_args *uap) } DPRINTF(("goodnight\n")); error = msleep(msqptr, &msq_mtx, (PZERO - 4) | PCATCH, - "msgwait", 0); + "msgsnd", 50); DPRINTF(("good morning, error=%d\n", error)); if (we_own_it) msqptr->msg_perm.mode &= ~MSG_LOCKED; + if (error == EWOULDBLOCK) { + DPRINTF(("timed out\n")); + continue; + } if (error != 0) { DPRINTF(("msgsnd: interrupted system call\n")); #ifdef __CYGWIN__ @@ -1079,11 +1083,11 @@ msgrcv(struct thread *td, struct msgrcv_args *uap) DPRINTF(("msgrcv: goodnight\n")); error = msleep(msqptr, &msq_mtx, (PZERO - 4) | PCATCH, - "msgwait", 0); + "msgrcv", 0); DPRINTF(("msgrcv: good morning (error=%d)\n", error)); if (error != 0) { - DPRINTF(("msgsnd: interrupted system call\n")); + DPRINTF(("msgrcv: interrupted system call\n")); #ifdef __CYGWIN__ if (error != EIDRM) #endif /* __CYGWIN__ */