Skip to content

Commit 8efffab

Browse files
committed
Merge branch 'selftests-bpf-improve-libc-portability-musl-support-part-1'
Tony Ambardar says: ==================== selftests/bpf: Improve libc portability / musl support (part 1) Hello all, This series includes the bulk of libc-related compile fixes accumulated to support systems using musl, with smaller numbers to follow. These patches are simple and straightforward, and the series has been tested with the kernel-patches/bpf CI and locally using mips64el-gcc/musl-libc and QEMU with an OpenWrt rootfs. The patches address a few general categories of libc portability issues: - missing, redundant or incorrect include headers - disabled GNU header extensions (i.e. missing #define _GNU_SOURCE) - issues with types and casting Feedback and suggestions for improvement are welcome! Thanks, Tony ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andrii Nakryiko <[email protected]>
2 parents 6b376e7 + 730561d commit 8efffab

18 files changed

+12
-12
lines changed

tools/testing/selftests/bpf/bench.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <sys/sysinfo.h>
1111
#include <signal.h>
1212
#include "bench.h"
13+
#include "bpf_util.h"
1314
#include "testing_helpers.h"
1415

1516
struct env env = {

tools/testing/selftests/bpf/bench.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <math.h>
1111
#include <time.h>
1212
#include <sys/syscall.h>
13+
#include <limits.h>
1314

1415
struct cpu_set {
1516
bool *cpus;

tools/testing/selftests/bpf/map_tests/sk_storage_map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static void test_sk_storage_map_stress_free(void)
412412
rlim_new.rlim_max = rlim_new.rlim_cur + 128;
413413
err = setrlimit(RLIMIT_NOFILE, &rlim_new);
414414
CHECK(err, "setrlimit(RLIMIT_NOFILE)", "rlim_new:%lu errno:%d",
415-
rlim_new.rlim_cur, errno);
415+
(unsigned long) rlim_new.rlim_cur, errno);
416416
}
417417

418418
err = do_sk_storage_map_stress_free();

tools/testing/selftests/bpf/prog_tests/bpf_iter_setsockopt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static unsigned short get_local_port(int fd)
9595
struct sockaddr_in6 addr;
9696
socklen_t addrlen = sizeof(addr);
9797

98-
if (!getsockname(fd, &addr, &addrlen))
98+
if (!getsockname(fd, (struct sockaddr *)&addr, &addrlen))
9999
return ntohs(addr.sin6_port);
100100

101101
return 0;

tools/testing/selftests/bpf/prog_tests/core_reloc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
#define _GNU_SOURCE
23
#include <test_progs.h>
34
#include "progs/core_reloc_types.h"
45
#include "bpf_testmod/bpf_testmod.h"

tools/testing/selftests/bpf/prog_tests/crypto_sanity.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <sys/types.h>
55
#include <sys/socket.h>
66
#include <net/if.h>
7-
#include <linux/in6.h>
87
#include <linux/if_alg.h>
98

109
#include "test_progs.h"

tools/testing/selftests/bpf/prog_tests/decap_sanity.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <sys/types.h>
55
#include <sys/socket.h>
66
#include <net/if.h>
7-
#include <linux/in6.h>
87

98
#include "test_progs.h"
109
#include "network_helpers.h"

tools/testing/selftests/bpf/prog_tests/flow_dissector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
#define _GNU_SOURCE
23
#include <test_progs.h>
34
#include <network_helpers.h>
4-
#include <error.h>
55
#include <linux/if_tun.h>
66
#include <sys/uio.h>
77

tools/testing/selftests/bpf/prog_tests/kfree_skb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
#define _GNU_SOURCE
23
#include <test_progs.h>
34
#include <network_helpers.h>
45
#include "kfree_skb.skel.h"

tools/testing/selftests/bpf/prog_tests/lwt_redirect.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#include <linux/if_ether.h>
4848
#include <linux/if_packet.h>
4949
#include <linux/if_tun.h>
50-
#include <linux/icmp.h>
5150
#include <arpa/inet.h>
5251
#include <unistd.h>
5352
#include <errno.h>

0 commit comments

Comments
 (0)