Commit cce028d8 authored by 4ast's avatar 4ast Committed by GitHub

Merge pull request #1194 from palmtenor/minor_fixes

Minor fixes for example and compiler warning
parents cb3d1618 9190ef5b
......@@ -32,7 +32,7 @@ BPF_HASH(counts, struct stack_key_t, uint64_t);
int on_tcp_send(struct pt_regs *ctx) {
struct stack_key_t key = {};
key.pid = bpf_get_current_pid_tgid();
key.pid = bpf_get_current_pid_tgid() >> 32;
bpf_get_current_comm(&key.name, sizeof(key.name));
key.kernel_stack = stack_traces.get_stackid(ctx, BPF_F_REUSE_STACKID);
key.user_stack = stack_traces.get_stackid(
......
......@@ -159,7 +159,7 @@ int bpf_get_first_key(int fd, void *key, size_t key_size)
// trigger a page fault in kernel and affect performence. Hence we use
// ~0 which will fail and return fast.
// This should fail since we pass an invalid pointer for value.
if (bpf_lookup_elem(fd, key, ~0) >= 0)
if (bpf_lookup_elem(fd, key, (void *)~0) >= 0)
return -1;
// This means the key doesn't exist.
if (errno == ENOENT)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment