changeset 8722:7a07724256c2 quic

Core: fixed build with BPF on non-64bit platforms (ticket #2152).
author Vladimir Homutov <vl@nginx.com>
date Tue, 23 Mar 2021 10:58:18 +0300
parents 85e60c064728
children 265062a99043
files src/core/ngx_bpf.c
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/ngx_bpf.c
+++ b/src/core/ngx_bpf.c
@@ -45,14 +45,14 @@ ngx_bpf_load_program(ngx_log_t *log, ngx
 
     ngx_memzero(&attr, sizeof(union bpf_attr));
 
-    attr.license = (uint64_t) program->license;
+    attr.license = (uintptr_t) program->license;
     attr.prog_type = program->type;
-    attr.insns = (uint64_t) program->ins;
+    attr.insns = (uintptr_t) program->ins;
     attr.insn_cnt = program->nins;
 
 #if (NGX_DEBUG)
     /* for verifier errors */
-    attr.log_buf = (uint64_t) buf;
+    attr.log_buf = (uintptr_t) buf;
     attr.log_size = NGX_BPF_LOGBUF_SIZE;
     attr.log_level = 1;
 #endif
@@ -106,8 +106,8 @@ ngx_bpf_map_update(int fd, const void *k
     ngx_memzero(&attr, sizeof(union bpf_attr));
 
     attr.map_fd = fd;
-    attr.key = (uint64_t) key;
-    attr.value = (uint64_t) value;
+    attr.key = (uintptr_t) key;
+    attr.value = (uintptr_t) value;
     attr.flags = flags;
 
     return ngx_bpf(BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr));
@@ -122,7 +122,7 @@ ngx_bpf_map_delete(int fd, const void *k
     ngx_memzero(&attr, sizeof(union bpf_attr));
 
     attr.map_fd = fd;
-    attr.key = (uint64_t) key;
+    attr.key = (uintptr_t) key;
 
     return ngx_bpf(BPF_MAP_DELETE_ELEM, &attr, sizeof(attr));
 }
@@ -136,8 +136,8 @@ ngx_bpf_map_lookup(int fd, const void *k
     ngx_memzero(&attr, sizeof(union bpf_attr));
 
     attr.map_fd = fd;
-    attr.key = (uint64_t) key;
-    attr.value = (uint64_t) value;
+    attr.key = (uintptr_t) key;
+    attr.value = (uintptr_t) value;
 
     return ngx_bpf(BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr));
 }