Solaris:ifconfig 的编程接口? [英] Solaris: Programmatic interface to ifconfig?
问题描述
我正在寻找 Solaris 的编程接口 ifconfig(1M) 命令.
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:
在此之前,您需要使用 SIOCGLIFCONF
ioctl,您应该可以在开源代码中找到很多示例,包括您发布的链接.
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屋!