File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -233,7 +233,20 @@ OSModuleHandle OSUtil::getOSModuleHandle(const void *VirtAddr) {
233
233
return reinterpret_cast <OSModuleHandle>(Res.dli_fbase );
234
234
}
235
235
236
- std::string OSUtil::getCurrentDSODir () { return " " ; }
236
+ std::string OSUtil::getCurrentDSODir () {
237
+ auto CurrentFunc = reinterpret_cast <const void *>(&getCurrentDSODir);
238
+ Dl_info Info;
239
+ int RetCode = dladdr (CurrentFunc, &Info);
240
+ if (0 == RetCode) {
241
+ // This actually indicates an error
242
+ return " " ;
243
+ }
244
+
245
+ auto Path = std::string (Info.dli_fname );
246
+ auto LastSlashPos = Path.find_last_of (' /' );
247
+
248
+ return Path.substr (0 , LastSlashPos);
249
+ }
237
250
238
251
#endif // __SYCL_RT_OS
239
252
Original file line number Diff line number Diff line change @@ -39,12 +39,12 @@ bool isSameDir(const char* LHS, const char* RHS) {
39
39
struct stat StatBuf;
40
40
if (stat (LHS, &StatBuf)) {
41
41
perror (" stat failed" );
42
- exit (EXIT_FAILURE) ;
42
+ return false ;
43
43
}
44
44
ino_t InodeLHS = StatBuf.st_ino ;
45
45
if (stat (RHS, &StatBuf)) {
46
46
perror (" stat failed" );
47
- exit (EXIT_FAILURE) ;
47
+ return false ;
48
48
}
49
49
ino_t InodeRHS = StatBuf.st_ino ;
50
50
return InodeRHS == InodeLHS;
You can’t perform that action at this time.
0 commit comments