syscall_args.h revision 6b0251e1
1// syscall_args.h
2
3#ifndef _SYSCALL_ARGS_H
4#define _SYSCALL_ARGS_H
5
6#include <kernel.h>
7
8
9// copy_ref_var_from_user
10template<typename T>
11inline
12status_t
13copy_ref_var_from_user(T *user, T &kernel)
14{
15	if (!IS_USER_ADDRESS(user))
16		return B_BAD_ADDRESS;
17	return user_memcpy(&kernel, user, sizeof(T));
18}
19
20// copy_ref_var_to_user
21template<typename T>
22inline
23status_t
24copy_ref_var_to_user(T &kernel, T *user)
25{
26	if (!IS_USER_ADDRESS(user))
27		return B_BAD_ADDRESS;
28	return user_memcpy(user, &kernel, sizeof(T));
29}
30
31
32#endif	// _SYSCALL_ARGS_H
33