sigar/src/os/darwin/sigar_os.h

67 lines
1.5 KiB
C
Raw Normal View History

2006-07-16 01:46:36 +08:00
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. This program is distributed
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
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,
2008-02-18 07:10:56 +08:00
#if defined(__OpenBSD__)
KOFFSET_TCPSTAT,
2008-02-19 10:13:44 +08:00
KOFFSET_TCBTABLE,
2008-02-18 07:10:56 +08:00
#endif
2005-02-09 11:54:57 +08:00
KOFFSET_MAX
};
#ifdef __OpenBSD__
typedef struct kinfo_proc2 bsd_pinfo_t;
#else
typedef struct kinfo_proc bsd_pinfo_t;
#endif
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;
bsd_pinfo_t *pinfo;
2004-06-22 06:37:04 +08:00
#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
};
#define SIGAR_EPERM_KMEM (SIGAR_OS_START_ERROR+EACCES)
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 */