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
;
13 err
= bpf_prog_load(file
, BPF_PROG_TYPE_CGROUP_SKB
, &obj
, &prog_fd
);
14 if (CHECK_FAIL(err
)) {
15 printf("test_spin_lock:bpf_prog_load errno %d\n", errno
);
18 for (i
= 0; i
< 4; i
++)
19 if (CHECK_FAIL(pthread_create(&thread_id
[i
], NULL
,
20 &spin_lock_thread
, &prog_fd
)))
23 for (i
= 0; i
< 4; i
++)
24 if (CHECK_FAIL(pthread_join(thread_id
[i
], &ret
) ||
25 ret
!= (void *)&prog_fd
))
28 bpf_object__close(obj
);