如何从Solaris系统获得信息的过程中编程C / C ++? [英] How to get process info programmatically in C/C++ from a Solaris system?

查看:192
本文介绍了如何从Solaris系统获得信息的过程中编程C / C ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个C / C ++库和文档有关如何收集系统和处理信息在Solaris上?

Is there a C/C++ library, and documentation about how to collect system and process information on Solaris?

虽然我可以解析的命令行工具,我宁愿使用一个库,使任务更容易做。

Although I could parse command-line tools, I'd rather use a library that makes the task easier to do.

感谢

编辑:有人建议使用在/ proc虚拟目录收集信息,但其比分析命令行工具,在这个意义上也不遑多让,我需要实现一些排序自定义分析,为每一个数据我需要的。

It has been suggested to use the /proc virtual directory to collect information, however its not much better than parsing command-line tools, in the sense that I'll need to implement some sort of custom parsing for every piece of data I need.

我在寻找一起为Windows或通过提供一个C为基础的系统API这些信息的MacOS C库线的东西,但是我在与谷歌没有运气。

I'm looking for something along the lines of c libraries for Windows or MacOS that provides this information through a c-based systems API, however I'm having no luck with Google.

推荐答案

您可以得到这样的信息与的的kstat API

You can get this kind of information with kstat API.

man -s 3KSTAT  kstat

您可以看到它是如何在OpenSolaris中的的vmstat 和的 iostat的来源。

You can see how it is used in OpenSolaris vmstat and iostat source.

有关的信息突,我会看的 PS

For information about processus, I'd look at ps.

这篇关于如何从Solaris系统获得信息的过程中编程C / C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆