From patchwork Fri Jul 1 16:26:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Boca X-Patchwork-Id: 643136 X-Patchwork-Delegate: guru@ovn.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3rh2FF1CSPz9s5g for ; Sat, 2 Jul 2016 02:39:45 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 69F0F10B83; Fri, 1 Jul 2016 09:39:44 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id A240110B83 for ; Fri, 1 Jul 2016 09:39:42 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 3224D1E0705 for ; Fri, 1 Jul 2016 10:39:42 -0600 (MDT) X-ASG-Debug-ID: 1467391180-09eadd3a09038f0001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id EQ6R6e7X6FYkgOFG (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 01 Jul 2016 10:39:40 -0600 (MDT) X-Barracuda-Envelope-From: pboca@cloudbasesolutions.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO cbssmtp1.cloudbase.local) (91.232.152.5) by mx1-pf2.cudamail.com with SMTP; 1 Jul 2016 16:39:39 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at cloudbasesolutions.com designates 91.232.152.5 as permitted sender) X-Barracuda-Apparent-Source-IP: 91.232.152.5 X-Barracuda-RBL-IP: 91.232.152.5 Received: from localhost (localhost [127.0.0.1]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id 064DF41825 for ; Fri, 1 Jul 2016 19:39:37 +0300 (EEST) X-Virus-Scanned: amavisd-new at cloudbasesolutions.com Received: from cbssmtp1.cloudbase.local ([127.0.0.1]) by localhost (cbssmtp1.cloudbase.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kmVpTm9VXfdE for ; Fri, 1 Jul 2016 19:39:16 +0300 (EEST) Received: from CBSEX1.cloudbase.local (unknown [10.77.78.3]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id DDD2B41853 for ; Fri, 1 Jul 2016 19:26:58 +0300 (EEST) Received: from CBSEX1.cloudbase.local ([10.77.78.3]) by CBSEX1.cloudbase.local ([10.77.78.3]) with mapi id 14.03.0301.000; Fri, 1 Jul 2016 18:26:58 +0200 X-CudaMail-Envelope-Sender: pboca@cloudbasesolutions.com From: Paul Boca To: "dev@openvswitch.org" X-CudaMail-MID: CM-E2-630037448 X-CudaMail-DTE: 070116 X-CudaMail-Originating-IP: 91.232.152.5 Thread-Topic: [PATCH V5 02/17] python tests: Register signal handlers only on supported types on Windows X-ASG-Orig-Subj: [##CM-E2-630037448##][PATCH V5 02/17] python tests: Register signal handlers only on supported types on Windows Thread-Index: AQHR07VjAzjcT3meAkaN7eq1jV7EJw== Date: Fri, 1 Jul 2016 16:26:57 +0000 Message-ID: <1467390322-12852-3-git-send-email-pboca@cloudbasesolutions.com> References: <1467390322-12852-1-git-send-email-pboca@cloudbasesolutions.com> In-Reply-To: <1467390322-12852-1-git-send-email-pboca@cloudbasesolutions.com> Accept-Language: en-US, it-IT Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.77.78.1] MIME-Version: 1.0 X-GBUdb-Analysis: 0, 91.232.152.5, Ugly c=0.318533 p=-0.363636 Source Normal X-MessageSniffer-Rules: 0-0-0-5006-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1467391180 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.10 X-Barracuda-Spam-Status: No, SCORE=0.10 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.30926 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS Subject: [ovs-dev] [PATCH V5 02/17] python tests: Register signal handlers only on supported types on Windows X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" SIGHUP and SIGALRM are not available on Windows. Signed-off-by: Paul-Daniel Boca --- V2: Fixed Python function inet_open_active, treat WSAEWOULDBLOCK error as EINPROGRESS on Windows V3: No changes V4: No changes V5: No changes --- python/ovs/fatal_signal.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/python/ovs/fatal_signal.py b/python/ovs/fatal_signal.py index 7308039..5b90559 100644 --- a/python/ovs/fatal_signal.py +++ b/python/ovs/fatal_signal.py @@ -15,6 +15,7 @@ import atexit import os import signal +import sys import ovs.vlog @@ -128,9 +129,13 @@ def _init(): global _inited if not _inited: _inited = True - - for signr in (signal.SIGTERM, signal.SIGINT, - signal.SIGHUP, signal.SIGALRM): - if signal.getsignal(signr) == signal.SIG_DFL: - signal.signal(signr, _signal_handler) + if sys.platform == "win32": + for signr in (signal.SIGTERM, signal.SIGINT): + if signal.getsignal(signr) == signal.SIG_DFL: + signal.signal(signr, _signal_handler) + else: + for signr in (signal.SIGTERM, signal.SIGINT, + signal.SIGHUP, signal.SIGALRM): + if signal.getsignal(signr) == signal.SIG_DFL: + signal.signal(signr, _signal_handler) atexit.register(_atexit_handler)