📄 siocgifname.c
字号:
/* SIOCGIFNAME.c * linqianghe@163.com * 2006-10-25 */#include "log.h"#include "SIOCGIFNAME.h"#include <sys/ioctl.h>#include <sys/socket.h>#include <linux/if.h>#include <stdio.h>#include <stdlib.h>void test_gifname( int sock_fd ){ struct ifreq ifr; PR_NOTICE( "test SIOCGIFNAME...\n" ); ifr.ifr_ifindex = 1; fprintf( stdout, "interface index name\n" ); while( 1 ){ if( ioctl( sock_fd, SIOCGIFNAME, &ifr ) < 0 ) break; fprintf( stdout, " %d %s\n", ifr.ifr_ifindex, ifr.ifr_name ); ifr.ifr_ifindex++; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -