Lines 115-120
bool is_dir(const string& path)
Link Here
|
115 |
return S_ISDIR(buf.st_mode); |
115 |
return S_ISDIR(buf.st_mode); |
116 |
} |
116 |
} |
117 |
|
117 |
|
|
|
118 |
bool is_file(const string& path) |
119 |
{ |
120 |
struct stat buf; |
121 |
|
122 |
if (::stat (path.c_str (), &buf) < 0) |
123 |
return false; |
124 |
|
125 |
return S_ISREG(buf.st_mode); |
126 |
} |
127 |
|
118 |
std::pair<bool, string> get_kernel_path_info(const string kdir) |
128 |
std::pair<bool, string> get_kernel_path_info(const string kdir) |
119 |
{ |
129 |
{ |
120 |
if (is_dir(kdir + "/build") && is_dir(kdir + "/source")) |
130 |
if (is_dir(kdir + "/build") && is_dir(kdir + "/source")) |
Lines 170-176
int ClangLoader::parse(unique_ptr<llvm::Module> *mod, TableStorage &ts,
Link Here
|
170 |
} |
180 |
} |
171 |
|
181 |
|
172 |
// If all attempts to obtain kheaders fail, check for kheaders.tar.xz in sysfs |
182 |
// If all attempts to obtain kheaders fail, check for kheaders.tar.xz in sysfs |
173 |
if (!is_dir(kpath)) { |
183 |
if (!is_file(kpath + "/include/linux/kconfig.h")) { |
174 |
int ret = get_proc_kheaders(tmpdir); |
184 |
int ret = get_proc_kheaders(tmpdir); |
175 |
if (!ret) { |
185 |
if (!ret) { |
176 |
kpath = tmpdir; |
186 |
kpath = tmpdir; |