From patchwork Fri Oct 5 18:07:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Bryant X-Patchwork-Id: 189559 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 87F562C0079 for ; Sat, 6 Oct 2012 04:09:45 +1000 (EST) Received: from localhost ([::1]:54078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKCLH-0006KE-K4 for incoming@patchwork.ozlabs.org; Fri, 05 Oct 2012 14:09:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKCKW-0004W9-GZ for qemu-devel@nongnu.org; Fri, 05 Oct 2012 14:08:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKCKV-0004Uc-HV for qemu-devel@nongnu.org; Fri, 05 Oct 2012 14:08:56 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:54585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKCKV-0004UQ-BU for qemu-devel@nongnu.org; Fri, 05 Oct 2012 14:08:55 -0400 Received: from /spool/local by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 Oct 2012 12:08:54 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 Oct 2012 12:08:52 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 3E75119D8043 for ; Fri, 5 Oct 2012 12:08:50 -0600 (MDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q95I8PUq144122 for ; Fri, 5 Oct 2012 12:08:25 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q95I8NTZ009006 for ; Fri, 5 Oct 2012 12:08:24 -0600 Received: from localhost ([9.80.102.135]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q95I8Mbg008944; Fri, 5 Oct 2012 12:08:23 -0600 From: Corey Bryant To: qemu-devel@nongnu.org Date: Fri, 5 Oct 2012 14:07:02 -0400 Message-Id: <1349460425-30601-2-git-send-email-coreyb@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1349460425-30601-1-git-send-email-coreyb@linux.vnet.ibm.com> References: <1349460425-30601-1-git-send-email-coreyb@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12100518-7606-0000-0000-0000043D49FD X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.110.154 Cc: libvir-list@redhat.com, kwolf@redhat.com, Corey Bryant , eblake@redhat.com Subject: [Qemu-devel] [PATCH 1/4] monitor: Less restrictive fd matching for fd sets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Currently, in order to use a file descriptor that resides in an fd set, the access mode flag of the qemu_open() call has to be an exact match of the access mode flag of an fd in the requested fd set. This patch lightens up that restriction. For example, if QEMU attempts to qemu_open() "/dev/fdset/2" with O_RDONLY or O_WRONLY, and an fd in fd set 2 has O_RDWR, the call will now be successful. Signed-off-by: Corey Bryant --- monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monitor.c b/monitor.c index a0e3ffb..34a968c 100644 --- a/monitor.c +++ b/monitor.c @@ -2304,7 +2304,8 @@ int monitor_fdset_get_fd(int64_t fdset_id, int flags) return -1; } - if ((flags & O_ACCMODE) == (mon_fd_flags & O_ACCMODE)) { + if ((mon_fd_flags & O_ACCMODE) == O_RDWR || + (mon_fd_flags & O_ACCMODE) == (flags & O_ACCMODE)) { return mon_fdset_fd->fd; } }