From patchwork Tue Sep 19 23:06:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Carlo Arenas X-Patchwork-Id: 815932 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Ebrt3lEb"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xxdnq5WFBz9s7F for ; Wed, 20 Sep 2017 09:07:59 +1000 (AEST) Received: from localhost ([::1]:45799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duRcT-00054i-Lp for incoming@patchwork.ozlabs.org; Tue, 19 Sep 2017 19:07:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duRbh-00051A-Ku for qemu-devel@nongnu.org; Tue, 19 Sep 2017 19:07:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duRbg-00015M-NT for qemu-devel@nongnu.org; Tue, 19 Sep 2017 19:07:09 -0400 Received: from mail-io0-x244.google.com ([2607:f8b0:4001:c06::244]:35503) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duRbg-00014s-HX for qemu-devel@nongnu.org; Tue, 19 Sep 2017 19:07:08 -0400 Received: by mail-io0-x244.google.com with SMTP id d16so1153269ioj.2 for ; Tue, 19 Sep 2017 16:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=11R+z2KKJ5gPRkpvOVi8PqWysi5cQNtTuZU6eVx1NTA=; b=Ebrt3lEb4JTbE6M9eaQ3vyxV2lLH2koF+ZLAHD2QkgSK/dfkUMbjBOhAdIcjDlCSDP a3aKjKFSZUkwzvXNYC6Rw5YDJFsy7LQ3aCMG9N5b15AtnA2g+vPUOa58U6k1aOU/i+rr RL1GwGLeXXE3GBhNnAR4Mb3SaFA6ISZC5qYh3Vo1b+cjozYRi/t9q2z9k5AABaAF0V8F VBxXe6t5vqhiZHl5bzz4nH/ieGgHYEsU2YdOIlBYjRc0qc4Vw6W5dsql8sGAJ2l9/4Ms IXkCcHmBWN6FhJ2u43F0IwaRvicSOHqfF5v/1yTgYh9IJCCSypeksFzvx6G9ulK5jzXP sa3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=11R+z2KKJ5gPRkpvOVi8PqWysi5cQNtTuZU6eVx1NTA=; b=oRjP/OnQ2c3YzxgUfmaZwTDp3bqDlvSYe+VXLpXPNmqzj8B2QqraaReHpYvU/vlfgD jM9QvgrIrThKlDY0Mcq/wO1kQMktMreIJfMObxPS69Z7B3XCUQladtSpz0YScVYluJZG /0gjvdZNTC1VwlZ4CY3eU9JyFicDiKgdbAXnkEQd3XHMRmydhjZ/w2oargnZIpXbdrdm CRDrhvRqISndTDAost2xkleZ5nJ4AqdEX1L9EMoni4P64Fe1Ob2VDWGmNDhl8nQiMUjJ 7xXj+eIz2F/Xb+BZomGcWyG/EIK5qkaCZH/Jlsmf+BCybEO59ZjnKExXYJOnaqu0a+PN rkRA== X-Gm-Message-State: AHPjjUhGr0h/JeQt6IIFfTbRYHY07ass5ODaJqrKzn6syhraXD1a6IRF actxlBAzIOfTt9wm3hhBL35xYv+K X-Google-Smtp-Source: AOwi7QB2nGhSCtztsQcACSsoMwC7wB0JNeEtNP3pKmWUHPPD9oxw4bSEv0gjVBzIKlbJy87g2gmpkA== X-Received: by 10.107.38.202 with SMTP id m193mr4591610iom.98.1505862427648; Tue, 19 Sep 2017 16:07:07 -0700 (PDT) Received: from 172-11-32-171.lightspeed.mmphtn.sbcglobal.net (50-207-95-178-static.hfc.comcastbusiness.net. [50.207.95.178]) by smtp.gmail.com with ESMTPSA id z63sm1544033itf.23.2017.09.19.16.07.05 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 19 Sep 2017 16:07:06 -0700 (PDT) From: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 16:06:42 -0700 Message-Id: <20170919230643.87425-2-carenas@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170919230643.87425-1-carenas@gmail.com> References: <20170919230643.87425-1-carenas@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c06::244 Subject: [Qemu-devel] [PATCH 2/3] linux-user: add SO_LINGER to setsockopt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, gang.chen.5i5j@gmail.com, riku.voipio@iki.fi, laurent@vivier.eu, =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= , rth@twiddle.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Original implementation by Chen Gang; all bugs mine Signed-off-by: Chen Gang Signed-off-by: Carlo Marcelo Arenas Belón --- linux-user/syscall.c | 15 +++++++++++++++ linux-user/syscall_defs.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 9b6364a266..ad689dad50 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3071,6 +3071,21 @@ set_timeout: unlock_user (dev_ifname, optval_addr, 0); return ret; } + case TARGET_SO_LINGER: + { + struct linger lg; + struct target_linger *tlg; + + if (!lock_user_struct(VERIFY_READ, tlg, optval_addr, 1)) { + return -TARGET_EFAULT; + } + __get_user(lg.l_onoff, &tlg->l_onoff); + __get_user(lg.l_linger, &tlg->l_linger); + ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_LINGER, + &lg, optlen)); + unlock_user_struct(tlg, optval_addr, 0); + return ret; + } /* Options with 'int' argument. */ case TARGET_SO_DEBUG: optname = SO_DEBUG; diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 40c5027e93..a60d6bb163 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -202,6 +202,11 @@ struct target_ip_mreq_source { uint32_t imr_sourceaddr; }; +struct target_linger { + abi_int l_onoff; /* Linger active */ + abi_int l_linger; /* How long to linger for */ +}; + struct target_timeval { abi_long tv_sec; abi_long tv_usec;