iovisor / iovisor/bcc

error: declaration of 'struct pt_regs' will not be visible outside of this function

Open
#4,778 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
5d 13h
Merged PRs (30d)
3

Description

When I ran oom_kill_process referring to https://github.com/iovisor/bcc/blob/master/tools/oomkill.py, I saw that `linux/oom.h` was referenced, and I looked at `/usr/include /linux.oom.h` file, found that the content inside is
```
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __INCLUDE_LINUX_OOM_H
#define __INCLUDE_LINUX_OOM_H

/*
* /proc//oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for
* pid.
*/
#define OOM_SCORE_ADJ_MIN (-1000)
#define OOM_SCORE_ADJ_MAX 1000

/*
* /proc//oom_adj set to -17 protects from the oom killer for legacy
* purposes.
*/
#define OOM_DISABLE (-17)
/* inclusive */
#define OOM_ADJUST_MIN (-16)
#define OOM_ADJUST_MAX 15

#endif /* __INCLUDE_LINUX_OOM_H */
```

I went through the following steps:
```
apt-get install linux-headers-generic
```
Then I found that the contents of `/usr/src/linux-headers-6.5.0-9/include/linux/oom.h` are:
```
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __INCLUDE_LINUX_OOM_H
#define __INCLUDE_LINUX_OOM_H

#include
#include
#include
#include
#include /* MMF_* */
#include /* VM_FAULT* */

struct zonelist;
struct notifier_block;
struct mem_cgroup;
struct task_struct;

enum oom_constraint {
CONSTRAINT_NONE,
CONSTRAINT_CPUSET,
CONSTRAINT_MEMORY_POLICY,
CONSTRAINT_MEMCG,
};
...
```

I did not specify -I/usr/src/linux-headers-6.5.0-9/include in clang. Can someone tell me why the content in `/usr/include/linux/oom.h` is missing? Grateful

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with tools/oomkill.py and the clang invocation used for oom_kill_process. Compare the system /usr/include/linux/oom.h with the installed kernel-header path and trace which include directories are searched. Done means identifying why the expected declarations are not visible and documenting a reproducible resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux, python
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.