Check for root access early for functions that require it

이 커밋은 다음에 포함됨:
Chris Freehill
2019-05-15 16:46:23 -05:00
부모 8dc774a31d
커밋 7b9ff01a37
4개의 변경된 파일과 24개의 추가작업 그리고 6개의 파일을 삭제
+2 -1
파일 보기
@@ -91,7 +91,8 @@ typedef enum {
//!< version running on the executing
//!< machine
RSMI_STATUS_PERMISSION, //!< Permission denied/EACCESS file
//!< error
//!< error. Many functions require
//!< root access to run.
RSMI_STATUS_OUT_OF_RESOURCES, //!< Unable to acquire memory or other
//!< resource
RSMI_STATUS_INTERNAL_EXCEPTION, //!< An internal exception was caught
+4 -1
파일 보기
@@ -62,7 +62,7 @@ namespace smi {
class RocmSMI {
public:
RocmSMI(uint64_t flags);
explicit RocmSMI(uint64_t flags);
~RocmSMI(void);
static RocmSMI& getInstance(uint64_t flags = 0);
@@ -82,6 +82,8 @@ class RocmSMI {
void set_init_options(uint64_t options) {init_options_ = options;}
uint64_t init_options() const {return init_options_;}
uint32_t euid() const {return euid_;}
private:
std::vector<std::shared_ptr<Device>> devices_;
std::vector<std::shared_ptr<Monitor>> monitors_;
@@ -95,6 +97,7 @@ class RocmSMI {
static std::vector<std::shared_ptr<amd::smi::Device>> s_monitor_devices;
RocmSMI_env_vars env_vars_;
uint64_t init_options_;
uint32_t euid_;
};
} // namespace smi