From patchwork Wed Apr 7 23:13:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 1463551 Return-Path: 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=2607:f8b0:4864:20::d38; helo=mail-io1-xd38.google.com; envelope-from=swupdate+bncbcwivbv7sugrbrxzxcbqmgqedurtr6y@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=CmdU58TL; dkim-atps=neutral Received: from mail-io1-xd38.google.com (mail-io1-xd38.google.com [IPv6:2607:f8b0:4864:20::d38]) (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 4FG0Zy3yLzz9sWQ for ; Thu, 8 Apr 2021 09:14:18 +1000 (AEST) Received: by mail-io1-xd38.google.com with SMTP id n13sf83495ioh.12 for ; Wed, 07 Apr 2021 16:14:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617837255; cv=pass; d=google.com; s=arc-20160816; b=y0dy5eUuaoVXjDZ8Oi7X46RPoVTnyaNdRvndlZnW6IYBg8Fnu1jD0m9fWZrSSN+lfN XGWhHTG3lXjU+Ai3jvM35h4mwwEkGoyBXb4uNTuW7JJ5VtqzuR8am+WfWz6zmnjPmt/J ylZYOvY5WMucNxHK5lp9mGBi4vdN22dHzCXFqyOYP0RIUD2vuF6OBCGGRvKE5p0bmlSO ELij4EHzjaORTa8qJOSdDbZP+nOZxi2W0F3EauIzHQxYKDKsUQ1HcACCpZ2tWIZNm1O+ gIiDthfLdigaDqyAGWcaS8+p3G05n8xrWNMR+d3ALTGTP66HVzzofpOqUHP2/AAt/Bvu T2KA== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=dG6pj4AJ1f7i2NFuiOTfgL0JHVwaEHWR/1cxIlwiCHA=; b=djXTgYqrcETgmCLe20sON9TekvR8VZ+Rt1dT7S4cm2lcneDgJnnrwIVyboGZtaTXSf IlyfqjKvLT1mLHDc0DKenHKimXHFxB4xO6A+copu06apL3yKYds/rjmoZlwepwMHpVVM HzmWAX49JCMYsnYrW8aURmbsVSG+kiDCQxxt3HObikWYH1Poi/6W09JItrrNuOgM1fZz 7taI1n9VIHz/PWdF2nEY3g5lWMYaFO3DhZUCjtEJzIGd+6WhZbF7Q1BfiAH4DnZFOCmT Sg6VfA5rfYzS3ksdBtpLfT1kwcJzdNCmIWGhJ5wuW7bRpKN45Mm/kjb2OvZeDzhsmzs6 8Q3g== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=dG6pj4AJ1f7i2NFuiOTfgL0JHVwaEHWR/1cxIlwiCHA=; b=CmdU58TLzMChzMcaFsz+ZmIsSkXOgaz1qRP8IQ2wfopg2quYJZ9a9NMgKkTzqhEZ0u MkK4bqaDwcxCq3Qp0HnkU46hM/fvlQJrjqd6uO3oxVAgJEKOWo0KE4OYFPtm24M+fGmL 4ueTAlmmHdx52qXwV+FjOivfUWK/bYwnBHiagOk7Cx6jnjgjUWc4y2yoX/haK7g27ZzT wnda2UrluOt6s4ham89J+nFNyaK3K99kkYU2ugUx//fN0pXHMBR1LfdDPlds4ODDIGmj 7qu5MiDpjfHcweaFNA/AdkEEkWGbY+4BS/Wau9Bo96Kip1P9LhusUZL5V52tgd3NCNfm 1qlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version: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=dG6pj4AJ1f7i2NFuiOTfgL0JHVwaEHWR/1cxIlwiCHA=; b=uoLwGEwlJSVgadUyDadlz1xqna5+nudW5BNjlTCwi8u+vqJvPf0jNtt7SwBdZpZzTV Y99Lja0mvA5Eh4vpflPd83H4ml/tBOixjjDY4SVPb57tpM7MLX7diM2nimnSslhDW0Ky 6kmLc66ZPwnzzhIgsRpkrgKTAG7nPMtte3fYKUTun9B0ky1x0t5+IleL3Plk6jnRV+ew EB7gO/i4/FlLSKkAj45isDjYICA2MC5UNABftUKKUecmbL8CvEEFS0OppgCuNzw04eOX ornJDz4BaKi3NISPPLZ6Kq+UJFaBRLNv9a/by1GMhv3w39OWhhul90uZyyKuKCB8yiQS +QXg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM533Jqhffu31UoI+Nl9N3kFEUW8J8f/7qgYHBiqP2Xh+YCPj/cqKE k6YvNXbjwNA+JOTPh+DtM+Y= X-Google-Smtp-Source: ABdhPJy8EbgilHW99BGQefXs5ac142p1cwGrV5VHl9tvXK7fwQj4Na9JxFxKa0cOlM19cU//AkWwyg== X-Received: by 2002:a92:c5d0:: with SMTP id s16mr4619125ilt.149.1617837254902; Wed, 07 Apr 2021 16:14:14 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6638:339e:: with SMTP id h30ls495968jav.0.gmail; Wed, 07 Apr 2021 16:14:14 -0700 (PDT) X-Received: by 2002:a05:6638:24c2:: with SMTP id y2mr5859394jat.9.1617837254298; Wed, 07 Apr 2021 16:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617837254; cv=none; d=google.com; s=arc-20160816; b=rQRw8+WsVfdqndpDoHzyf+4IueLey7u5b4vEMBYulVhrMsA2XtLS5qS6d1cw6fEbag YXnrmcnMAhDtaBeJVeNvbhyhYDNb2F1Sqg3ZptzFE5hqsvFwr5F+TBgYoQB2DVtIwWqj NMFn+xcyJV5VxylLlchuHLOOjdSdFe5Yz8FH4D04tRdEGcPl/RAAp2sxwft+1nspulW7 OVsHQBpgrzxAFJbRwJuOuoL/8w5WpruehZ+X2lmcJg0v3kuj77oRDxuXZwzh77khtsWT B2QUNtb8MjNLbDpioPbzzyhT7OM8OiCZgNRW2e2oIqaCdpQed6mU9VvFpnlRFoFFTv5+ Em9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=7FMzKbdI6xUwFTHLdvMmpdwGw08VwFEQFk346Z4XleY=; b=B7Fk8jjnf84C82JKt+6sw5rntX7SfP+oQp3RBtB/mW1IpQHLjDTyqkCeJw/nsir5LM 8nT8rOcHOaE/1Adp+evzklILEfuKX/AWQD2OK756a8kwCFNGtSB4A58ojoLVUNRjiXyP qzPw5bsOqh7aSbHN97EAAjO0ujayBiFV+BqZEJaYJyz0b5QXo2Vt4oHeagGyLUiQhouv pOBayhBNNnNvkDlLadljhdOwDhuIqOr6IeXDPWgsFuCNQL49qKztxN8Cg+qRDCj+fiTl HVY89+8hfGjUZ7xSV7KGYlNxN6WCeS4NzRQgY2grcUlEcVxTtyL9SNXBmUvfzia+Q3sl hu2g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com Received: from gw.atmark-techno.com (gw.atmark-techno.com. [13.115.124.170]) by gmr-mx.google.com with ESMTP id x7si154894iow.2.2021.04.07.16.14.13 for ; Wed, 07 Apr 2021 16:14:14 -0700 (PDT) Received-SPF: pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) client-ip=13.115.124.170; Received: from gw.atmark-techno.com (localhost [127.0.0.1]) by gw.atmark-techno.com (Postfix) with ESMTP id 6300E80251 for ; Thu, 8 Apr 2021 08:14:12 +0900 (JST) Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by gw.atmark-techno.com (Postfix) with ESMTPS id 2053F80251 for ; Thu, 8 Apr 2021 08:14:12 +0900 (JST) Received: by mail-pl1-f197.google.com with SMTP id y10so49979plt.21 for ; Wed, 07 Apr 2021 16:14:11 -0700 (PDT) X-Received: by 2002:a17:90b:4c0c:: with SMTP id na12mr5226212pjb.117.1617837250727; Wed, 07 Apr 2021 16:14:10 -0700 (PDT) X-Received: by 2002:a17:90b:4c0c:: with SMTP id na12mr5226199pjb.117.1617837250546; Wed, 07 Apr 2021 16:14:10 -0700 (PDT) Received: from pc-0115 (126.88.200.35.bc.googleusercontent.com. [35.200.88.126]) by smtp.gmail.com with ESMTPSA id v126sm3244466pfv.138.2021.04.07.16.14.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Apr 2021 16:14:10 -0700 (PDT) Received: from martinet by pc-0115 with local (Exim 4.94) (envelope-from ) id 1lUHNA-00EMNR-RB; Thu, 08 Apr 2021 08:14:08 +0900 From: Dominique Martinet To: swupdate@googlegroups.com Cc: Dominique Martinet Subject: [swupdate] [PATCH v2] Fix bsd build Date: Thu, 8 Apr 2021 08:13:56 +0900 Message-Id: <20210407231356.3422559-1-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210401114530.2482311-1-dominique.martinet@atmark-techno.com> References: <20210401114530.2482311-1-dominique.martinet@atmark-techno.com> MIME-Version: 1.0 X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , raw_handler/readback_handler use BLKGETSIZE64 which is linux-specific, FreeBSD has DIOCGMEDIASIZE instead. swupdate-sysrestart was including linux/if_link.h but does not appear to actually need it core/notifier isn't a build failure but a segfault on freebsd: the string needs to be available and freeable from atexit handler, so use strndup instead of strndupa...! Signed-off-by: Dominique Martinet --- v2: add sob core/notifier.c | 2 +- handlers/raw_handler.c | 6 ++++++ handlers/readback_handler.c | 6 ++++++ tools/swupdate-sysrestart.c | 2 -- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/notifier.c b/core/notifier.c index 68447f2cc6cb..dc742c19f9d4 100644 --- a/core/notifier.c +++ b/core/notifier.c @@ -368,7 +368,7 @@ static void unlink_socket(void) static void setup_socket_cleanup(struct sockaddr_un *addr) { - socket_path = strndupa(addr->sun_path, sizeof(addr->sun_path)); + socket_path = strndup(addr->sun_path, sizeof(addr->sun_path)); if (atexit(unlink_socket) != 0) { TRACE("Cannot setup socket cleanup on exit, %s won't be unlinked.", socket_path); } diff --git a/handlers/raw_handler.c b/handlers/raw_handler.c index 1007e8baf4f5..e8e66eb73339 100644 --- a/handlers/raw_handler.c +++ b/handlers/raw_handler.c @@ -10,7 +10,13 @@ #include #include #include +#ifdef __FreeBSD__ +#include +// the ioctls are almost identical except for the name, just alias it +#define BLKGETSIZE64 DIOCGMEDIASIZE +#else #include +#endif #include diff --git a/handlers/readback_handler.c b/handlers/readback_handler.c index 9dc99fce4855..aaab436122ae 100644 --- a/handlers/readback_handler.c +++ b/handlers/readback_handler.c @@ -10,7 +10,13 @@ #include #include #include +#ifdef __FreeBSD__ +#include +// the ioctls are almost identical except for the name, just alias it +#define BLKGETSIZE64 DIOCGMEDIASIZE +#else #include +#endif #include "swupdate.h" #include "handler.h" diff --git a/tools/swupdate-sysrestart.c b/tools/swupdate-sysrestart.c index 9a9a4ffca06f..152ed01ddb18 100644 --- a/tools/swupdate-sysrestart.c +++ b/tools/swupdate-sysrestart.c @@ -24,7 +24,6 @@ #include #include #include -#include #if defined(CONFIG_CURL) #include @@ -270,4 +269,3 @@ int main(int __attribute__((__unused__)) argc, char __attribute__((__unused__)) exit(1); } #endif -