Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932446AbcCHF7u (ORCPT ); Tue, 8 Mar 2016 00:59:50 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:51333 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753941AbcCHF5Y (ORCPT ); Tue, 8 Mar 2016 00:57:24 -0500 From: Alexei Starovoitov To: "David S . Miller" CC: Daniel Borkmann , Daniel Wagner , Tom Zanussi , Wang Nan , He Kuang , Martin KaFai Lau , Brendan Gregg , , , Subject: [PATCH v2 net-next 06/12] samples/bpf: make map creation more verbose Date: Mon, 7 Mar 2016 21:57:18 -0800 Message-ID: <1457416641-306326-7-git-send-email-ast@fb.com> X-Mailer: git-send-email 2.8.0.rc1 In-Reply-To: <1457416641-306326-1-git-send-email-ast@fb.com> References: <1457416641-306326-1-git-send-email-ast@fb.com> X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-03-08_04:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 841 Lines: 28 map creation is typically the first one to fail when rlimits are too low, not enough memory, etc Make this failure scenario more verbose Signed-off-by: Alexei Starovoitov --- samples/bpf/bpf_load.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c index da86a8e0a95a..816bca5760a0 100644 --- a/samples/bpf/bpf_load.c +++ b/samples/bpf/bpf_load.c @@ -158,8 +158,11 @@ static int load_maps(struct bpf_map_def *maps, int len) maps[i].key_size, maps[i].value_size, maps[i].max_entries); - if (map_fd[i] < 0) + if (map_fd[i] < 0) { + printf("failed to create a map: %d %s\n", + errno, strerror(errno)); return 1; + } if (maps[i].type == BPF_MAP_TYPE_PROG_ARRAY) prog_array_fd = map_fd[i]; -- 2.8.0.rc1