pids.c (f81483aaeb59da530b286fe5d081e1705eb5c886) | pids.c (622a5b582cc27d3deedc38fcef68da2972e8e58d) |
---|---|
1// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2/* Copyright (C) 2020 Facebook */ 3#include <errno.h> | 1// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2/* Copyright (C) 2020 Facebook */ 3#include <errno.h> |
4#include <linux/err.h> |
|
4#include <stdbool.h> 5#include <stdio.h> 6#include <stdlib.h> 7#include <string.h> 8#include <unistd.h> 9 10#include <bpf/bpf.h> 11#include <bpf/hashmap.h> --- 84 unchanged lines hidden (view full) --- 96{ 97 struct pid_iter_entry *e; 98 char buf[4096 / sizeof(*e) * sizeof(*e)]; 99 struct pid_iter_bpf *skel; 100 int err, ret, fd = -1, i; 101 libbpf_print_fn_t default_print; 102 103 *map = hashmap__new(hash_fn_for_key_as_id, equal_fn_for_key_as_id, NULL); | 5#include <stdbool.h> 6#include <stdio.h> 7#include <stdlib.h> 8#include <string.h> 9#include <unistd.h> 10 11#include <bpf/bpf.h> 12#include <bpf/hashmap.h> --- 84 unchanged lines hidden (view full) --- 97{ 98 struct pid_iter_entry *e; 99 char buf[4096 / sizeof(*e) * sizeof(*e)]; 100 struct pid_iter_bpf *skel; 101 int err, ret, fd = -1, i; 102 libbpf_print_fn_t default_print; 103 104 *map = hashmap__new(hash_fn_for_key_as_id, equal_fn_for_key_as_id, NULL); |
104 if (!*map) { | 105 if (IS_ERR(*map)) { |
105 p_err("failed to create hashmap for PID references"); 106 return -1; 107 } 108 set_max_rlimit(); 109 110 skel = pid_iter_bpf__open(); 111 if (!skel) { 112 p_err("failed to open PID iterator skeleton"); --- 135 unchanged lines hidden --- | 106 p_err("failed to create hashmap for PID references"); 107 return -1; 108 } 109 set_max_rlimit(); 110 111 skel = pid_iter_bpf__open(); 112 if (!skel) { 113 p_err("failed to open PID iterator skeleton"); --- 135 unchanged lines hidden --- |