linux - using C code to get same info as ifconfig -


is there way in linux, using c code, same information "ifconfig eth0" return? i'm interested in things ip address, link status, , mac address.

here's sample output ifconfig:

eth0      link encap:ethernet  hwaddr 00:0f:20:cf:8b:42           inet addr:217.149.127.10  bcast:217.149.127.63  mask:255.255.255.192           broadcast running multicast  mtu:1500  metric:1           rx packets:2472694671 errors:1 dropped:0 overruns:0 frame:0           tx packets:44641779 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000           rx bytes:1761467179 (1679.8 mb)  tx bytes:2870928587 (2737.9 mb)           interrupt:28  

yes, ifconfig written in c. :) see: http://cvsweb.netbsd.org/bsdweb.cgi/src/sbin/ifconfig/ifconfig.c?rev=1.169&content-type=text/x-cvsweb-markup

do man netdevice see details (on linux). use ioctl() system call.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -