From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OgKgF97eMmFGJQAAWB0awg (envelope-from ) for ; Fri, 03 Sep 2021 22:50:06 -0400 Received: by simark.ca (Postfix, from userid 112) id 49B981EE22; Fri, 3 Sep 2021 22:50:06 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: * X-Spam-Status: No, score=1.7 required=5.0 tests=DATE_IN_FUTURE_03_06, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E91F11EDDB for ; Fri, 3 Sep 2021 22:50:05 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8CD90386EC49 for ; Sat, 4 Sep 2021 02:50:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CD90386EC49 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1630723805; bh=AidlUnt6QSk3qIWmBEZlHqbk9TP6cIyLPquFQa/JBt0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=TTHg3s1YdC5c37Vw7slogBEQOxS2Oao2Yk4xECchiMJ4cGBA9Rmrk9SxpFOVwz/CX UEM2wKw7yM6Y5iAwyXtAS3MsOCXbRwaStB5PJaqacImNbAHNGtt6l4EBdTcNFUHUF+ M8U4++m9Hsw3uaUzngu1ZND9RgRXBpV9H3bkhTQo= Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 2D10E384842E for ; Sat, 4 Sep 2021 02:49:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2D10E384842E Received: from vapier.lan (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 649D033BF55 for ; Sat, 4 Sep 2021 02:49:45 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH 2/2] sim: dv-sockser: use gnulib to set nonblocking mode Date: Sat, 4 Sep 2021 03:49:34 -0400 Message-Id: <20210904074934.21309-2-vapier@gentoo.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210904074934.21309-1-vapier@gentoo.org> References: <20210904074934.21309-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" --- sim/common/dv-sockser.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c index d47d428d535d..ad4fc229a923 100644 --- a/sim/common/dv-sockser.c +++ b/sim/common/dv-sockser.c @@ -42,6 +42,8 @@ along with this program. If not, see . */ #include #include +#include "nonblocking.h" + #include "sim-assert.h" #include "sim-options.h" @@ -51,7 +53,7 @@ along with this program. If not, see . */ typedef int socklen_t; #endif -/* Get definitions for both O_NONBLOCK and O_NDELAY. */ +/* Get definitions for O_NDELAY. */ #ifndef O_NDELAY #ifdef FNDELAY @@ -60,14 +62,6 @@ typedef int socklen_t; #define O_NDELAY 0 #endif /* ! defined (FNDELAY) */ #endif /* ! defined (O_NDELAY) */ - -#ifndef O_NONBLOCK -#ifdef FNBLOCK -#define O_NONBLOCK FNBLOCK -#else /* ! defined (FNBLOCK) */ -#define O_NONBLOCK 0 -#endif /* ! defined (FNBLOCK) */ -#endif /* ! defined (O_NONBLOCK) */ /* Compromise between eating cpu and properly busy-waiting. @@ -279,13 +273,15 @@ connected_p (SIM_DESC sd) flags = fcntl (sockser_fd, F_GETFL); flags |= O_NONBLOCK | O_NDELAY; if (fcntl (sockser_fd, F_SETFL, flags) == -1) +#else + if (set_nonblocking_flag (sockser_fd, false)) +#endif { sim_io_eprintf (sd, "unable to set nonblocking i/o"); close (sockser_fd); sockser_fd = -1; return 0; } -#endif return 1; } -- 2.31.1