/* sys_sched_getaffinity - get the cpu affinity of a process @pid: pid of the process @len: length in bytes of the bitmask pointed to by user_mask_ptr @user_mask_ptr: user-space pointer to hold the current cpu mask  */
SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len, unsigned long __user *, user_mask_ptr)
/* sys_sched_getaffinity - get the cpu affinity of a process @pid: pid of the process @len: length in bytes of the bitmask pointed to by user_mask_ptr @user_mask_ptr: user-space pointer to hold the current cpu mask  */
SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len, unsigned long __user *, user_mask_ptr)
{
	int ret;
	cpumask_var_t mask;
	if (len < cpumask_size())
		return -EINVAL;
	if (!alloc_cpumask_var(&mask, GFP_KERNEL))
		return -ENOMEM;
	ret = sched_getaffinity(pid, mask);
	if (ret == 0) {
		if (copy_to_user(user_mask_ptr, mask, cpumask_size()))
			ret = -EFAULT;
		else
			ret = cpumask_size();
	}
	free_cpumask_var(mask);
	return ret;
}