staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / tools / testing / selftests / bpf / prog_tests / spinlock.c
blob114ebe6a438e562d864971a5a5d174b1e0936f8a
1 // SPDX-License-Identifier: GPL-2.0
2 #include <test_progs.h>
4 void test_spinlock(void)
6 const char *file = "./test_spin_lock.o";
7 pthread_t thread_id[4];
8 struct bpf_object *obj = NULL;
9 int prog_fd;
10 int err = 0, i;
11 void *ret;
13 err = bpf_prog_load(file, BPF_PROG_TYPE_CGROUP_SKB, &obj, &prog_fd);
14 if (err) {
15 printf("test_spin_lock:bpf_prog_load errno %d\n", errno);
16 goto close_prog;
18 for (i = 0; i < 4; i++)
19 assert(pthread_create(&thread_id[i], NULL,
20 &spin_lock_thread, &prog_fd) == 0);
21 for (i = 0; i < 4; i++)
22 assert(pthread_join(thread_id[i], &ret) == 0 &&
23 ret == (void *)&prog_fd);
24 goto close_prog_noerr;
25 close_prog:
26 error_cnt++;
27 close_prog_noerr:
28 bpf_object__close(obj);