bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: andrii@kernel.org, ast@kernel.org, daniel@iogearbox.net,
	kafai@fb.com, songliubraving@fb.com, yhs@fb.com,
	john.fastabend@gmail.com, kpsingh@kernel.org, shuah@kernel.org
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Yafang Shao <laoar.shao@gmail.com>
Subject: [PATCH bpf-next v3 02/27] bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdpxceiver
Date: Tue,  5 Apr 2022 13:08:33 +0000	[thread overview]
Message-ID: <20220405130858.12165-3-laoar.shao@gmail.com> (raw)
In-Reply-To: <20220405130858.12165-1-laoar.shao@gmail.com>

Explicitly set libbpf 1.0 API mode, then we can avoid using the deprecated
RLIMIT_MEMLOCK.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 tools/testing/selftests/bpf/xdpxceiver.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index 5f8296d29e77..cfcb031323c5 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -90,7 +90,6 @@
 #include <string.h>
 #include <stddef.h>
 #include <sys/mman.h>
-#include <sys/resource.h>
 #include <sys/types.h>
 #include <sys/queue.h>
 #include <time.h>
@@ -1448,14 +1447,13 @@ static void ifobject_delete(struct ifobject *ifobj)
 
 int main(int argc, char **argv)
 {
-	struct rlimit _rlim = { RLIM_INFINITY, RLIM_INFINITY };
 	struct pkt_stream *pkt_stream_default;
 	struct ifobject *ifobj_tx, *ifobj_rx;
 	struct test_spec test;
 	u32 i, j;
 
-	if (setrlimit(RLIMIT_MEMLOCK, &_rlim))
-		exit_with_error(errno);
+	/* Use libbpf 1.0 API mode */
+	libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
 
 	ifobj_tx = ifobject_create();
 	if (!ifobj_tx)
-- 
2.17.1


  parent reply	other threads:[~2022-04-05 19:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 01/27] bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdping Yafang Shao
2022-04-05 13:08 ` Yafang Shao [this message]
2022-04-05 13:08 ` [PATCH bpf-next v3 03/27] bpf: selftests: No need to include bpf_rlimit.h in test_tcpnotify_user Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 04/27] bpf: selftests: No need to include bpf_rlimit.h in flow_dissector_load Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 05/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 06/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_cgroup_storage Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 07/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user Yafang Shao
2022-04-05 20:46   ` Jeff Johnson
2022-04-06 14:33     ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 08/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lpm_map Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 09/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lru_map Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 10/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_skb_cgroup_id_user Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 11/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock_addr Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 12/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 13/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sockmap Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 14/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sysctl Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 15/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tag Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 16/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tcp_check_syncookie_user Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 17/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_verifier_log Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 18/27] bpf: samples: Set libbpf 1.0 API mode explicitly in hbm Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 19/27] bpf: selftests: Get rid of bpf_rlimit.h Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 20/27] bpf: selftests: No need to include sys/resource.h in some files Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 21/27] bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdpsock_user Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 22/27] bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xsk_fwd Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 23/27] bpf: samples: No need to include sys/resource.h in many files Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 24/27] bpf: bpftool: Remove useless return value of libbpf_set_strict_mode Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 25/27] bpf: bpftool: Set LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK for legacy libbpf Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 26/27] bpf: bpftool: remove RLIMIT_MEMLOCK Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 27/27] bpf: runqslower: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK Yafang Shao
2022-04-05 20:52 ` [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Andrii Nakryiko
2022-04-06 14:32   ` Yafang Shao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220405130858.12165-3-laoar.shao@gmail.com \
    --to=laoar.shao@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).