template <typename T, InOutPolicy Policy>
class user_ptr
Defined at line 57 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
Public Methods
void user_ptr<T, Policy> (T * p)
Defined at line 67 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
void user_ptr<T, Policy> (const user_ptr<T, Policy> & other)
Allow copy.
Defined at line 70 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
user_ptr<T, Policy> & operator= (const user_ptr<T, Policy> & other)
Defined at line 71 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
T * get ()
Defined at line 75 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
template <typename C>
user_ptr<C, Policy> reinterpret ()
Only a user_in_ptr
<const
void> or user_out_ptr
<void
> can be reinterpreted
as a different type. Use sparingly and with great care.
Defined at line 81 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
template <auto Member, typename U = T>
zx::result<user_ptr<typename MemberAccess<U>::template ElementAccessType<Member>, Policy>> flex_array (size_t count, size_t size_bytes)
This requires an explicit template parameter that's a pointer-to-member
for a flexible array member of ValueType and yields a user_ptr to the
first element. This checks that the element count (first argument)
matches the total size in bytes of the user buffer. When this succeeds,
it should be safe to use copy_array_* on the returned user_ptr with the
same count.
Defined at line 94 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
bool operator bool ()
special operator to return the nullness of the pointer
Defined at line 118 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
user_ptr<T, Policy> element_offset (size_t index)
Returns a user_ptr pointing to the |index|-th element from this one, or a null user_ptr if
this pointer is null. Note: This does no other validation, and the behavior is undefined on
overflow. (Using this will fail to compile if T is |void|.)
Defined at line 123 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
user_ptr<T, Policy> byte_offset (size_t offset)
Returns a user_ptr offset by |offset| bytes from this one.
Defined at line 128 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
template <typename S>
zx_status_t copy_to_user (const S & src)
Copies a single T to user memory. T must not be |void|.
Defined at line 135 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
template <typename S>
UserCopyCaptureFaultsResult copy_to_user_capture_faults (const S & src)
Copies a single T to user memory. T must not be |void|. Captures permission and translation
faults. Access faults (on architectures that have them) will be handled transparently.
On success ZX_OK is returned and the values in pf_va and pf_flags are undefined, otherwise they
are filled with fault information.
Defined at line 149 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
zx_status_t copy_array_to_user (const T * src, size_t count, size_t offset)
Copies a sub-array of T to user memory. Note: This takes a count not a size. T cannot be
|void|.
Defined at line 159 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
zx_status_t copy_array_to_user (const T * src, size_t count)
Copies an array of T to user memory. Note: This takes a count not a size. T cannot be |void|.
Defined at line 171 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
UserCopyCaptureFaultsResult copy_array_to_user_capture_faults (const T * src, size_t count, size_t offset)
Copies a sub-array array of T to user memory. Note: This takes a count not a size. T cannot be
|void|.
On success ZX_OK is returned and the values in pf_va and pf_flags are undefined, otherwise they
are filled with fault information.
Defined at line 180 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
UserCopyCaptureFaultsResult copy_array_to_user_capture_faults (const T * src, size_t count)
Copies an array of T to user memory. Note: This takes a count not a size. T cannot be |void|.
On success ZX_OK is returned and the values in pf_va and pf_flags are undefined, otherwise they
are filled with fault information.
Defined at line 197 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
zx_status_t copy_from_user (typename ktl::remove_const<T>::type * dst)
Copies a single T from user memory. T must not be |void|.
Defined at line 203 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
UserCopyCaptureFaultsResult copy_from_user_capture_faults (typename ktl::remove_const<T>::type * dst)
Copies a single T from user memory. T must not be |void|. Captures permission and translation
faults. Access faults (on architectures that have them) will be handled transparently.
On success ZX_OK is returned and the values in pf_va and pf_flags are undefined, otherwise they
are filled with fault information.
Defined at line 215 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
zx_status_t copy_array_from_user (typename ktl::remove_const<T>::type * dst, size_t count, size_t offset)
Copies a sub-array of T from user memory. Note: This takes a count not a size. T cannot be
|void|.
Defined at line 225 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
zx_status_t copy_array_from_user (typename ktl::remove_const<T>::type * dst, size_t count)
Copies an array of T from user memory. Note: This takes a count not a size. T cannot be
|void|.
Defined at line 239 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
UserCopyCaptureFaultsResult copy_array_from_user_capture_faults (typename ktl::remove_const<T>::type * dst, size_t count, size_t offset)
Copies an array of T from user memory. Note: This takes a count not a size. T cannot be
|void|.
On success ZX_OK is returned and the values in pf_va and pf_flags are undefined, otherwise they
are filled with fault information.
Defined at line 249 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
UserCopyCaptureFaultsResult copy_array_from_user_capture_faults (typename ktl::remove_const<T>::type * dst, size_t count)
Defined at line 261 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h
Enumerations
enum
| Name | Value |
|---|---|
| is_out | ((Policy & kOut) == kOut) |
Defined at line 73 of file ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h