portable library for obtaining system information

This commit is contained in:
todd 2001-09-13 20:45:46 +00:00
parent afa14944a0
commit 6245948a72
21 changed files with 922 additions and 0 deletions

51
devel/libgtop/Makefile Normal file
View File

@ -0,0 +1,51 @@
# $OpenBSD: Makefile,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
COMMENT= "portable library for obtaining system information"
V= 1.0.12
DISTNAME= libgtop-${V}
CATEGORIES= devel
NEED_VERSION= 1.384
HOMEPAGE= http://www.home-of-linux.org/gnome/libgtop/
MAINTAINER= Nils Nordman <nino@nforced.com>
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= stable/sources/libgtop
LIB_DEPENDS=
FLAVORS= gnome guile
FLAVOR?=
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
USE_GMAKE= Yes
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS+= ${CONFIGURE_SHARED}
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include -DUVM" \
LDFLAGS="-L${LOCALBASE}/lib"
.if ${FLAVOR:L:Mgnome}
LIB_DEPENDS+= gnome.36::x11/gnome-libs
.else
CONFIGURE_ARGS+= --without-gnome
.endif
.if ${FLAVOR:L:Mguile}
BUILD_DEPENDS+= guile::lang/guile
RUN_DEPENDS+= guile::lang/guile
CONFIGURE_ARGS+= --with-libgtop-guile=yes
.else
CONFIGURE_ARGS+= --with-libgtop-guile=no
.endif
pre-fetch:
@echo \
echo " WARNING: This application requires a kernel compiled" \
echo " with 'option UVM' for proper operation. The GENERIC" \
echo " kernel contains this option." \
echo
.include <bsd.port.mk>

3
devel/libgtop/files/md5 Normal file
View File

@ -0,0 +1,3 @@
MD5 (libgtop-1.0.12.tar.gz) = ac2cbd0245845dc13bfe262fd6a5577a
RMD160 (libgtop-1.0.12.tar.gz) = a23cd17a0163063f51de08c2fd1702ab9200b73d
SHA1 (libgtop-1.0.12.tar.gz) = 7ff6ae62b599db4bd51b54d4d549627eacfc8509

View File

@ -0,0 +1,51 @@
--- ltconfig.orig Sun Nov 12 02:14:53 2000
+++ ltconfig Mon Aug 27 17:02:38 2001
@@ -1105,6 +1105,9 @@ cygwin* | mingw*)
with_gnu_ld=no
fi
;;
+openbsd*)
+ with_gnu_ld=no
+ ;;
esac
@@ -1402,10 +1405,21 @@ else
;;
openbsd*)
- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
- hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
+ case "$host_os" in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ if [ "`/usr/bin/file /usr/lib/libc.so.* | grep ELF`" != "" ]; then
+ export_dynamic_flag_spec='${wl}-E'
+ fi
+ ;;
+ esac
;;
os2*)
@@ -2021,13 +2035,10 @@ netbsd*)
openbsd*)
version_type=sunos
- if test "$with_gnu_ld" = yes; then
- need_lib_prefix=no
- need_version=no
- fi
library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
+ deplibs_check_method='pass_all'
;;
os2*)

View File

@ -0,0 +1,83 @@
--- ltmain.sh.orig Sun Nov 12 02:14:53 2000
+++ ltmain.sh Mon Aug 27 17:02:38 2001
@@ -1079,7 +1079,18 @@ compiler."
# These systems don't actually have c library (as such)
continue
;;
+ *-*-openbsd*)
+ # Do not include libc due to us having libc/libc_r.
+ continue
+ ;;
esac
+ elif test "$arg" = "-lc_r"; then
+ case "$host" in
+ *-*-openbsd*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
elif test "$arg" = "-lm"; then
case "$host" in
*-*-cygwin* | *-*-beos*)
@@ -1091,6 +1102,10 @@ compiler."
deplibs="$deplibs $arg"
;;
+ -?thread)
+ deplibs="$deplibs $arg"
+ ;;
+
-module)
module=yes
continue
@@ -1799,6 +1814,9 @@ compiler."
# rhapsody is a little odd...
deplibs="$deplibs -framework System"
;;
+ *-*-openbsd*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
*)
# Add libc to deplibs on all other systems.
deplibs="$deplibs -lc"
@@ -3567,40 +3585,6 @@ libdir='$install_libdir'\
# Exit here if they wanted silent mode.
test "$show" = : && exit 0
- echo "----------------------------------------------------------------------"
- echo "Libraries have been installed in:"
- for libdir in $libdirs; do
- echo " $libdir"
- done
- echo
- echo "If you ever happen to want to link against installed libraries"
- echo "in a given directory, LIBDIR, you must either use libtool, and"
- echo "specify the full pathname of the library, or use \`-LLIBDIR'"
- echo "flag during linking and do at least one of the following:"
- if test -n "$shlibpath_var"; then
- echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
- echo " during execution"
- fi
- if test -n "$runpath_var"; then
- echo " - add LIBDIR to the \`$runpath_var' environment variable"
- echo " during linking"
- fi
- if test -n "$hardcode_libdir_flag_spec"; then
- libdir=LIBDIR
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- echo " - use the \`$flag' linker flag"
- fi
- if test -n "$admincmds"; then
- echo " - have your system administrator run these commands:$admincmds"
- fi
- if test -f /etc/ld.so.conf; then
- echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
- fi
- echo
- echo "See any operating system documentation about shared libraries for"
- echo "more information, such as the ld(1) and ld.so(8) manual pages."
- echo "----------------------------------------------------------------------"
exit 0
;;

View File

@ -0,0 +1,91 @@
# $OpenBSD: patch-support_gnomesupport.h,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
--- support/gnomesupport.h.orig Tue Feb 27 14:27:58 2001
+++ support/gnomesupport.h Mon Aug 27 17:23:18 2001
@@ -5,37 +5,11 @@
#define GNOMESUPPORT_H
#include <stddef.h> /* for size_t */
-#include <stdarg.h>
-#include <sys/types.h>
-#define dirent direct
-#define NAMLEN(dirent) (dirent)->d_namlen
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-/* Copies len bytes from src to dest. */
-void * memmove (void */*dest*/, const void */*src*/, size_t /*len*/);
-
-/* Generate a unique temporary file name from TEMPLATE.
- The last six characters of TEMPLATE must be ;
- they are replaced with a string that makes the filename
- unique. Returns a file descriptor open on the file for
- reading and writing. */
-int mkstemp (char */*template*/);
-
-/* Scan the directory DIR, calling SELECTOR on each directory
- entry. Entries for which SELECTOR returns nonzero are
- individually malloc'd, sorted using qsort with CMP, and
- collected in a malloc'd array in *NAMELIST. Returns the
- number of entries selected, or -1 on error. */
-int scandir (const char */*dir*/, struct dirent ***/*namelist*/,
- int (*/*selector*/) (struct dirent *),
- int (*/*cmp*/) (const void *, const void *));
-
-/* Function to compare two `struct dirent's alphabetically. */
-int alphasort (const void */*a*/, const void */*b*/);
-
/* Return a malloc'd copy of at most N bytes of STRING. The
resultant string is terminated even if no null terminator
appears before STRING[N]. */
@@ -45,49 +19,6 @@ char * strndup (const char */*s*/, size_
characters. If no '\0' terminator is found in that many
characters, return MAXLEN. */
size_t strnlen (const char */*string*/, size_t /*maxlen*/);
-
-/* Divide S into tokens separated by characters in DELIM.
- Information passed between calls are stored in SAVE_PTR. */
-char * strtok_r (char */*s*/, const char */*delim*/,
- char **/*save_ptr*/);
-
-/* Convert the initial portion of the string pointed to by
- nptr to double representation and return the converted value.
- If endptr is not NULL, a pointer to the character after the
- last character used in the conversion is stored in the
- location referenced by endptr. */
-double strtod (const char */*nptr*/, char **/*endptr*/);
-
-/* Convert the initial portion of the string pointed to by
- nptr to a long integer value according to the given base.
- If endptr is not NULL, a pointer to the character after the
- last character used in the conversion is stored in the
- location referenced by endptr. */
-long int strtol (const char */*nptr*/, char **/*endptr*/, int /*base*/);
-
-/* Write formatted output to a string dynamically allocated with
- `malloc'. Store the address of the string in *PTR. */
-int vasprintf (char **/*ptr*/, const char */*format*/,
- va_list /*args*/);
-int asprintf (char **/*ptr*/, const char */*format*/, ...);
-
-/* Maximum chars of output to write is MAXLEN. */
-int vsnprintf (char */*str*/, size_t /*maxlen*/,
- char */*fmt*/, va_list /*ap*/);
-int snprintf (char */*str*/, size_t /*maxlen*/,
- char */*fmt*/, ...);
-
-/* Return the canonical absolute name of file NAME. A canonical name
- does not contain any `.', `..' components nor any repeated path
- separators ('/') or symlinks. All path components must exist.
- If the canonical name is PATH_MAX chars or more, returns null with
- `errno' set to ENAMETOOLONG; if the name fits in fewer than PATH_MAX
- chars, returns the name in RESOLVED. If the name cannot be resolved
- and RESOLVED is non-NULL, it contains the path of the first component
- that cannot be resolved. If the path can be resolved, RESOLVED
- holds the same value as the value returned. */
-
-char *realpath (char */*path*/, char /*resolved_path*/[]);
#ifdef __cplusplus
}

View File

@ -0,0 +1,74 @@
--- sysdeps/freebsd/mem.c.orig Sun Feb 13 16:47:58 2000
+++ sysdeps/freebsd/mem.c Mon Aug 27 17:02:38 2001
@@ -31,7 +31,7 @@
#include <sys/vmmeter.h>
#include <vm/vm_param.h>
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
#include <uvm/uvm_extern.h>
#endif
@@ -57,7 +57,7 @@ static int pageshift; /* log base 2 of
/* nlist structure for kernel access */
static struct nlist nlst [] = {
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
{ "_bufpages" },
{ 0 }
#else
@@ -81,7 +81,7 @@ static int mib [] = { CTL_VM, VM_TOTAL }
static int mib [] = { CTL_VM, VM_METER };
#endif
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
static int mib_uvmexp [] = { CTL_VM, VM_UVMEXP };
#endif
@@ -117,7 +117,7 @@ glibtop_get_mem_p (glibtop *server, glib
{
struct vmtotal vmt;
size_t length_vmt;
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
struct uvmexp uvmexp;
size_t length_uvmexp;
#else
@@ -146,7 +146,7 @@ glibtop_get_mem_p (glibtop *server, glib
return;
}
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
length_uvmexp = sizeof (uvmexp);
if (sysctl (mib_uvmexp, 2, &uvmexp, &length_uvmexp, NULL, 0)) {
glibtop_warn_io_r (server, "sysctl (uvmexp)");
@@ -172,7 +172,7 @@ glibtop_get_mem_p (glibtop *server, glib
#if defined(__FreeBSD__)
v_total_count = vmm.v_page_count;
#else
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
v_total_count = uvmexp.reserve_kernel +
uvmexp.reserve_pagedaemon +
uvmexp.free + uvmexp.wired + uvmexp.active +
@@ -184,7 +184,7 @@ glibtop_get_mem_p (glibtop *server, glib
#endif
#endif
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
v_used_count = uvmexp.active + uvmexp.inactive;
v_free_count = uvmexp.free;
#else
@@ -200,7 +200,7 @@ glibtop_get_mem_p (glibtop *server, glib
buf->cached = (u_int64_t) pagetok (vmm.v_cache_count) << LOG1024;
#endif
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
buf->locked = (u_int64_t) pagetok (uvmexp.wired) << LOG1024;
#else
buf->locked = (u_int64_t) pagetok (vmm.v_wire_count) << LOG1024;

View File

@ -0,0 +1,66 @@
--- sysdeps/freebsd/procmap.c.orig Thu May 27 20:56:48 1999
+++ sysdeps/freebsd/procmap.c Mon Aug 27 17:26:53 2001
@@ -32,9 +32,6 @@
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/resource.h>
-#include <vm/vm_object.h>
-#include <vm/vm_prot.h>
-#include <vm/vm_map.h>
#include <sys/vnode.h>
#include <sys/mount.h>
@@ -48,7 +45,7 @@
#include <sys/sysctl.h>
#include <vm/vm.h>
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
/* Fixme ... */
#undef _KERNEL
#define _UVM_UVM_AMAP_I_H_ 1
@@ -82,7 +79,7 @@ glibtop_get_proc_map_p (glibtop *server,
struct kinfo_proc *pinfo;
struct vm_map_entry entry, *first;
struct vmspace vmspace;
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
struct vnode vnode;
struct inode inode;
#else
@@ -142,7 +139,7 @@ glibtop_get_proc_map_p (glibtop *server,
/* I tested this a few times with `mmap'; as soon as you write
* to the mmap'ed area, the object type changes from OBJT_VNODE
- * to OBJT_DEFAULT so if seems this really works. */
+ * to OBJT_DEFAULT so it seems this really works. */
do {
if (update) {
@@ -163,7 +160,7 @@ glibtop_get_proc_map_p (glibtop *server,
continue;
#endif
#else
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
if (UVM_ET_ISSUBMAP (&entry))
continue;
#else
@@ -189,7 +186,7 @@ glibtop_get_proc_map_p (glibtop *server,
i++;
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
if (!entry.object.uvm_obj)
continue;
@@ -213,7 +210,7 @@ glibtop_get_proc_map_p (glibtop *server,
glibtop_error_io_r (server, "kvm_read (object)");
#endif
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
if (!vnode.v_uvm.u_flags & UVM_VNODE_VALID)
continue;

View File

@ -0,0 +1,67 @@
--- sysdeps/freebsd/procmem.c.orig Thu May 27 20:56:49 1999
+++ sysdeps/freebsd/procmem.c Mon Aug 27 17:24:33 2001
@@ -31,8 +31,6 @@
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/resource.h>
-#include <vm/vm_object.h>
-#include <vm/vm_map.h>
#include <sys/vnode.h>
#include <ufs/ufs/quota.h>
@@ -45,7 +43,7 @@
#include <sys/sysctl.h>
#include <vm/vm.h>
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
/* Fixme ... */
#undef _KERNEL
#define _UVM_UVM_AMAP_I_H_ 1
@@ -61,9 +59,7 @@ static const unsigned long _glibtop_sysd
(1L << GLIBTOP_PROC_MEM_RSS_RLIM);
static const unsigned long _glibtop_sysdeps_proc_mem_share =
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
-(1L << GLIBTOP_PROC_MEM_SHARE);
-#elif defined(__FreeBSD__)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD) || defined(__FreeBSD__)
(1L << GLIBTOP_PROC_MEM_SHARE);
#else
0;
@@ -111,7 +107,7 @@ glibtop_get_proc_mem_p (glibtop *server,
struct kinfo_proc *pinfo;
struct vm_map_entry entry, *first;
struct vmspace *vms, vmspace;
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
struct vnode vnode;
struct inode inode;
#else
@@ -196,7 +192,7 @@ glibtop_get_proc_mem_p (glibtop *server,
continue;
#endif
#else
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
if (UVM_ET_ISSUBMAP (&entry))
continue;
#else
@@ -205,7 +201,7 @@ glibtop_get_proc_mem_p (glibtop *server,
#endif
#endif
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
if (!entry.object.uvm_obj)
continue;
@@ -232,7 +228,7 @@ glibtop_get_proc_mem_p (glibtop *server,
#endif
/* If the object is of type vnode, add its size */
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
if (!vnode.v_uvm.u_flags & UVM_VNODE_VALID)
continue;

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-sysdeps_freebsd_sem_limits_c,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
--- sysdeps/freebsd/sem_limits.c.orig Tue Feb 27 14:38:03 2001
+++ sysdeps/freebsd/sem_limits.c Mon Aug 27 17:07:24 2001
@@ -56,7 +56,7 @@ glibtop_get_sem_limits_p (glibtop *serve
#include <sys/sem.h>
static unsigned long _glibtop_sysdeps_sem_limits =
-(1L << GLIBTOP_IPC_SEMMAP) + (1L << GLIBTOP_IPC_SEMMNI) +
+(1L << GLIBTOP_IPC_SEMMNI) +
(1L << GLIBTOP_IPC_SEMMNS) + (1L << GLIBTOP_IPC_SEMMNU) +
(1L << GLIBTOP_IPC_SEMMSL) + (1L << GLIBTOP_IPC_SEMOPM) +
(1L << GLIBTOP_IPC_SEMUME) + (1L << GLIBTOP_IPC_SEMUSZ) +
@@ -104,7 +104,6 @@ glibtop_get_sem_limits_p (glibtop *serve
if (server->sysdeps.sem_limits == 0)
return;
- buf->semmap = _seminfo.semmap;
buf->semmni = _seminfo.semmni;
buf->semmns = _seminfo.semmns;
buf->semmnu = _seminfo.semmnu;

View File

@ -0,0 +1,101 @@
--- sysdeps/freebsd/swap.c.orig Sun Feb 13 16:47:59 2000
+++ sysdeps/freebsd/swap.c Mon Aug 27 17:02:38 2001
@@ -69,9 +69,9 @@ static struct nlist nlst [] = {
};
#endif
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(OpenBSD)
-#if (__NetBSD_Version__ >= 104000000)
+#if (__NetBSD_Version__ >= 104000000) || defined(OpenBSD)
#include <uvm/uvm_extern.h>
#include <sys/swap.h>
#else
@@ -80,7 +80,7 @@ static struct nlist nlst [] = {
#endif
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
static int mib_uvmexp [] = { CTL_VM, VM_UVMEXP };
#else
/* nlist structure for kernel access */
@@ -111,7 +111,7 @@ glibtop_init_swap_p (glibtop *server)
#endif
#endif
-#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000))
+#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) && !defined(OpenBSD)
if (kvm_nlist (server->machine.kd, nlst2) < 0) {
glibtop_warn_io_r (server, "kvm_nlist (cnt)");
return;
@@ -151,14 +151,16 @@ glibtop_get_swap_p (glibtop *server, gli
#elif defined(__bsdi__)
struct swapstats swap;
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(OpenBSD)
struct swapent *swaplist;
+ long blocksize;
+ int hlen;
#endif
int nswap, i;
int avail = 0, inuse = 0;
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
struct uvmexp uvmexp;
size_t length_uvmexp;
#else
@@ -175,7 +177,7 @@ glibtop_get_swap_p (glibtop *server, gli
if (server->sysdeps.swap == 0)
return;
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
length_uvmexp = sizeof (uvmexp);
if (sysctl (mib_uvmexp, 2, &uvmexp, &length_uvmexp, NULL, 0)) {
glibtop_warn_io_r (server, "sysctl (uvmexp)");
@@ -199,7 +201,7 @@ glibtop_get_swap_p (glibtop *server, gli
buf->pagein = vmm.v_swappgsin - swappgsin;
buf->pageout = vmm.v_swappgsout - swappgsout;
#else
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
buf->pagein = uvmexp.swapins - swappgsin;
buf->pageout = uvmexp.swapouts - swappgsout;
#else
@@ -213,7 +215,7 @@ glibtop_get_swap_p (glibtop *server, gli
swappgsin = vmm.v_swappgsin;
swappgsout = vmm.v_swappgsout;
#else
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || defined(OpenBSD)
swappgsin = uvmexp.swapins;
swappgsout = uvmexp.swapouts;
#else
@@ -393,7 +395,7 @@ glibtop_get_swap_p (glibtop *server, gli
buf->total = swap.swap_total;
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(OpenBSD)
nswap = swapctl (SWAP_NSWAP, NULL, 0);
if (nswap < 0) {
@@ -418,9 +420,10 @@ glibtop_get_swap_p (glibtop *server, gli
buf->flags = _glibtop_sysdeps_swap;
- buf->used = inuse;
- buf->free = avail;
+ (char *)getbsize (&hlen, &blocksize);
- buf->total = inuse + avail;
+ buf->total = avail * blocksize;
+ buf->used = inuse * blocksize;
+ buf->free = buf->total - buf->used;
#endif
}

19
devel/libgtop/pkg/DESCR Normal file
View File

@ -0,0 +1,19 @@
LibGTop is a library for obtaining information about processes and the system.
This includes information about the following areas:
* General System Information
* SYS V IPC Limits:
* Network:
* Process List:
* Process information:
* Process maps:
* File system usage:
For more information about the gtop library see:
WWW: ${HOMEPAGE}
Available flavors:
guile: Install guile bindings.
gnome: Use the GNOME framework.

38
devel/libgtop/pkg/INSTALL Normal file
View File

@ -0,0 +1,38 @@
#!/bin/sh
#
# $OpenBSD: INSTALL,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
#
# libgtop, install .info correctly and set gid kmem for ligtop_server.
PREFIX=${PKG_PREFIX:-/usr/local}
do_post() {
chown root.kmem ${PREFIX}/bin/libgtop_server
chmod 2755 ${PREFIX}/bin/libgtop_server
install-info --section="Programming \& development tools" \
--entry="* libgtop: (libgtop). libgtop programming manual" \
${PREFIX}/info/libgtop.info ${PREFIX}/info/dir
}
# verify proper execution
#
if [ $# -ne 2 ]; then
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
fi
# Verify/process the command
#
case $2 in
PRE-INSTALL)
;;
POST-INSTALL)
do_post
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,6 @@
*=================[ libgtop
* libgtop_server has now been installed into ${PREFIX}/bin/
* with setgid kmem.
*================= libgtop ]

View File

@ -0,0 +1,7 @@
@comment $OpenBSD: PFRAG.guile,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
lib/libgtop_guile.a
lib/libgtop_guile.la
lib/libgtop_guile_names.a
lib/libgtop_guile_names.la
lib/libgtop_guile.so.1.11
lib/libgtop_guile_names.so.1.11

View File

@ -0,0 +1,8 @@
@comment $OpenBSD: PFRAG.no-gnome,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
include/popt-gnome.h
lib/libgnomesupport.a
lib/libgnomesupport.la
lib/libgtop/include/gnomesupport.h
lib/libgnomesupport.so.0.0
@dirrm lib/libgtop/include
@dirrm lib/libgtop

View File

@ -0,0 +1,8 @@
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
lib/libgtop.so.1.11
lib/libgtop_common.so.1.11
lib/libgtop_names.so.1.11
lib/libgtop_suid_common.so.1.11
lib/libgtop_sysdeps.so.1.11
lib/libgtop_sysdeps_suid.so.1.11
DYNLIBDIR(%D/lib)

View File

@ -0,0 +1,10 @@
@comment $OpenBSD: PFRAG.shared-guile,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
lib/libgtop.so.1.11
lib/libgtop_common.so.1.11
lib/libgtop_guile.so.1.11
lib/libgtop_guile_names.so.1.11
lib/libgtop_names.so.1.11
lib/libgtop_suid_common.so.1.11
lib/libgtop_sysdeps.so.1.11
lib/libgtop_sysdeps_suid.so.1.11
DYNLIBDIR(%D/lib)

View File

@ -0,0 +1,9 @@
@comment $OpenBSD: PFRAG.shared-no_gnome,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
lib/libgnomesupport.so.0.0
lib/libgtop.so.1.11
lib/libgtop_common.so.1.11
lib/libgtop_names.so.1.11
lib/libgtop_suid_common.so.1.11
lib/libgtop_sysdeps.so.1.11
lib/libgtop_sysdeps_suid.so.1.11
DYNLIBDIR(%D/lib)

68
devel/libgtop/pkg/PLIST Normal file
View File

@ -0,0 +1,68 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
@unexec install-info --delete --info-dir=%D/info %D/info/libgtop.info
bin/libgtop-config
bin/libgtop_daemon
bin/libgtop_server
include/glibtop.h
include/glibtop/close.h
include/glibtop/command.h
include/glibtop/cpu.h
include/glibtop/error.h
include/glibtop/fsusage.h
include/glibtop/global.h
include/glibtop/gnuserv.h
include/glibtop/inodedb.h
include/glibtop/loadavg.h
include/glibtop/mem.h
include/glibtop/mountlist.h
include/glibtop/msg_limits.h
include/glibtop/netload.h
include/glibtop/open.h
include/glibtop/parameter.h
include/glibtop/ppp.h
include/glibtop/procargs.h
include/glibtop/prockernel.h
include/glibtop/proclist.h
include/glibtop/procmap.h
include/glibtop/procmem.h
include/glibtop/procsegment.h
include/glibtop/procsignal.h
include/glibtop/procstate.h
include/glibtop/proctime.h
include/glibtop/procuid.h
include/glibtop/read.h
include/glibtop/read_data.h
include/glibtop/sem_limits.h
include/glibtop/shm_limits.h
include/glibtop/signal.h
include/glibtop/swap.h
include/glibtop/sysdeps.h
include/glibtop/sysinfo.h
include/glibtop/types.h
include/glibtop/union.h
include/glibtop/uptime.h
include/glibtop/version.h
include/glibtop/write.h
include/glibtop/xmalloc.h
include/glibtop_machine.h
include/glibtop_server.h
include/glibtop_suid.h
info/libgtop.info
lib/libgtop-features.def
lib/libgtop.a
lib/libgtop.la
lib/libgtopConf.sh
lib/libgtop_common.a
lib/libgtop_common.la
lib/libgtop_names.a
lib/libgtop_names.la
lib/libgtop_suid_common.a
lib/libgtop_suid_common.la
lib/libgtop_sysdeps.a
lib/libgtop_sysdeps.la
lib/libgtop_sysdeps_suid.a
lib/libgtop_sysdeps_suid.la
!%%gnome%%
%%guile%%
%%SHARED%%
@dirrm include/glibtop

View File

@ -0,0 +1,70 @@
@comment $OpenBSD: PLIST-guile,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
@unexec install-info --delete --info-dir=%D/info %D/info/libgtop.info
bin/libgtop-config
bin/libgtop_daemon
bin/libgtop_server
include/glibtop.h
include/glibtop/close.h
include/glibtop/command.h
include/glibtop/cpu.h
include/glibtop/error.h
include/glibtop/fsusage.h
include/glibtop/global.h
include/glibtop/gnuserv.h
include/glibtop/inodedb.h
include/glibtop/loadavg.h
include/glibtop/mem.h
include/glibtop/mountlist.h
include/glibtop/msg_limits.h
include/glibtop/netload.h
include/glibtop/open.h
include/glibtop/parameter.h
include/glibtop/ppp.h
include/glibtop/procargs.h
include/glibtop/prockernel.h
include/glibtop/proclist.h
include/glibtop/procmap.h
include/glibtop/procmem.h
include/glibtop/procsegment.h
include/glibtop/procsignal.h
include/glibtop/procstate.h
include/glibtop/proctime.h
include/glibtop/procuid.h
include/glibtop/read.h
include/glibtop/read_data.h
include/glibtop/sem_limits.h
include/glibtop/shm_limits.h
include/glibtop/signal.h
include/glibtop/swap.h
include/glibtop/sysdeps.h
include/glibtop/sysinfo.h
include/glibtop/types.h
include/glibtop/union.h
include/glibtop/uptime.h
include/glibtop/version.h
include/glibtop/write.h
include/glibtop/xmalloc.h
include/glibtop_machine.h
include/glibtop_server.h
include/glibtop_suid.h
info/libgtop.info
lib/libgtop-features.def
lib/libgtop.a
lib/libgtop.la
lib/libgtopConf.sh
lib/libgtop_common.a
lib/libgtop_common.la
lib/libgtop_guile.a
lib/libgtop_guile.la
lib/libgtop_guile_names.a
lib/libgtop_guile_names.la
lib/libgtop_names.a
lib/libgtop_names.la
lib/libgtop_suid_common.a
lib/libgtop_suid_common.la
lib/libgtop_sysdeps.a
lib/libgtop_sysdeps.la
lib/libgtop_sysdeps_suid.a
lib/libgtop_sysdeps_suid.la
%%SHARED%%
@dirrm include/glibtop

View File

@ -0,0 +1,72 @@
@comment $OpenBSD: PLIST-no_gnome,v 1.1.1.1 2001/09/13 20:45:46 todd Exp $
@unexec install-info --delete --info-dir=%D/info %D/info/libgtop.info
bin/libgtop-config
bin/libgtop_daemon
bin/libgtop_server
include/glibtop.h
include/glibtop/close.h
include/glibtop/command.h
include/glibtop/cpu.h
include/glibtop/error.h
include/glibtop/fsusage.h
include/glibtop/global.h
include/glibtop/gnuserv.h
include/glibtop/inodedb.h
include/glibtop/loadavg.h
include/glibtop/mem.h
include/glibtop/mountlist.h
include/glibtop/msg_limits.h
include/glibtop/netload.h
include/glibtop/open.h
include/glibtop/parameter.h
include/glibtop/ppp.h
include/glibtop/procargs.h
include/glibtop/prockernel.h
include/glibtop/proclist.h
include/glibtop/procmap.h
include/glibtop/procmem.h
include/glibtop/procsegment.h
include/glibtop/procsignal.h
include/glibtop/procstate.h
include/glibtop/proctime.h
include/glibtop/procuid.h
include/glibtop/read.h
include/glibtop/read_data.h
include/glibtop/sem_limits.h
include/glibtop/shm_limits.h
include/glibtop/signal.h
include/glibtop/swap.h
include/glibtop/sysdeps.h
include/glibtop/sysinfo.h
include/glibtop/types.h
include/glibtop/union.h
include/glibtop/uptime.h
include/glibtop/version.h
include/glibtop/write.h
include/glibtop/xmalloc.h
include/glibtop_machine.h
include/glibtop_server.h
include/glibtop_suid.h
include/popt-gnome.h
info/libgtop.info
lib/libgnomesupport.a
lib/libgnomesupport.la
lib/libgtop-features.def
lib/libgtop.a
lib/libgtop.la
lib/libgtop/include/gnomesupport.h
lib/libgtopConf.sh
lib/libgtop_common.a
lib/libgtop_common.la
lib/libgtop_names.a
lib/libgtop_names.la
lib/libgtop_suid_common.a
lib/libgtop_suid_common.la
lib/libgtop_sysdeps.a
lib/libgtop_sysdeps.la
lib/libgtop_sysdeps_suid.a
lib/libgtop_sysdeps_suid.la
%%SHARED%%
@dirrm lib/libgtop/include
@dirrm lib/libgtop
@dirrm include/glibtop