Mercurial > hg > nginx
diff 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 |
line wrap: on
line diff
--- a/auto/os/linux +++ b/auto/os/linux @@ -208,3 +208,29 @@ ngx_include="sys/vfs.h"; . auto/incl CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64" + + +# (E)BPF + +ngx_feature="BPF support" +ngx_feature_name="NGX_HAVE_BPF" +ngx_feature_run=no +ngx_feature_incs="#include <linux/bpf.h> + #include <sys/syscall.h>" +ngx_feature_path= +ngx_feature_libs= +ngx_feature_test=" + union bpf_attr attr = { 0 }; + /* only declare BPF support if all required features found */ + attr.map_flags = 0; + attr.map_type = BPF_MAP_TYPE_SOCKHASH; + syscall(__NR_bpf, 0, &attr, 0);" + +. auto/feature + +if [ $ngx_found = yes ]; then + BPF_FOUND=YES + + CORE_SRCS="$CORE_SRCS src/core/ngx_bpf.c" + CORE_DEPS="$CORE_DEPS src/core/ngx_bpf.h" +fi