mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-04 16:24:29 -04:00
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/cover.1721713597.git.tony.ambardar@gmail.com Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <sys/sysinfo.h>
|
||||
#include <signal.h>
|
||||
#include "bench.h"
|
||||
#include "bpf_util.h"
|
||||
#include "testing_helpers.h"
|
||||
|
||||
struct env env = {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <limits.h>
|
||||
|
||||
struct cpu_set {
|
||||
bool *cpus;
|
||||
|
||||
@@ -412,7 +412,7 @@ static void test_sk_storage_map_stress_free(void)
|
||||
rlim_new.rlim_max = rlim_new.rlim_cur + 128;
|
||||
err = setrlimit(RLIMIT_NOFILE, &rlim_new);
|
||||
CHECK(err, "setrlimit(RLIMIT_NOFILE)", "rlim_new:%lu errno:%d",
|
||||
rlim_new.rlim_cur, errno);
|
||||
(unsigned long) rlim_new.rlim_cur, errno);
|
||||
}
|
||||
|
||||
err = do_sk_storage_map_stress_free();
|
||||
|
||||
@@ -95,7 +95,7 @@ static unsigned short get_local_port(int fd)
|
||||
struct sockaddr_in6 addr;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
|
||||
if (!getsockname(fd, &addr, &addrlen))
|
||||
if (!getsockname(fd, (struct sockaddr *)&addr, &addrlen))
|
||||
return ntohs(addr.sin6_port);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#define _GNU_SOURCE
|
||||
#include <test_progs.h>
|
||||
#include "progs/core_reloc_types.h"
|
||||
#include "bpf_testmod/bpf_testmod.h"
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <linux/in6.h>
|
||||
#include <linux/if_alg.h>
|
||||
|
||||
#include "test_progs.h"
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <linux/in6.h>
|
||||
|
||||
#include "test_progs.h"
|
||||
#include "network_helpers.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#define _GNU_SOURCE
|
||||
#include <test_progs.h>
|
||||
#include <network_helpers.h>
|
||||
#include <error.h>
|
||||
#include <linux/if_tun.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#define _GNU_SOURCE
|
||||
#include <test_progs.h>
|
||||
#include <network_helpers.h>
|
||||
#include "kfree_skb.skel.h"
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <linux/if_tun.h>
|
||||
#include <linux/icmp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <sched.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <fcntl.h>
|
||||
#include "network_helpers.h"
|
||||
|
||||
#define STACK_SIZE (1024 * 1024)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <test_progs.h>
|
||||
#include <network_helpers.h>
|
||||
#include "test_parse_tcp_hdr_opt.skel.h"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <fcntl.h>
|
||||
#include <sched.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#define _GNU_SOURCE
|
||||
#include <test_progs.h>
|
||||
#include "cgroup_helpers.h"
|
||||
#include "network_helpers.h"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/ring_buffer.h>
|
||||
#include <linux/build_bug.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#ifndef __PROGS_CG_STORAGE_MULTI_H
|
||||
#define __PROGS_CG_STORAGE_MULTI_H
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
struct cgroup_value {
|
||||
__u32 egress_pkts;
|
||||
__u32 ingress_pkts;
|
||||
|
||||
@@ -1731,7 +1731,7 @@ int main(int argc, char **argv)
|
||||
/* launch workers if requested */
|
||||
env.worker_id = -1; /* main process */
|
||||
if (env.workers) {
|
||||
env.worker_pids = calloc(sizeof(__pid_t), env.workers);
|
||||
env.worker_pids = calloc(sizeof(pid_t), env.workers);
|
||||
env.worker_socks = calloc(sizeof(int), env.workers);
|
||||
if (env.debug)
|
||||
fprintf(stdout, "Launching %d workers.\n", env.workers);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <error.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
Reference in New Issue
Block a user