1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */
3 #define _SDT_HAS_SEMAPHORES 1
4 #include "sdt.h"
5 
6 #define SHARED 1
7 #include "bpf/libbpf_internal.h"
8 
9 #define SEC(name) __attribute__((section(name), used))
10 
11 unsigned short urandlib_read_with_sema_semaphore SEC(".probes");
12 
urandlib_read_with_sema(int iter_num,int iter_cnt,int read_sz)13 void urandlib_read_with_sema(int iter_num, int iter_cnt, int read_sz)
14 {
15 	STAP_PROBE3(urandlib, read_with_sema, iter_num, iter_cnt, read_sz);
16 }
17 
18 COMPAT_VERSION(urandlib_api_v1, urandlib_api, LIBURANDOM_READ_1.0.0)
urandlib_api_v1(void)19 int urandlib_api_v1(void)
20 {
21 	return 1;
22 }
23 
24 DEFAULT_VERSION(urandlib_api_v2, urandlib_api, LIBURANDOM_READ_2.0.0)
urandlib_api_v2(void)25 int urandlib_api_v2(void)
26 {
27 	return 2;
28 }
29 
30 COMPAT_VERSION(urandlib_api_sameoffset, urandlib_api_sameoffset, LIBURANDOM_READ_1.0.0)
31 DEFAULT_VERSION(urandlib_api_sameoffset, urandlib_api_sameoffset, LIBURANDOM_READ_2.0.0)
urandlib_api_sameoffset(void)32 int urandlib_api_sameoffset(void)
33 {
34 	return 3;
35 }
36