put_user

1. put_user

Name

put_user --    Write a simple value into user space.

Synopsis

put_user ( x, ptr);

Arguments

x

Value to copy to user space.

ptr

Destination address, in user space.

Context

User context only. This function may sleep.

Description

This macro copies a single simple value from kernel space to user space. It supports simple types like char and int, but not larger data types like structures or arrays.

ptr must have pointer-to-simple-variable type, and x must be assignable to the result of dereferencing ptr .

Returns zero on success, or -EFAULT on error.

原文地址:https://www.cnblogs.com/seasonsstory/p/3319229.html