Message ID | 20191208122844.11642-5-sbabic@denx.de |
---|---|
State | Accepted |
Headers | show
Return-Path: <swupdate+bncBCXPLOXJ6IKRBCWZWPXQKGQE67JGCNI@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::53a; helo=mail-ed1-x53a.google.com; envelope-from=swupdate+bncbcxploxj6ikrbcwzwpxqkgqe67jgcni@googlegroups.com; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="LPCyNpNX"; dkim-atps=neutral Received: from mail-ed1-x53a.google.com (mail-ed1-x53a.google.com [IPv6:2a00:1450:4864:20::53a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47W5Gj3sf0z9sPf for <incoming@patchwork.ozlabs.org>; Sun, 8 Dec 2019 23:29:01 +1100 (AEDT) Received: by mail-ed1-x53a.google.com with SMTP id l1sf7226986ede.1 for <incoming@patchwork.ozlabs.org>; Sun, 08 Dec 2019 04:29:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575808138; cv=pass; d=google.com; s=arc-20160816; b=EBbMZWSkuFr+A1xJIS9/NCxYMQwDPeYoldfqrVO9ZR2Pdz2Me6EXpP8Nq9rH8ZEQUp k1nXLRpPb7Hh2KjGdrrwzhvPdbRxW1IV7+A5bt6zKoM3WG3iBqf4ZC1zrVCThmS9NWb5 hmcVECktCbCHHdbLvulZ2oytGhdjUT8uP+9F4l/a6EoW9mAj8tJQuixhD7afSQXy/idY pqoDybgQGAAMWCHkqIXFdt2hdKIftRObjIPOJ2l2KLsrOEmDGVrvHpszZ6E0lcYWbHcY bbkekcuifSbMK6PQfw+SZCpy06rRlTNPEA3cplxqu3zgPbBnnc7DZjeJVd6Vm/KiEXX5 EgQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:mime-version:sender:dkim-signature; bh=Quy5VLK9ZfhR365gNsfJAcczV0wVvoP1rC2P1xR/PnE=; b=pqRAy0QHFylyrHT/BEn5g6QQyiTI7c+QMcQjp9rMWZtkOGE/6RWGVn5DTHN7rYq5cb qDfhoetInTvGrxbu/PrW9WyOcZ4zqnn4s/aUEXjRv7SNQATIJAMuF6qM2z4QYarYED80 +FfLGC/qUHyNQe3aq+OV5z4vQoCG59fqmiRK8az21LmBTjwNCZrO8ffvzQezutrB5wUe zEY7L40ltLyKd182EX0YU2mtz5HSzhy+CA/EUAXPNlnKTEi0IGqrwgn5avA8pkFfgr1H X8uwvPK2IGHlsIWnaOW/z31hZC9wILY4FYEsZtv5jwzM2FjvCGxjCyjHOWm6ZW2CvDsk FS3w== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=Quy5VLK9ZfhR365gNsfJAcczV0wVvoP1rC2P1xR/PnE=; b=LPCyNpNXZDpJv6ks6mcwjk6UlehlvcMuXBKZ+xx97qB9+6X7eEvg+ytMc7pzv0mfyH u67WkIDwLybVkR4/NkCgg93MyIE85mMgsVBu11oz4g9p37dO8AXdULhdfCUrlOzoryaX cPX+R/UeOm+741wxqyL/lfhHpbhhSv70WV4Eoe1kVru4TMfjXAc2m/qb4+8CSW8fk5rV W4DnxBFMHRILZi22z9juRkSM2gIdBMYbe49QTEm+Mtv4JgV9OoSF/opdrUcSnagc1c5Q N8n4dupxiPvgg4EQM5ZVBzEDU1/Axro672Qwk5Wh+VbHfKUSn4lmwslpvV9ViQU2gebo 7lgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=Quy5VLK9ZfhR365gNsfJAcczV0wVvoP1rC2P1xR/PnE=; b=WVgr+VzIUvOW+wx5sokv/8m4I4GTSGcGCnwBxy0k5uztrk2EeMtAC/544dgijReMpN Gvj6Ft2sgjA3UtB8E7YFLtmxm/bbn7T+OVrFpu0RmgNyhsQt96WTdIqzhGzakicaWGx6 ZHPWAfFZwt/NiHyFQjLA+mUgf8lDWbZSiDxwo6Y2wA+2zusARfX3NOXZYHCio6vi/pNo AYcUjaxhNpjiFXFhA+vtkmOdcmpUqrzbNOgiB5FmOBoH4CR3oSdZv1bY/ee2+XWJBLdp O+phu28QMfLnh8n06RLPg0dtF+6Q8fJe9YWveMy5zuh3gP0nnd4d+8e0mOItK3fG4yTu gZfg== Sender: swupdate@googlegroups.com X-Gm-Message-State: APjAAAUkKwHq2r15lVGfQWsCFplGHSPeL4evqAh8JLvKrBlaaHyFFoJn ASB7Oo8gEtaGBziVLFXsDpo= X-Google-Smtp-Source: APXvYqwPl6SQBOuEdWiRgXBlP+KJKjjzJwNiH2WWgZZi4wj7wR3Wbm6yrVUay+9HFDm+44nGE02U+A== X-Received: by 2002:a17:906:8310:: with SMTP id j16mr25082107ejx.83.1575808138547; Sun, 08 Dec 2019 04:28:58 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6402:548:: with SMTP id i8ls2696214edx.9.gmail; Sun, 08 Dec 2019 04:28:57 -0800 (PST) X-Received: by 2002:a05:6402:17fb:: with SMTP id t27mr8100126edy.159.1575808137881; Sun, 08 Dec 2019 04:28:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575808137; cv=none; d=google.com; s=arc-20160816; b=QjNNzTRgmqnOO8bDWEPWJtXSuGccJO8K9DBqn9jfGgbl6zfvj3TBPVYhoFpIuS3KyP WLPAWqLIYjevnFBciOew/TIGoHTy/fMSQzBnuktCAzVQqigetL9wW7XeSZpi4d1RIHLa xDY3ZrMDT5cnLYC+ePopHPej7n3Xnn+yiiYLHLAT6zH63cqTeXivfi6i/0xR3vjflyFq 0EBvqtcULuhhK5YeuoVV/LkQnkDBldFGVRjGyjR8zc0XEGBdJIWOlZqplsTxYxE9THvp pLI48+PXyHRtFkD2VfBzJSk8/8+4rvbSk3ILoB9xYT/LAdYB8xVvL8Pk+f41fiR8kaVj ViNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=dlYC3iYPue3aw6LUIoynMKkVgZyZrOxPvB/qbTWpO00=; b=Z9e2vhMcIZ/VohyCzs2oHXOKTdpDItOMhiS1b440CE4hSiaAWGeZ/299Q5Ie5dy73a p5OL4DrJifcM9D6+MDb4tI1ur+gVqCcbBQ8097ndw7gUwbkIKMm7HOIBIDGhcuchDJNH wsiLcvTXtmqXh9NlAiYcvWS/dFjJ0DkrPhCVKo4oze3ufUwdKZS0hJvauXCAM0M+DsHS GL5jECeKy0OATbp0ojyI65HKp/wsOU45PZ+Jv6eUL5M2lQccE+p+osg1Ot0dtBSVDDwB BtswaR1G++JCit80kIWOq9pSG42o5QBIgrv7ScXcI7JeP6pGRO/eAOSVAftinXPeVltS 4XZQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id ba12si843023edb.3.2019.12.08.04.28.57 for <swupdate@googlegroups.com> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Dec 2019 04:28:57 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 47W5Gd4fVKz1qqkP; Sun, 8 Dec 2019 13:28:57 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 47W5Gd4PV1z1rYb3; Sun, 8 Dec 2019 13:28:57 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id MaT-oplWpOqk; Sun, 8 Dec 2019 13:28:56 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Sun, 8 Dec 2019 13:28:56 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id B71BE4540508; Sun, 8 Dec 2019 13:28:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([IPv6:::1]) by localhost (mail.babic.homelinux.org [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id qaqcIFwkbQap; Sun, 8 Dec 2019 13:28:54 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 750FC454051E; Sun, 8 Dec 2019 13:28:46 +0100 (CET) From: Stefano Babic <sbabic@denx.de> To: swupdate@googlegroups.com Cc: Stefano Babic <sbabic@denx.de> Subject: [swupdate] [PATCH 5/6] util: global function to set non blocking mode Date: Sun, 8 Dec 2019 13:28:43 +0100 Message-Id: <20191208122844.11642-5-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191208122844.11642-1-sbabic@denx.de> References: <20191208122844.11642-1-sbabic@denx.de> X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
[1/6] Updated mongoose to 6.16
|
expand
|
diff --git a/core/util.c b/core/util.c index dc4f4af..f4aee4f 100644 --- a/core/util.c +++ b/core/util.c @@ -733,3 +733,20 @@ char *swupdate_time_iso8601(void) return buf; } + +int swupdate_file_setnonblock(int fd, bool block) +{ + int flags; + + flags = fcntl(fd, F_GETFL, 0); + if (flags == -1) + return -EFAULT; + + if (block) + flags |= O_NONBLOCK; + else + flags &= ~O_NONBLOCK; + + return !(fcntl(fd, F_SETFL, flags) == -1); +} + diff --git a/include/util.h b/include/util.h index 9f658ab..52928b8 100644 --- a/include/util.h +++ b/include/util.h @@ -177,6 +177,7 @@ off_t extract_next_file(int fd, int fdout, off_t start, int compressed, int encrypted, unsigned char *hash); int openfileoutput(const char *filename); int mkpath(char *dir, mode_t mode); +int swupdate_file_setnonblock(int fd, bool block); int register_notifier(notifier client); void notify(RECOVERY_STATUS status, int error, int level, const char *msg);
Add swupdate_file_setnonblocking() Signed-off-by: Stefano Babic <sbabic@denx.de> --- core/util.c | 17 +++++++++++++++++ include/util.h | 1 + 2 files changed, 18 insertions(+)