Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp67578imm; Wed, 5 Sep 2018 15:07:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaglZ93WeYT4gUcObuOcM7fB8iJhAad4adDdTW+7cHSTJ3H9jEceM3iqhmCwKzW4j7/rorJ X-Received: by 2002:a63:2506:: with SMTP id l6-v6mr25484819pgl.343.1536185246492; Wed, 05 Sep 2018 15:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536185246; cv=none; d=google.com; s=arc-20160816; b=UTC92CKkE2S1SFR1rkPPfPXQBiye2LUfFuXvbkUF04v31+ulteovVUveLDDS1mrNJr nf4xW7BhzP6q6bxWuQ7SigtFzxt1NxHCGbSZ8v0YcAtjWfj8XTsppwSqb0C1JiUfC/Qo lfWJAZy3RVVUl+Dw9/2h62m9EIePGTbHuacvKB6wwV6VjaLKbzoxXYV051VNRKivgwG9 Eod/vpFV4P9ZI2rk2U/9cmWZ+vdXOXDjypW9nM1d7IenXiQh3DxJW75qeXcYddSIO7Im Fe0w55PRKGVdh8L4a9yLCNxlbPYZJlcZC+bM85AoRzUrar9ZxLBsSsYqOKPnEyQX0vSI HXlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=DNQKeAlLbkb6t/75DTcc/9TMVSpUcNS3NAECwPyjbrc=; b=lce2ULmguaXFnXceigoRo57etkFDxXgONZ0svF60SIogXuBcYXe/2FSNQ87r4orEFl 6aZK8UNXWxthjZtZUyu0e4aeqB1PuD4N82Z9H4Rk6bwEn3msJ7CRdscJXrBzxukD0zIC 0qaMRE0fsF3CH0yASXx7ZtU+T+Q81JcuuEmlkJjrm7HG45Jnu9PYgmrpG009lWFbEoK3 uX9Yx9o04oO8IYF8ZfKlbdZxGFVWaACTqtO90EZ6kG2QEhPMYJPuG7hw3J9iKo1vtkqC y0h/xHCYWEl7P1+o40zD6t6BsdpixYeO7ZbP+lktxtSAUw1XCXb11IO+tlyA274Fo+cz J1vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XmXN+G5+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id j5-v6si3262041pgg.293.2018.09.05.15.07.11; Wed, 05 Sep 2018 15:07:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XmXN+G5+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728207AbeIFChk (ORCPT + 99 others); Wed, 5 Sep 2018 22:37:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:51870 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727518AbeIFChj (ORCPT ); Wed, 5 Sep 2018 22:37:39 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (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 6D5122073D; Wed, 5 Sep 2018 22:05:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536185127; bh=b+szek/s/o/GcvPLNRfe9EqBlEQ6pzSjk0I3bWo3FtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XmXN+G5+qLL0v84aFk6uEGvQjVetXWM+/isJVQZWvVeJyGN+/yGCJ84MtpRdawtex 8NmH23dHemlNrAd2zQEe1/lC8kz4Q6SjZ4Z8YeEtdl9O5ZXzu66y0YWIM0DOppdrCb XXf1GV5BfC7xBPakVNdRngBRCjW56EmlkiEte2oM= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Adrian Hunter , David Ahern , Jiri Olsa , Namhyung Kim , Wang Nan Subject: [PATCH 13/77] perf bpf: Add linux/socket.h to the headers accessible to bpf proggies Date: Wed, 5 Sep 2018 19:03:36 -0300 Message-Id: <20180905220440.20256-14-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180905220440.20256-1-acme@kernel.org> References: <20180905220440.20256-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo So that we don't have to define sockaddr_storage in the augmented_syscalls.c bpf example when hooking into syscalls needing it, idea is to mimic the system headers. Eventually we probably need to have sys/socket.h, etc. Start by having at least linux/socket.h. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-yhzarcvsjue8pgpvkjhqgioc@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Makefile.perf | 4 +++- tools/perf/include/bpf/linux/socket.h | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tools/perf/include/bpf/linux/socket.h diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 5224ade3d5af..92514fb3689f 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -779,7 +779,9 @@ endif ifndef NO_LIBBPF $(call QUIET_INSTALL, bpf-headers) \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perf_include_instdir_SQ)/bpf'; \ - $(INSTALL) include/bpf/*.h -t '$(DESTDIR_SQ)$(perf_include_instdir_SQ)/bpf' + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perf_include_instdir_SQ)/bpf/linux'; \ + $(INSTALL) include/bpf/*.h -t '$(DESTDIR_SQ)$(perf_include_instdir_SQ)/bpf'; \ + $(INSTALL) include/bpf/linux/*.h -t '$(DESTDIR_SQ)$(perf_include_instdir_SQ)/bpf/linux' $(call QUIET_INSTALL, bpf-examples) \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perf_examples_instdir_SQ)/bpf'; \ $(INSTALL) examples/bpf/*.c -t '$(DESTDIR_SQ)$(perf_examples_instdir_SQ)/bpf' diff --git a/tools/perf/include/bpf/linux/socket.h b/tools/perf/include/bpf/linux/socket.h new file mode 100644 index 000000000000..7f844568dab8 --- /dev/null +++ b/tools/perf/include/bpf/linux/socket.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI_LINUX_SOCKET_H +#define _UAPI_LINUX_SOCKET_H + +/* + * Desired design of maximum size and alignment (see RFC2553) + */ +#define _K_SS_MAXSIZE 128 /* Implementation specific max size */ +#define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *)) + /* Implementation specific desired alignment */ + +typedef unsigned short __kernel_sa_family_t; + +struct __kernel_sockaddr_storage { + __kernel_sa_family_t ss_family; /* address family */ + /* Following field(s) are implementation specific */ + char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; + /* space to achieve desired size, */ + /* _SS_MAXSIZE value minus size of ss_family */ +} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ + +#define sockaddr_storage __kernel_sockaddr_storage + +#endif /* _UAPI_LINUX_SOCKET_H */ -- 2.14.4