Solaris:ifconfig的编程接口? [英] Solaris: Programmatic interface to ifconfig?
问题描述
I'm looking for a programmatic interface to the Solaris ifconfig(1M) command.
显然,Linux具有 getifaddrs(3 )命令,但据我所知尚未移植到Solaris .
Apparently Linux has the getifaddrs(3) command, but as far as I can tell this has not been ported to Solaris.
尝试使用上面链接处的代码,有什么方法可以确定 ifconfig(1M)型数据(网络接口的状态,状态等),而不派生系统命令和解析输出?
Short of attempting to use the code at the link above, is there any way to determine ifconfig(1M)-type data (network interface presence, state, etc.) without forking the system command and parsing the output?
推荐答案
getifaddrs()最近已集成到源代码中,以用于将来的OpenSolaris& Solaris版本,但这不能帮助您的代码在当前版本上运行:
getifaddrs() was recently integrated into the source code for future OpenSolaris & Solaris releases, but that doesn't help your code run on current releases:
- 6731945 need BSD getifaddrs() API
- OpenSolaris source: usr/src/lib/libsocket/inet/getifaddrs.c
在此之前,您需要使用SIOCGLIFCONF
ioctls,您应该在开放源代码中找到很多示例,包括发布的链接.
Until then you'll need to use the SIOCGLIFCONF
ioctls, which you should find lots of examples of in open source code, including the link you posted.
这篇关于Solaris:ifconfig的编程接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!