[kernel][user_ptr] Allow user_ptrs to be copied and assigned
Change-Id: I6bcdebb0604e0b029dbc2a1ff6966644ed40f409
diff --git a/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h b/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
index aad53a7..99eee1d 100644
--- a/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
+++ b/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
@@ -17,6 +17,13 @@
public:
explicit user_ptr(T* p) : ptr_(p) {}
+ user_ptr(const user_ptr& other) : ptr_(other.ptr_) {}
+
+ user_ptr& operator=(const user_ptr& other) {
+ ptr_ = other.ptr_;
+ return *this;
+ }
+
T* get() const { return ptr_; }
template <typename C>
@@ -86,7 +93,7 @@
// It is very important that this class only wrap the pointer type itself
// and not include any other members so as not to break the ABI between
// the kernel and user space.
- T* const ptr_;
+ T* ptr_;
};
template <typename T>