comparison auto/os/linux @ 8675:d3747ba486e7 quic

Core: added interface to linux bpf() system call. It contains wrappers for operations with BPF maps and for loading BPF programs.
author Vladimir Homutov <vl@nginx.com>
date Tue, 15 Dec 2020 15:23:07 +0300
parents f7e79596baf2
children 7df607cb2d11
comparison
equal deleted inserted replaced
8674:2c7f927f7999 8675:d3747ba486e7
206 206
207 ngx_include="sys/vfs.h"; . auto/include 207 ngx_include="sys/vfs.h"; . auto/include
208 208
209 209
210 CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64" 210 CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
211
212
213 # (E)BPF
214
215 ngx_feature="BPF support"
216 ngx_feature_name="NGX_HAVE_BPF"
217 ngx_feature_run=no
218 ngx_feature_incs="#include <linux/bpf.h>
219 #include <sys/syscall.h>"
220 ngx_feature_path=
221 ngx_feature_libs=
222 ngx_feature_test="
223 union bpf_attr attr = { 0 };
224 /* only declare BPF support if all required features found */
225 attr.map_flags = 0;
226 attr.map_type = BPF_MAP_TYPE_SOCKHASH;
227 syscall(__NR_bpf, 0, &attr, 0);"
228
229 . auto/feature
230
231 if [ $ngx_found = yes ]; then
232 BPF_FOUND=YES
233
234 CORE_SRCS="$CORE_SRCS src/core/ngx_bpf.c"
235 CORE_DEPS="$CORE_DEPS src/core/ngx_bpf.h"
236 fi