What is the data type of cmd in ioctl? -- Linux general technology-Linux programming and kernel information. The following is a detailed description. The procedure is as follows:
----------------------------------------------------------------------------
# Define MOTOR_MAGIC 'K'
# Define SET_PULSE _ IOW (MOTOR_MAGIC, 1, int)
.
.
Static int motor_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, unsigned long arg)
{Int data = 0;
Int retval;
Switch (cmd ){
Case SET_PULSE:
If (copy_from_user (& data, (int *) arg, sizeof (int )))
Return-EFAULT;
.
.
.
}
---------------------------------------------------------------------------
"Cmd" must be an unsigned integer, But what data type is "SET_PULSE?
According to the macro definition:
# Define SET_PULSE _ IOW ('k', 1, int)
K is a character. How is it equal to an integer? What type of data is obtained?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service