sigar/src/os/darwin/sigar_os.h

39 lines
666 B
C
Raw Normal View History

2004-06-22 06:37:04 +08:00
#ifndef SIGAR_OS_H
#define SIGAR_OS_H
#ifdef DARWIN
#include <mach/port.h>
#include <mach/host_info.h>
2005-02-09 11:36:54 +08:00
#else
#include <kvm.h>
2004-06-22 06:37:04 +08:00
#endif
#include <sys/sysctl.h>
2005-02-09 11:54:57 +08:00
enum {
KOFFSET_CPUINFO,
2005-02-09 12:19:55 +08:00
KOFFSET_VMMETER,
2005-02-09 11:54:57 +08:00
KOFFSET_MAX
};
2004-06-22 06:37:04 +08:00
struct sigar_t {
SIGAR_T_BASE;
int pagesize;
time_t last_getprocs;
sigar_pid_t last_pid;
struct kinfo_proc *pinfo;
#ifdef DARWIN
mach_port_t mach_port;
2005-02-09 11:36:54 +08:00
#else
2005-02-09 11:56:27 +08:00
kvm_t *kmem;
2005-02-09 11:54:57 +08:00
/* offsets for seeking on kmem */
unsigned long koffsets[KOFFSET_MAX];
2005-02-13 13:46:10 +08:00
int proc_mounted;
2004-06-22 06:37:04 +08:00
#endif
};
2005-02-12 09:50:56 +08:00
#define SIGAR_EPERM_KMEM (SIGAR_OS_START_ERROR+1)
2005-02-13 13:46:10 +08:00
#define SIGAR_EPROC_NOENT (SIGAR_OS_START_ERROR+2)
2005-02-12 09:50:56 +08:00
2004-06-22 06:37:04 +08:00
#endif /* SIGAR_OS_H */