Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp839916ybg; Tue, 9 Jun 2020 14:21:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylxR8nqDOz9DeUy1JRTNsre+wwkZX6YlRXX/al4eEA0H5YmBn8LI++9DsFGSlG/DehhDCG X-Received: by 2002:a17:906:f115:: with SMTP id gv21mr331084ejb.340.1591737686192; Tue, 09 Jun 2020 14:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591737686; cv=none; d=google.com; s=arc-20160816; b=HArjZ92eeOUr8HJa4WTyIio7FjRA6dOeJEIUekEzoEq4phkbbNidhWNBKl1Qke7eLV 5SQaIzhHDAGaVNCkdGx09c9L+q+xJRwNq1XzREyyRfDfrEzyWkboT+yd8kZuzIvYz968 itFMCxOmJxBHmyMa6nHGsxGFgNdfvs1Ugrgdh1bSvAGre2+cD7kBKPZvwDgrdxZS1/TQ QezS//fKj7ETKog1GIiDtcYLJVjDSv2dNPip10pt+WZGCYbbk3lSN7HB6mLkkuDi56Mb baV8A4TwUOtNVRMaJz/ZVF1g63tt0awfLof+Up/Pm5dHOcA2if5S46WerzM0iKatIdak 279A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=pUdcbrGsRKxztxzXwChy1wk3slPb9Bqg3SC6Ez/HWEg=; b=I1s/UviA0vR+btlffWuEYrvrSvt9nuGOIqpCmMvqgypJ6qoAxNtXJdm5dGxxbWC1A7 e4XfGh+g3UQjF2nRmBhMoLGwO6xcTrRhzzH88Lt0mgcype6l62QGkj1Js2BfTEJSqDCZ seYbApEhYbT0WbfyS3m69tNRy14rZd19lIan002dpC/4ntGTEzedpFCjFJbJ+R0fNlCl G3LL0Gh2HuYATY/dWvE5zFxntP6nqQxCoBGc0HMnIR2o8xoFa07nINZtF/cxWXlLfRGC HpvLnq8liL6IW/0T2ucimPXHjBxde4WqmyOAXTshOyVLhjVpQyjFMyHmI6xotIIrjU+d cJdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rAey2MCr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si8306906edv.101.2020.06.09.14.21.03; Tue, 09 Jun 2020 14:21:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rAey2MCr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727088AbgFIVQ4 (ORCPT + 99 others); Tue, 9 Jun 2020 17:16:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:39754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727002AbgFIVQ4 (ORCPT ); Tue, 9 Jun 2020 17:16:56 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 499FB20734; Tue, 9 Jun 2020 21:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591737415; bh=Nvv8tC18TUn2Q9L9nrl6b3syykFOx699ZvIEzmFTvkM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rAey2MCrH+shtwqDVjPk5GWl+5+piGcpOqGmSRjQng3Zjr9jbGXxihky8QWIcbWWJ GLkfSGvgJavOsSm7mQQVRHc3dXM0wgLALsD6WvkiOQXH402rcbj3K++akJ6wQSJIAX d+k4NWoKJ9tLJJ8bUwNdjaCddNi6YGDFL7kD74Ys= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 5B4ED40AFD; Tue, 9 Jun 2020 18:16:53 -0300 (-03) Date: Tue, 9 Jun 2020 18:16:53 -0300 From: Arnaldo Carvalho de Melo To: Daniel Borkmann Cc: Alexei Starovoitov , Andrii Nakryiko , Peter Zijlstra , Ian Rogers , Namhyung Kim , Pekka Enberg , Jiri Olsa , Irina Tirdea , bpf , Linux Kernel Mailing List Subject: Re: [PATCH] libbpf: Define __WORDSIZE if not available Message-ID: <20200609211653.GI24868@kernel.org> References: <20200608161150.GA3073@kernel.org> <20200609153445.GF24868@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Jun 09, 2020 at 10:37:48PM +0200, Daniel Borkmann escreveu: > Hey Arnaldo, > > On 6/9/20 5:34 PM, Arnaldo Carvalho de Melo wrote: > > Some systems, such as Android, don't have a define for __WORDSIZE, do it > > in terms of __SIZEOF_LONG__, as done in perf since 2012: > > > > http://git.kernel.org/torvalds/c/3f34f6c0233ae055b5 > > > > For reference: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html > > > > I build tested it here and Andrii did some Travis CI build tests too. > > > > Acked-by: Andrii Nakryiko > > Signed-off-by: Arnaldo Carvalho de Melo > > Diff missing? Oh well, sorry about that, EBADCOFFEE or something: From: Arnaldo Carvalho de Melo Some systems, such as Android, don't have a define for __WORDSIZE, do it in terms of __SIZEOF_LONG__, as done in perf since 2012: http://git.kernel.org/torvalds/c/3f34f6c0233ae055b5 For reference: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html I build tested it here and Andrii did some Travis CI build tests too. Acked-by: Andrii Nakryiko Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h index e823b35e7371..df59fd4fc95b 100644 --- a/tools/lib/bpf/hashmap.h +++ b/tools/lib/bpf/hashmap.h @@ -10,10 +10,9 @@ #include #include -#ifdef __GLIBC__ -#include -#else -#include +#include +#ifndef __WORDSIZE +#define __WORDSIZE (__SIZEOF_LONG__ * 8) #endif static inline size_t hash_bits(size_t h, int bits)