2014-05-16 18:51:01 +08:00
|
|
|
//===-- MIUtilSystemLinux.cpp -----------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-02-11 01:16:13 +08:00
|
|
|
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__linux__)
|
2014-05-16 18:51:01 +08:00
|
|
|
|
|
|
|
// In-house headers:
|
|
|
|
#include "MIUtilSystemLinux.h"
|
|
|
|
#include "MICmnResources.h"
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: CMIUtilSystemLinux constructor.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: None.
|
|
|
|
// Return: None.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
CMIUtilSystemLinux::CMIUtilSystemLinux(void)
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: CMIUtilSystemLinux destructor.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: None.
|
|
|
|
// Return: None.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
CMIUtilSystemLinux::~CMIUtilSystemLinux(void)
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: Retrieve the OS system error message for the given system error code.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: vError - (R) OS error code value.
|
|
|
|
// vrwErrorMsg - (W) The error message.
|
|
|
|
// Return: MIstatus::success - Functional succeeded.
|
|
|
|
// MIstatus::failure - Functional failed.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
bool
|
|
|
|
CMIUtilSystemLinux::GetOSErrorMsg(const MIint vError, CMIUtilString &vrwErrorMsg) const
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
2014-11-18 02:06:21 +08:00
|
|
|
// Reset
|
|
|
|
vrwErrorMsg.clear();
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
bool bOk = MIstatus::failure;
|
|
|
|
|
|
|
|
// ToDo: Implement LINUX version
|
|
|
|
|
|
|
|
return bOk;
|
2014-05-16 18:51:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: Retrieve if possible the OS last error description.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: None.
|
|
|
|
// Return: CMIUtilString - Error description.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
CMIUtilString
|
|
|
|
CMIUtilSystemLinux::GetOSLastError(void) const
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
2014-11-18 02:06:21 +08:00
|
|
|
CMIUtilString errorMsg("Error fn not implemented ");
|
|
|
|
|
|
|
|
// ToDo: Implement LINUX version
|
|
|
|
|
|
|
|
return errorMsg;
|
2014-05-16 18:51:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: Retrieves the fully qualified path for the this application. If the function
|
|
|
|
// fails the string is filled with the error message.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: vrwFileNamePath - (W) The excutable's name and path or last error description.
|
|
|
|
// Return: MIstatus::success - Functional succeeded.
|
|
|
|
// MIstatus::failure - Functional failed.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
bool
|
|
|
|
CMIUtilSystemLinux::GetExecutablesPath(CMIUtilString &vrwFileNamePath) const
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
2014-11-18 02:06:21 +08:00
|
|
|
vrwFileNamePath = CMIUtilString(".");
|
|
|
|
return MIstatus::success;
|
2014-05-16 18:51:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: Retrieves the fully qualified path for the Log file for this application.
|
|
|
|
// If the function fails the string is filled with the error message.
|
|
|
|
// Append a dummy file name on the end of the path. This will be stripped off
|
|
|
|
// later and the real log file name replaces it.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: vrwFileNamePath - (W) The Log file's name and path or last error description.
|
|
|
|
// Return: MIstatus::success - Functional succeeded.
|
|
|
|
// MIstatus::failure - Functional failed.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
bool
|
|
|
|
CMIUtilSystemLinux::GetLogFilesPath(CMIUtilString &vrwFileNamePath) const
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
2014-11-18 02:06:21 +08:00
|
|
|
vrwFileNamePath = CMIUtilString(".");
|
|
|
|
return MIstatus::success;
|
2014-05-16 18:51:01 +08:00
|
|
|
}
|
|
|
|
|
2014-08-09 01:39:47 +08:00
|
|
|
#endif // #if defined( __linux__ )
|