我试图在openBSD5.1上编译net-snmp 5.7.1。 编译中的错误是
结构没有名为kp_proc'
structure has no member named
kp_eproc'
任何人都可以帮我解决这个问题吗?
如何在openBSD上进行python绑定?
答案 0 :(得分:1)
好吧这可能是一个很长的帖子,因为我们会尝试在OpenBSD上移植你的软件 你看,OpenBSD的k_proc结构上没有这个eproc字段。检查声明: proc@OpenBSD
在最新来源中解决问题:
./agent/mibgroup/host/data_access/swrun_kinfo.c: entry->hrSWRunPerfCPU = proc_table[i].kp_eproc.e_uticks;
./agent/mibgroup/host/data_access/swrun_kinfo.c: entry->hrSWRunPerfCPU += proc_table[i].kp_eproc.e_sticks;
./agent/mibgroup/host/data_access/swrun_kinfo.c: entry->hrSWRunPerfCPU += proc_table[i].kp_eproc.e_iticks;
./agent/mibgroup/host/data_access/swrun_kinfo.c: entry->hrSWRunPerfMem = proc_table[i].kp_eproc.e_vm.vm_tsize;
./agent/mibgroup/host/data_access/swrun_kinfo.c: entry->hrSWRunPerfMem += proc_table[i].kp_eproc.e_vm.vm_ssize;
./agent/mibgroup/host/data_access/swrun_kinfo.c: entry->hrSWRunPerfMem += proc_table[i].kp_eproc.e_vm.vm_dsize;
./agent/mibgroup/host/hr_swrun.c: long_return = proc_table[LowProcIndex].kp_eproc.e_uticks +
./agent/mibgroup/host/hr_swrun.c: proc_table[LowProcIndex].kp_eproc.e_sticks +
./agent/mibgroup/host/hr_swrun.c: proc_table[LowProcIndex].kp_eproc.e_iticks;
./agent/mibgroup/host/hr_swrun.c: proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024;
./agent/mibgroup/host/hr_swrun.c: long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
./agent/mibgroup/host/hr_swrun.c: proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
./agent/mibgroup/host/hr_swrun.c: proc_table[LowProcIndex].kp_eproc.e_vm.vm_dsize;
./agent/mibgroup/ucd-snmp/proc.c:#define EP(pp, field) ((pp)->kp_eproc . field)
./agent/mibgroup/ucd-snmp/proc.c:#define VP(pp, field) ((pp)->kp_eproc.e_vm . field)
AHA!所以我们也需要注意这些vm结构...我们相应的相关变化是:p_vmspace@OpenBSD
好的,所以通常将这些.kp_eproc.e_thing更改为.p_thing
和.kp_eproc.e_vm.thing到.p_vmspace->事物(它是一个指针)
应该工作。
宏需要一些关心,我认为我把它们弄好了,但是因为我还在编译它们 对非常慢 sparc64的更改,需要一些时间才能获得测试的差异。
但这应该是一般的想法。
如果您的整个过程正常,您可以将此补丁添加到您的ports / tree中 使用易于制作的Makefile,并使用pkg_ *工具管理您的OpenBSD包,但在将来的编辑中会有更多。
喝彩!
DSP
编辑:这是第一个将编译的差异,但第二个宏是错误的。 请测试。
diff -ur net-snmp-5.7.1/agent/mibgroup/host/data_access/swrun_kinfo.c mynet- snmp-5.7.1/agent/mibgroup/host/data_access/swrun_kinfo.c
--- net-snmp-5.7.1/agent/mibgroup/host/data_access/swrun_kinfo.c Wed Sep 28 07:53:47 2011
+++ mynet-snmp-5.7.1/agent/mibgroup/host/data_access/swrun_kinfo.c Wed Sep 5 04:26:54 2012
@@ -85,10 +85,10 @@
* early FreeBSD, NetBSD, OpenBSD kinfo_proc field names
*/
#define SWRUN_TABLE kinfo_proc
-#define SWRUN_K_STAT kp_proc.p_stat
-#define SWRUN_K_PID kp_proc.p_pid
-#define SWRUN_K_COMM kp_proc.p_comm
-#define SWRUN_K_FLAG kp_proc.p_flag
+#define SWRUN_K_STAT p_stat
+#define SWRUN_K_PID p_pid
+#define SWRUN_K_COMM p_comm
+#define SWRUN_K_FLAG p_flag
/* SWRUN_K_CLASS not defined */
#endif
@@ -159,7 +159,8 @@
#if HAVE_KVM_GETPROC2
proc_table = kvm_getproc2(kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), &nprocs );
#else
- proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nprocs );
+ proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &nprocs );
+ //proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nprocs );
#endif
for ( i=0 ; i<nprocs; i++ ) {
if ( 0 == proc_table[i].SWRUN_K_STAT )
@@ -304,21 +305,22 @@
entry->hrSWRunPerfCPU += proc_table[i].kp_lwp.kl_iticks;
entry->hrSWRunPerfMem = proc_table[i].kp_vm_map_size / 1024;
#elif defined(dragonfly)
- entry->hrSWRunPerfCPU = proc_table[i].kp_eproc.e_uticks;
- entry->hrSWRunPerfCPU += proc_table[i].kp_eproc.e_sticks;
- entry->hrSWRunPerfCPU += proc_table[i].kp_eproc.e_iticks;
+ entry->hrSWRunPerfCPU = proc_table[i].p_uticks;
+ entry->hrSWRunPerfCPU += proc_table[i].p_sticks;
+ entry->hrSWRunPerfCPU += proc_table[i].p_iticks;
entry->hrSWRunPerfMem = proc_table[i].kp_vm_map_size / 1024;
#else
/*
* early FreeBSD, NetBSD, OpenBSD
*/
- entry->hrSWRunPerfCPU = proc_table[i].kp_proc.p_uticks;
- entry->hrSWRunPerfCPU += proc_table[i].kp_proc.p_sticks;
- entry->hrSWRunPerfCPU += proc_table[i].kp_proc.p_iticks;
- entry->hrSWRunPerfMem = proc_table[i].kp_eproc.e_vm.vm_tsize;
- entry->hrSWRunPerfMem += proc_table[i].kp_eproc.e_vm.vm_ssize;
- entry->hrSWRunPerfMem += proc_table[i].kp_eproc.e_vm.vm_dsize;
+ entry->hrSWRunPerfCPU = proc_table[i].p_uticks;
+ entry->hrSWRunPerfCPU += proc_table[i].p_sticks;
+ entry->hrSWRunPerfCPU += proc_table[i].p_iticks;
+ struct vmspace *l = proc_table[i].p_vmspace;
+ entry->hrSWRunPerfMem = l->vm_tsize;
+ entry->hrSWRunPerfMem += l->vm_ssize;
+ entry->hrSWRunPerfMem += l->vm_dsize;
entry->hrSWRunPerfMem *= (getpagesize() / 1024);
#endif
}
当然这个差异就像真空一样糟透了,我会改进它tommorow;)