aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda_dump/src/os_unix.rs
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2021-04-10 23:01:01 +0200
committerAndrzej Janik <[email protected]>2021-04-10 23:01:01 +0200
commita39dda67d1fb3897c5ea778ae00c4079e8e2939a (patch)
treed04bf8554b27be20673877ad0c35caee498baeba /zluda_dump/src/os_unix.rs
parent8393dbd6e963ee59161dbbe3447a876156bea1c3 (diff)
downloadZLUDA-a39dda67d1fb3897c5ea778ae00c4079e8e2939a.tar.gz
ZLUDA-a39dda67d1fb3897c5ea778ae00c4079e8e2939a.zip
Make dumper compatible with older versions of CUDA
Diffstat (limited to 'zluda_dump/src/os_unix.rs')
-rw-r--r--zluda_dump/src/os_unix.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/zluda_dump/src/os_unix.rs b/zluda_dump/src/os_unix.rs
index b3d9343..91a004a 100644
--- a/zluda_dump/src/os_unix.rs
+++ b/zluda_dump/src/os_unix.rs
@@ -2,6 +2,8 @@ use std::ffi::{c_void, CStr};
const NVCUDA_DEFAULT_PATH: &'static [u8] = b"/usr/lib/x86_64-linux-gnu/libcuda.so.1\0";
+pub fn init() {}
+
pub unsafe fn load_cuda_library() -> *mut c_void {
libc::dlopen(
NVCUDA_DEFAULT_PATH.as_ptr() as *const _,
@@ -12,3 +14,17 @@ pub unsafe fn load_cuda_library() -> *mut c_void {
pub unsafe fn get_proc_address(handle: *mut c_void, func: &CStr) -> *mut c_void {
libc::dlsym(handle, func.as_ptr() as *const _)
}
+
+#[macro_export]
+macro_rules! os_log {
+ ($format:tt) => {
+ {
+ eprintln!($format);
+ }
+ };
+ ($format:tt, $($obj: expr),+) => {
+ {
+ eprintln!($format, $($obj,)+);
+ }
+ };
+}