下面的代码可以正常显示吗
c语言驱动程序试一试:
obj-m = ioctl.o
KDIR = /lib/modules/$(shell uname -r)/build
PWD = $(shell pwd)
default:
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
$(RM) *.o *.mod.c *.ko *.order *.symvers -r
C语言的呢
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(void)
{
int fd;
int a = 8;
fd = open("/dev/ioctl_misc",O_WRONLY);
if(fd == -1)
printf("open /dev/ioctl_misc failed\n");
fd = ioctl(fd,0,&a);
//fd = ioctl(fd,0,NULL);
if(fd == -1)
printf("ioctl faile\n");
return 0;
}
c语言驱动程序试一试:
#include <linux/time.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/miscdevice.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
static int ioctl_open(struct inode