map.lookup() does not accept a pointer to const
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
A bit confusing.
Code:
```C
BPF_HASH(children_map, u64, u64);
...
{
u64 pid_tid = bpf_get_current_pid_tgid();
const u64 pid = (pid_tid >> 32);
u64 *val = children_map.lookup(&pid);
}
```
Message:
```
main.c:28515:34: warning: passing 'const u64 *' (aka 'const unsigned long
long *') to parameter of type 'u64 *' (aka 'unsigned long long *') discards
qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
u64 *val = children_map.lookup(&pid);
^~~~
```
Removing const avoid warning message
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the compiler warning with the BPF_HASH example, then trace the map.lookup() declaration and implementation used by BCC. Done means a pointer to const u64 is accepted without the discarded-qualifiers warning while preserving the existing lookup behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100