port proc_port to freebsd4

This commit is contained in:
Doug MacEachern 2006-01-02 22:15:24 +00:00
parent 6dbaff7b07
commit e56e760d58
1 changed files with 8 additions and 4 deletions

View File

@ -48,6 +48,7 @@
#ifdef SIGAR_FREEBSD5 #ifdef SIGAR_FREEBSD5
#define KI_FD ki_fd
#define KI_PID ki_pid #define KI_PID ki_pid
#define KI_PPID ki_ppid #define KI_PPID ki_ppid
#define KI_PRI ki_pri.pri_user #define KI_PRI ki_pri.pri_user
@ -65,8 +66,10 @@
#define KI_SSZ ki_ssize #define KI_SSZ ki_ssize
#define KI_FLAG ki_flag #define KI_FLAG ki_flag
#define KI_START ki_start #define KI_START ki_start
#else #else
#define KI_FD kp_proc.p_fd
#define KI_PID kp_proc.p_pid #define KI_PID kp_proc.p_pid
#define KI_PPID kp_eproc.e_ppid #define KI_PPID kp_eproc.e_ppid
#define KI_PRI kp_proc.p_priority #define KI_PRI kp_proc.p_priority
@ -84,6 +87,7 @@
#define KI_SSZ kp_eproc.e_vm.vm_ssize #define KI_SSZ kp_eproc.e_vm.vm_ssize
#define KI_FLAG kp_eproc.e_flag #define KI_FLAG kp_eproc.e_flag
#define KI_START kp_proc.p_starttime #define KI_START kp_proc.p_starttime
#endif #endif
#ifndef DARWIN #ifndef DARWIN
@ -1984,7 +1988,7 @@ int sigar_net_connection_list_get(sigar_t *sigar,
return SIGAR_OK; return SIGAR_OK;
} }
#if defined(SIGAR_FREEBSD5) #ifndef DARWIN
#define _KERNEL #define _KERNEL
#include <sys/file.h> #include <sys/file.h>
@ -2054,12 +2058,12 @@ int sigar_proc_port_get(sigar_t *sigar, int protocol,
if (pinfo[i].KI_FLAG & P_SYSTEM) { if (pinfo[i].KI_FLAG & P_SYSTEM) {
continue; continue;
} }
if (pinfo[i].ki_fd) { if (pinfo[i].KI_FD) {
struct filedesc pfd; struct filedesc pfd;
struct file **ofiles, ofile; struct file **ofiles, ofile;
int j, osize; int j, osize;
status = kread(sigar, &pfd, sizeof(pfd), (long)pinfo[i].ki_fd); status = kread(sigar, &pfd, sizeof(pfd), (long)pinfo[i].KI_FD);
if (status != SIGAR_OK) { if (status != SIGAR_OK) {
return status; return status;
} }
@ -2094,7 +2098,7 @@ int sigar_proc_port_get(sigar_t *sigar, int protocol,
if (ofile.f_type == DTYPE_SOCKET && if (ofile.f_type == DTYPE_SOCKET &&
(struct socket *)ofile.f_data == sockp) (struct socket *)ofile.f_data == sockp)
{ {
*pid = pinfo[i].ki_pid; *pid = pinfo[i].KI_PID;
free(ofiles); free(ofiles);
return SIGAR_OK; return SIGAR_OK;
} }