Copy from rocclr/hipamd/src/hip_fatbin.cpp
| 65 | |
| 66 | // Copy from rocclr/hipamd/src/hip_fatbin.cpp |
| 67 | static bool GetFileHandle(const char *fname, int *fd_ptr, size_t *sz_ptr) |
| 68 | { |
| 69 | if ((fd_ptr == nullptr) || (sz_ptr == nullptr)) return false; |
| 70 | // open system function call, return false on fail |
| 71 | struct stat stat_buf; |
| 72 | *fd_ptr = open(fname, O_RDONLY); |
| 73 | if (*fd_ptr < 0) return false; |
| 74 | |
| 75 | // Retrieve stat info and size |
| 76 | if (fstat(*fd_ptr, &stat_buf) != 0) { |
| 77 | close(*fd_ptr); |
| 78 | return false; |
| 79 | } |
| 80 | |
| 81 | *sz_ptr = stat_buf.st_size; |
| 82 | return true; |
| 83 | } |
| 84 | |
| 85 | #define ASSERT_COMGR_STATUS(expr) \ |
| 86 | do { \ |
no outgoing calls
no test coverage detected