P4 to Git Change 1054614 by marsenau@marsenau_home on 2014/07/11 19:01:37
ECR #304775 - Fix valgrind use of uninitialized errors, modernize by using unique_ptr, and use existing function to extract filename from path.
Should probably also fix the static constructors this is called from.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/os/os_posix.cpp#37 edit
[ROCm/clr commit: a901b12dd1]
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include <cstdlib>
|
||||
#include <cstdio> // for tempnam
|
||||
#include <limits.h>
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
||||
@@ -91,7 +92,7 @@ divisionErrorHandler(int sig, siginfo_t* info, void* ptr)
|
||||
#if defined(ATI_ARCH_X86)
|
||||
insn = (address)uc->uc_mcontext.gregs[LP64_SWITCH(REG_EIP,REG_RIP)];
|
||||
#else
|
||||
assert(!"Unimplemented");
|
||||
assert(!"Unimplemented");
|
||||
#endif
|
||||
|
||||
// Call the chained signal handler
|
||||
@@ -110,7 +111,7 @@ divisionErrorHandler(int sig, siginfo_t* info, void* ptr)
|
||||
#if defined(ATI_ARCH_X86)
|
||||
uc->uc_mcontext.gregs[LP64_SWITCH(REG_EIP,REG_RIP)] = (greg_t)insn;
|
||||
#else
|
||||
assert(!"Unimplemented");
|
||||
assert(!"Unimplemented");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -865,16 +866,14 @@ size_t Os::getPhysicalMemSize()
|
||||
|
||||
std::string Os::getAppFileName()
|
||||
{
|
||||
std::string strFileName;
|
||||
char* buff = new char[FILE_PATH_MAX_LENGTH];
|
||||
std::unique_ptr<char[]> buff(new char[FILE_PATH_MAX_LENGTH]());
|
||||
|
||||
if (readlink("/proc/self/exe", buff, FILE_PATH_MAX_LENGTH) > 0) {
|
||||
if (readlink("/proc/self/exe", buff.get(), FILE_PATH_MAX_LENGTH) > 0) {
|
||||
// Get filename without path and extension.
|
||||
strFileName = strrchr(buff, '/') ? strrchr(buff, '/') + 1 : buff;
|
||||
return std::string(basename(buff.get()));
|
||||
}
|
||||
|
||||
delete buff;
|
||||
return strFileName;
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace amd
|
||||
|
||||
Reference in New Issue
Block a user