diff options
author | Benoît Dejean <benoit@placenet.org> | 2006-11-27 19:22:45 +0000 |
---|---|---|
committer | Benoît Dejean <bdejean@src.gnome.org> | 2006-11-27 19:22:45 +0000 |
commit | 0b438b525064cf880d3b1d44a88bf9a930957026 (patch) | |
tree | 0f2da776d122ba8e84e02bf8d21ae0ff205209f4 | |
parent | 0d2382e666fb380663f4b81bff30b34abda4dff1 (diff) | |
download | libgtop-0b438b525064cf880d3b1d44a88bf9a930957026.tar.gz |
Added kfreebsd support. Patch by Petr Salinger <Petr.Salinger@seznam.cz>.
2006-11-27 Benoît Dejean <benoit@placenet.org>
* fsusage.c: (_glibtop_freebsd_get_fsusage_read_write):
* mem.c: (glibtop_get_mem_p):
* prockernel.c: (glibtop_get_proc_kernel_p):
* proclist.c: (glibtop_get_proclist_p):
* procmap.c: (glibtop_get_proc_map_p):
* procmem.c: (glibtop_get_proc_mem_p):
* procsignal.c: (glibtop_get_proc_signal_p):
* procstate.c: (glibtop_get_proc_state_p):
* proctime.c:
* procuid.c: (glibtop_get_proc_uid_p):
* swap.c: (glibtop_init_swap_p), (glibtop_get_swap_p):
Added kfreebsd support.
Patch by Petr Salinger <Petr.Salinger@seznam.cz>.
-rw-r--r-- | sysdeps/freebsd/ChangeLog | 17 | ||||
-rw-r--r-- | sysdeps/freebsd/fsusage.c | 4 | ||||
-rw-r--r-- | sysdeps/freebsd/mem.c | 10 | ||||
-rw-r--r-- | sysdeps/freebsd/prockernel.c | 12 | ||||
-rw-r--r-- | sysdeps/freebsd/proclist.c | 2 | ||||
-rw-r--r-- | sysdeps/freebsd/procmap.c | 22 | ||||
-rw-r--r-- | sysdeps/freebsd/procmem.c | 12 | ||||
-rw-r--r-- | sysdeps/freebsd/procsignal.c | 10 | ||||
-rw-r--r-- | sysdeps/freebsd/procstate.c | 2 | ||||
-rw-r--r-- | sysdeps/freebsd/proctime.c | 11 | ||||
-rw-r--r-- | sysdeps/freebsd/procuid.c | 6 | ||||
-rw-r--r-- | sysdeps/freebsd/swap.c | 18 |
12 files changed, 68 insertions, 58 deletions
diff --git a/sysdeps/freebsd/ChangeLog b/sysdeps/freebsd/ChangeLog index 7911879a..313b32dc 100644 --- a/sysdeps/freebsd/ChangeLog +++ b/sysdeps/freebsd/ChangeLog @@ -1,3 +1,20 @@ +2006-11-27 Benoît Dejean <benoit@placenet.org> + + * fsusage.c: (_glibtop_freebsd_get_fsusage_read_write): + * mem.c: (glibtop_get_mem_p): + * prockernel.c: (glibtop_get_proc_kernel_p): + * proclist.c: (glibtop_get_proclist_p): + * procmap.c: (glibtop_get_proc_map_p): + * procmem.c: (glibtop_get_proc_mem_p): + * procsignal.c: (glibtop_get_proc_signal_p): + * procstate.c: (glibtop_get_proc_state_p): + * proctime.c: + * procuid.c: (glibtop_get_proc_uid_p): + * swap.c: (glibtop_init_swap_p), (glibtop_get_swap_p): + + Added kfreebsd support. + Patch by Petr Salinger <Petr.Salinger@seznam.cz>. + 2006-04-09 Benoît Dejean <benoit@placenet.org> * fsusage.c: (_glibtop_freebsd_get_fsusage_read_write): diff --git a/sysdeps/freebsd/fsusage.c b/sysdeps/freebsd/fsusage.c index 58be5797..0fdac96c 100644 --- a/sysdeps/freebsd/fsusage.c +++ b/sysdeps/freebsd/fsusage.c @@ -46,9 +46,9 @@ _glibtop_freebsd_get_fsusage_read_write(glibtop *server, if (result == -1) { return; } - +#if !defined(__FreeBSD_kernel__) buf->read = sfs.f_syncreads + sfs.f_asyncreads; buf->write = sfs.f_syncwrites + sfs.f_asyncwrites; - +#endif buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE); } diff --git a/sysdeps/freebsd/mem.c b/sysdeps/freebsd/mem.c index 84e1d861..95266163 100644 --- a/sysdeps/freebsd/mem.c +++ b/sysdeps/freebsd/mem.c @@ -43,7 +43,7 @@ static const unsigned long _glibtop_sysdeps_mem = (1L << GLIBTOP_MEM_FREE) + (1L << GLIBTOP_MEM_SHARED) + (1L << GLIBTOP_MEM_BUFFER) + -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) (1L << GLIBTOP_MEM_CACHED) + #endif (1L << GLIBTOP_MEM_USER) + (1L << GLIBTOP_MEM_LOCKED); @@ -66,7 +66,7 @@ static struct nlist nlst [] = { #else #if defined(__bsdi__) { "_bufcachemem" }, -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) { "_bufspace" }, #else { "_bufpages" }, @@ -171,7 +171,7 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf) /* convert memory stats to Kbytes */ -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) v_total_count = vmm.v_page_count; #else #if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__) @@ -198,7 +198,7 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf) buf->used = (guint64) pagetok (v_used_count) << LOG1024; buf->free = (guint64) pagetok (v_free_count) << LOG1024; -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) buf->cached = (guint64) pagetok (vmm.v_cache_count) << LOG1024; #endif @@ -210,7 +210,7 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf) buf->shared = (guint64) pagetok (vmt.t_rmshr) << LOG1024; -#if __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) buf->buffer = (guint64) bufspace; #else buf->buffer = (guint64) pagetok (bufspace) << LOG1024; diff --git a/sysdeps/freebsd/prockernel.c b/sysdeps/freebsd/prockernel.c index a760228e..8fd29f97 100644 --- a/sysdeps/freebsd/prockernel.c +++ b/sysdeps/freebsd/prockernel.c @@ -36,7 +36,7 @@ #include <sys/user.h> #endif #if !defined(__bsdi__) && !(defined(__FreeBSD__) && defined(__alpha__)) && \ - !defined(__NetBSD__) + !defined(__NetBSD__) #include <machine/pcb.h> #endif @@ -94,7 +94,7 @@ glibtop_get_proc_kernel_p (glibtop *server, pid_t pid) { struct kinfo_proc *pinfo; -#ifndef __FreeBSD__ +#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) struct user *u_addr = (struct user *)USRSTACK; struct pstats pstats; struct pcb pcb; @@ -119,7 +119,7 @@ glibtop_get_proc_kernel_p (glibtop *server, if ((pinfo == NULL) || (count != 1)) glibtop_error_io_r (server, "kvm_getprocs (%d)", pid); -#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013) +#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__) #define PROC_WCHAN ki_wchan #define PROC_WMESG ki_wmesg @@ -147,7 +147,7 @@ glibtop_get_proc_kernel_p (glibtop *server, } #endif -#ifndef __FreeBSD__ +#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) /* Taken from `saveuser ()' in `/usr/src/bin/ps/ps.c'. */ @@ -203,9 +203,9 @@ glibtop_get_proc_kernel_p (glibtop *server, (unsigned long) &u_addr->u_pcb, (char *) &pcb, sizeof (pcb)) == sizeof (pcb)) { -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #ifndef __alpha__ -#if (__FreeBSD_version >= 300003) +#if (__FreeBSD_version >= 300003) || defined(__FreeBSD_kernel__) buf->kstk_esp = (guint64) pcb.pcb_esp; buf->kstk_eip = (guint64) pcb.pcb_eip; #else diff --git a/sysdeps/freebsd/proclist.c b/sysdeps/freebsd/proclist.c index bbb92386..9a866550 100644 --- a/sysdeps/freebsd/proclist.c +++ b/sysdeps/freebsd/proclist.c @@ -86,7 +86,7 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf, pids = g_realloc (pids, count * sizeof (unsigned)); /* Copy the pids over to this chain */ for (i=j=0; i < count; i++) { -#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013) +#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__) #define PROC_STAT ki_stat #define PROC_RUID ki_ruid #define PROC_PID ki_pid diff --git a/sysdeps/freebsd/procmap.c b/sysdeps/freebsd/procmap.c index 28ce1292..45fe59de 100644 --- a/sysdeps/freebsd/procmap.c +++ b/sysdeps/freebsd/procmap.c @@ -41,18 +41,18 @@ #else #include <vm/vm_object.h> #include <vm/vm_map.h> -#if (__FreeBSD_version >= 400011) +#if (__FreeBSD_version >= 400011) || defined(__FreeBSD_kernel__) #include <vm/vm.h> #else #include <vm/vm_prot.h> #endif #endif -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #define _KVM_VNODE #endif #include <sys/vnode.h> -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #undef _KVM_VNODE #endif #include <sys/mount.h> @@ -109,9 +109,9 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf, struct vm_object object; #endif glibtop_map_entry *maps; -#if defined __FreeBSD__ +#if (defined __FreeBSD__) || defined(__FreeBSD_kernel__) struct vnode vnode; -#if __FreeBSD_version < 500039 +#if (__FreeBSD_version < 500039) && !defined(__FreeBSD_kernel__) struct inode inode; #endif #endif @@ -137,7 +137,7 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf, /* Now we get the memory maps. */ if (kvm_read (server->machine.kd, -#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013) +#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__) (unsigned long) pinfo [0].ki_vmspace, #else (unsigned long) pinfo [0].kp_proc.p_vmspace, @@ -179,8 +179,8 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf, update = 1; } -#ifdef __FreeBSD__ -#if __FreeBSD__ >= 4 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#if (__FreeBSD__ >= 4) || defined(__FreeBSD_kernel__) if (entry.eflags & (MAP_ENTRY_IS_SUB_MAP)) continue; #else @@ -256,7 +256,7 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf, #endif -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) /* If the object is of type vnode, add its size */ if (object.type != OBJT_VNODE) @@ -270,10 +270,10 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf, &vnode, sizeof (vnode)) != sizeof (vnode)) glibtop_error_io_r (server, "kvm_read (vnode)"); -#if defined(__FreeBSD__) && (__FreeBSD_version >= 500039) +#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500039)) || defined(__FreeBSD_kernel__) switch (vnode.v_type) { case VREG: -#if __FreeBSD_version < 600006 +#if (__FreeBSD_version < 600006) && !defined(__FreeBSD_kernel__) maps [i-1].inode = vnode.v_cachedid; maps [i-1].device = vnode.v_cachedfs; #endif diff --git a/sysdeps/freebsd/procmem.c b/sysdeps/freebsd/procmem.c index a835f4e6..864ff344 100644 --- a/sysdeps/freebsd/procmem.c +++ b/sysdeps/freebsd/procmem.c @@ -73,7 +73,7 @@ static const unsigned long _glibtop_sysdeps_proc_mem = static const unsigned long _glibtop_sysdeps_proc_mem_share = #if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) (1L << GLIBTOP_PROC_MEM_SHARE); -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) (1L << GLIBTOP_PROC_MEM_SHARE); #else 0; @@ -126,7 +126,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, #else struct vm_object object; #endif -#if !defined(__FreeBSD__) || (__FreeBSD_version < 500013) +#if (!defined(__FreeBSD__) || (__FreeBSD_version < 500013)) && !defined(__FreeBSD_kernel__) struct plimit plimit; #endif int count; @@ -147,7 +147,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid); return; } -#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013) +#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__) #define PROC_VMSPACE ki_vmspace @@ -214,8 +214,8 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, return; } -#ifdef __FreeBSD__ -#if __FreeBSD__ >= 4 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#if (__FreeBSD__ >= 4) || defined(__FreeBSD_kernel__) if (entry.eflags & (MAP_ENTRY_IS_SUB_MAP)) continue; #else @@ -282,7 +282,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, #endif /* __NetBSD_Version__ >= 105250000 */ #endif -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) if (object.type != OBJT_VNODE) continue; diff --git a/sysdeps/freebsd/procsignal.c b/sysdeps/freebsd/procsignal.c index 9c864882..41d9b00a 100644 --- a/sysdeps/freebsd/procsignal.c +++ b/sysdeps/freebsd/procsignal.c @@ -70,7 +70,7 @@ glibtop_get_proc_signal_p (glibtop *server, return; } -#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013) +#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__) #define PROC_SIGLIST ki_siglist #define PROC_SIGMASK ki_sigmask @@ -92,7 +92,7 @@ glibtop_get_proc_signal_p (glibtop *server, #if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000) buf->signal [0] = pinfo [0].kp_proc.p_sigctx.ps_siglist.__bits[0]; #elif (defined(__NetBSD__) && (NSIG > 32)) || \ - (defined(__FreeBSD__) && (__FreeBSD_version >= 400011)) + (defined(__FreeBSD__) && (__FreeBSD_version >= 400011) || defined(__FreeBSD_kernel__)) buf->signal [0] = pinfo [0].PROC_SIGLIST.__bits[0]; #else buf->signal [0] = pinfo [0].kp_proc.p_siglist; @@ -104,7 +104,7 @@ glibtop_get_proc_signal_p (glibtop *server, #if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000) buf->blocked [0] = pinfo [0].kp_proc.p_sigctx.ps_sigmask.__bits[0]; #elif (defined(__NetBSD__) && (NSIG > 32)) || \ - (defined(__FreeBSD__) && (__FreeBSD_version >= 400011)) + (defined(__FreeBSD__) && (__FreeBSD_version >= 400011) || defined(__FreeBSD_kernel__)) buf->blocked [0] = pinfo [0].PROC_SIGMASK.__bits[0]; #else buf->blocked [0] = pinfo [0].kp_proc.p_sigmask; @@ -116,7 +116,7 @@ glibtop_get_proc_signal_p (glibtop *server, #if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000) buf->sigignore [0] = pinfo [0].kp_proc.p_sigctx.ps_sigignore.__bits[0]; #elif (defined(__NetBSD__) && (NSIG > 32)) || \ - (defined(__FreeBSD__) && (__FreeBSD_version >= 400011)) + (defined(__FreeBSD__) && (__FreeBSD_version >= 400011) || defined(__FreeBSD_kernel__)) buf->sigignore [0] = pinfo [0].PROC_SIGIGNORE.__bits[0]; #else buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore; @@ -128,7 +128,7 @@ glibtop_get_proc_signal_p (glibtop *server, #if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000) buf->sigcatch [0] = pinfo [0].kp_proc.p_sigctx.ps_sigcatch.__bits[0]; #elif (defined(__NetBSD__) && (NSIG > 32)) || \ - (defined(__FreeBSD__) && (__FreeBSD_version >= 400011)) + (defined(__FreeBSD__) && (__FreeBSD_version >= 400011) || defined(__FreeBSD_kernel__)) buf->sigcatch [0] = pinfo [0].PROC_SIGCATCH.__bits[0]; #else buf->sigcatch [0] = pinfo [0].kp_proc.p_sigcatch; diff --git a/sysdeps/freebsd/procstate.c b/sysdeps/freebsd/procstate.c index 5f7beced..723a0c10 100644 --- a/sysdeps/freebsd/procstate.c +++ b/sysdeps/freebsd/procstate.c @@ -73,7 +73,7 @@ glibtop_get_proc_state_p (glibtop *server, return; } -#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013) +#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__) #define PROC_COMM ki_comm #define PROC_SVUID ki_svuid #define PROC_SVGID ki_svgid diff --git a/sysdeps/freebsd/proctime.c b/sysdeps/freebsd/proctime.c index 09e02336..e143e1af 100644 --- a/sysdeps/freebsd/proctime.c +++ b/sysdeps/freebsd/proctime.c @@ -58,9 +58,8 @@ glibtop_init_proc_time_p (glibtop *server) * system, and interrupt time usage. */ -#ifndef __FreeBSD__ +#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) -#ifndef __FreeBSD__ static void calcru(p, up, sp, ip) struct proc *p; @@ -109,8 +108,6 @@ calcru(p, up, sp, ip) ip->tv_usec = it % 1000000; } } -#endif - #endif /* !__FreeBSD__ */ /* Provides detailed information about a process. */ @@ -145,7 +142,7 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf, if ((pinfo == NULL) || (count != 1)) glibtop_error_io_r (server, "kvm_getprocs (%d)", pid); -#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013) +#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__) buf->rtime = pinfo [0].ki_runtime; #elif (defined __FreeBSD__) && (__FreeBSD_version <= 500013) buf->rtime = pinfo [0].kp_proc.p_runtime; @@ -182,8 +179,8 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf, buf->flags |= _glibtop_sysdeps_proc_time_user; #else -#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013) -#if __FreeBSD_version >= 500016 +#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__) +#if (__FreeBSD_version >= 500016) || defined(__FreeBSD_kernel__) if ((pinfo [0].ki_flag & PS_INMEM)) { #else if ((pinfo [0].ki_flag & P_INMEM)) { diff --git a/sysdeps/freebsd/procuid.c b/sysdeps/freebsd/procuid.c index 36aea63a..133c6b97 100644 --- a/sysdeps/freebsd/procuid.c +++ b/sysdeps/freebsd/procuid.c @@ -77,7 +77,7 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, return; } -#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013) +#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500013)) || defined(__FreeBSD_kernel__) #define PROC_RUID ki_ruid #define PROC_SVUID ki_svuid @@ -87,12 +87,8 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, #define PROC_PGID ki_pgid #define PROC_TPGID ki_tpgid #define PROC_NICE ki_nice -#if __FreeBSD_version >= 500013 #define PROC_PRIORITY ki_pri.pri_user #else -#define PROC_PRIORITY ki_priority -#endif -#else #define PROC_RUID kp_eproc.e_pcred.p_ruid #define PROC_SVUID kp_eproc.e_pcred.p_svuid diff --git a/sysdeps/freebsd/swap.c b/sysdeps/freebsd/swap.c index 83b2ab1a..438b36ae 100644 --- a/sysdeps/freebsd/swap.c +++ b/sysdeps/freebsd/swap.c @@ -33,13 +33,13 @@ static const unsigned long _glibtop_sysdeps_swap = (1L << GLIBTOP_SWAP_FREE) + (1L << GLIBTOP_SWAP_PAGEIN) + (1L << GLIBTOP_SWAP_PAGEOUT); -#if defined(__FreeBSD__) || defined(__bsdi__) +#if defined(__FreeBSD__) || defined(__bsdi__) || defined(__FreeBSD_kernel__) #include <sys/conf.h> #ifdef __bsdi__ #include <vm/swap_pager.h> #else -#if __FreeBSD_version < 400005 +#if (__FreeBSD_version < 400005) && !defined(__FreeBSD_kernel__) #include <sys/rlist.h> #endif #endif @@ -94,7 +94,7 @@ static struct nlist nlst2 [] = { void glibtop_init_swap_p (glibtop *server) { -#if defined(__FreeBSD__) || defined(__bsdi__) +#if defined(__FreeBSD__) || defined(__bsdi__) || defined(__FreeBSD_kernel__) #if __FreeBSD__ < 4 || defined(__bsdi__) if (kvm_nlist (server->machine.kd, nlst) < 0) { glibtop_warn_io_r (server, "kvm_nlist (swap)"); @@ -130,9 +130,9 @@ glibtop_init_swap_p (glibtop *server) void glibtop_get_swap_p (glibtop *server, glibtop_swap *buf) { -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -# if __FreeBSD__ < 4 +# if (__FreeBSD__ < 4) && !defined(__FreeBSD_kernel__) char *header; int hlen, nswdev, dmmax; int div, nfree, npfree; @@ -194,7 +194,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf) buf->pagein = 0; buf->pageout = 0; } else { -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) buf->pagein = vmm.v_swappgsin - swappgsin; buf->pageout = vmm.v_swappgsout - swappgsout; #else @@ -208,7 +208,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf) #endif } -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) swappgsin = vmm.v_swappgsin; swappgsout = vmm.v_swappgsout; #else @@ -221,9 +221,9 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf) #endif #endif -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#if __FreeBSD__ < 4 +#if (__FreeBSD__ < 4) && !defined(__FreeBSD_kernel__) /* Size of largest swap device. */ |