MCPcopy Create free account
hub / github.com/XpuOS/xsched / GetFileHandle

Function GetFileHandle

platforms/hip/hal/src/kernel_param.cpp:67–83  ·  view source on GitHub ↗

Copy from rocclr/hipamd/src/hip_fatbin.cpp

Source from the content-addressed store, hash-verified

65
66// Copy from rocclr/hipamd/src/hip_fatbin.cpp
67static 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 { \

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected