Solaris struct psinfo结构体包含在哪个头文件中?

Joy_Ming 2014-08-04 10:11:32
Solaris struct psinfo结构体包含在哪个头文件中?
我想编程获取单个进程占用的信息,通过psinfo文件,可是在程序中定义psinfo_t 变量名 编译老是报错,说psinfo_t没有定义。
还是Solaris中psinfo_t和prpsinfo_t有什么区别吗?
...全文
837 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
laoeyu 2014-09-01
  • 打赏
  • 举报
回复
在这里定义好了/usr/include/sys/procfs.h 可以看见psinfo和psinfo_t同一个struct类型,为了编译,需要包含该文件,包含procfs.h也可以。

typedef struct psinfo {
        int     pr_flag;        /* process flags (DEPRECATED; do not use) */
        int     pr_nlwp;        /* number of active lwps in the process */
        pid_t   pr_pid;         /* unique process id */
        pid_t   pr_ppid;        /* process id of parent */
        pid_t   pr_pgid;        /* pid of process group leader */
        pid_t   pr_sid;         /* session id */
        uid_t   pr_uid;         /* real user id */
        uid_t   pr_euid;        /* effective user id */
        gid_t   pr_gid;         /* real group id */
        ... ... 
        lwpsinfo_t pr_lwp;      /* information for representative lwp */
} psinfo_t;
prpsinfo_t是以前使用的struct,在 "/usr/include/sys/old_procfs.h"。

1,543

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 Solaris
社区管理员
  • Solaris
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧