haiku/headers/private/kernel/util/syscall_args.h
Ingo Weinhold e0e5d17627 Handy functions to copy from and to userland reference parameters.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4837 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-28 15:12:27 +00:00

31 lines
533 B
C++

// syscall_args.h
#ifndef _SYSCALL_ARGS_H
#define _SYSCALL_ARGS_H
#include <vm.h>
// copy_ref_var_from_user
template<typename T>
inline
status_t
copy_ref_var_from_user(T *user, T &kernel)
{
if (CHECK_USER_ADDRESS(user))
return B_BAD_ADDRESS;
return user_memcpy(&kernel, user, sizeof(T));
}
// copy_ref_var_to_user
template<typename T>
inline
status_t
copy_ref_var_to_user(T &kernel, T *user)
{
if (CHECK_USER_ADDRESS(user))
return B_BAD_ADDRESS;
return user_memcpy(user, &kernel, sizeof(T));
}
#endif // _SYSCALL_ARGS_H