blob: ac23daf65f8b4e222dd8edf522c5b5bbe23e02a7 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/************************************************************************
2*¹¦ÄܽéÉÜ£ºlinuxÖÐ×ÔÑÐÌṩӦÓÃappsʹÓõÄioctl½Ó¿Ú
3*¸ºÔðÈË£º
4*±¸·ÝÈË£º
5*ÐÞ¸ÄÈÕ£º
6*ÐÞ¸ÄÄÚÈÝ£º
7*°æ±¾ºÅ£º
8************************************************************************/
9#include <stdio.h>
10#include <unistd.h>
11#include <getopt.h>
12#include <sys/types.h>
13#include <sys/stat.h>
14#include <fcntl.h>
15#include <sys/ioctl.h>
16#include <strings.h>
17#include <sys/types.h>
18#include <sys/socket.h>
19#include <netinet/in.h>
20#include <linux/if.h>
21#include <arpa/inet.h>
22#include <net/if_arp.h>
23#include <linux/sockios.h>
24#include <assert.h>
25#include "message.h"
26
27
28//ͨ¹ýÀ©Õ¹ioctl£¬ÊµÏÖÓ¦ÓÃÓëÄں˵ÄÍøÂçÏà¹Ø²Ù×÷½»»¥
29int netioctl_handle(int cmd, void *val)
30{
31 int fd = -1;
32 int ret = 0;
33 fd = open("/dev/myioctl", O_RDWR);
34 if (fd < 0)
35 return -1;
36 ret = ioctl(fd, cmd, val);
37 if (ret < 0)
38 printf("ioctl can not get info,%d\n", ret);
39 //assert(0);
40 close(fd);
41 return ret;
42}
43
44