Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Apr 2001 13:09:22 -0400 (EDT)
From:      jack@germanium.xtalwind.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/26575: [MAINTAINER UPDATE] sysutil/asmem
Message-ID:  <200104141709.f3EH9MN42648@germanium.xtalwind.net>

next in thread | raw e-mail | index | archive | help

>Number:         26575
>Category:       ports
>Synopsis:       [MAINTAINER UPDATE] sysutil/asmem
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 14 10:10:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        FreeBSD 4.3-RC i386
>Organization:
>Environment:
System: FreeBSD germanium.xtalwind.net 4.3-RC FreeBSD 4.3-RC #0: Fri Apr 13 22:28:59 EDT 2001 jack@germanium.xtalwind.net:/usr/src/sys/compile/GERMANIUM i386


	
>Description:
	Update asmem port to version 1.8 and unbreak on 4.x

>How-To-Repeat:
	
>Fix:

	FILES REMOVED: patch-aa patch-ab


diff -u -ruN asmem.old/Makefile asmem/Makefile
--- asmem.old/Makefile	Thu Aug  3 05:26:19 2000
+++ asmem/Makefile	Sat Apr 14 04:46:43 2001
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=		asmem
-PORTVERSION=		1.6
+PORTVERSION=		1.8
 CATEGORIES=		sysutils afterstep
 MASTER_SITES=		${MASTER_SITE_AFTERSTEP} \
 			http://www.bewoner.dma.be/Albert/software/
@@ -16,14 +16,11 @@
 
 USE_X_PREFIX=	yes
 USE_XPM=	yes
-MAKEFILE=	Makefile.UNIX
+GNU_CONFIGURE=	yes
 MAN1=		asmem.1
 MAKE_ENV=	PCFLAGS="${CFLAGS}"
 
 .include <bsd.port.pre.mk>
-.if ${OSVERSION} >= 400000
-BROKEN=		"missing sys/rlist.h on 4.0 and later"
-.endif
 
 do-install:
 	${INSTALL_MAN} ${WRKSRC}/asmem.man ${PREFIX}/man/man1/asmem.1
diff -u -ruN asmem.old/distinfo asmem/distinfo
--- asmem.old/distinfo	Sun Apr 23 01:36:09 2000
+++ asmem/distinfo	Sat Apr 14 04:46:48 2001
@@ -1 +1 @@
-MD5 (asmem-1.6.tar.gz) = 8c1eafc7af13279f37e622a1e9d5101d
+MD5 (asmem-1.8.tar.gz) = da28d88ef4796b41f5bc1d45dc3f2bd3
diff -u -ruN asmem.old/files/patch-aa asmem/files/patch-aa
--- asmem.old/files/patch-aa	Sun Apr 23 01:36:11 2000
+++ asmem/files/patch-aa	Wed Dec 31 19:00:00 1969
@@ -1,35 +0,0 @@
---- Makefile.UNIX	Sat Mar  6 09:13:53 1999
-+++ Makefile.UNIX.new	Sun Feb 13 01:23:54 2000
-@@ -5,19 +5,19 @@
- 
- # The location and names of the X11 libraries
- LDIR = -L/usr/X11R6/lib
--LIBS = -lXpm -lX11
-+LIBS = -lXpm -lX11 -lkvm
- 
- # The include path to the X11 files
- C_INCLUDE = -I. -I/usr/X11R6/include
- 
- #-----------------------------------------------------
--CC = gcc
-+CC ?= gcc
- COPTS = -O2 -pipe -Wall -Wshadow
- #COMPILE_FLAGS = -DDEBUG -DTEST -g
- 
--CFLAGS = $(COPTS) $(COMPILE_FLAGS) $(C_INCLUDE)
-+CFLAGS = $(PCFLAGS) $(COPTS) $(COMPILE_FLAGS) $(C_INCLUDE)
- 
--OBJ = asmem.o asmem_x.o read_mem.o x_color.o safecopy.o
-+OBJ = asmem.o asmem_x.o kvm_read.o x_color.o safecopy.o
- 
- all:	asmem
- 	@echo Ready.
-@@ -34,7 +34,7 @@
- x_color.o: x_color.c
- 	$(CC) -c $< $(CFLAGS) -o $@
- 
--read_mem.o: read_mem.h read_mem.c state.h
-+kvm_read.o: read_mem.h kvm_read.c state.h
- 	$(CC) -c $< $(CFLAGS) -o $@
- 
- asmem_x.o: asmem_x.c asmem_x.h x_color.h safecopy.h state.h\
diff -u -ruN asmem.old/files/patch-ab asmem/files/patch-ab
--- asmem.old/files/patch-ab	Mon Jun 14 16:00:36 1999
+++ asmem/files/patch-ab	Wed Dec 31 19:00:00 1969
@@ -1,199 +0,0 @@
-*** kvm_read.c.orig	Fri Jun  4 15:45:13 1999
---- kvm_read.c	Fri Jun  4 15:49:13 1999
-***************
-*** 0 ****
---- 1,194 ----
-+ /*
-+  * This file obtains memory usage via FreeBSD's kvm library.
-+  * It is a modified version of read_mem.c which is
-+  * Copyright (c) 1999  Albert Dorofeev <Albert@mail.dma.be>
-+  * use this in place of that file for FreeBSD systems.
-+  *
-+  * This software is distributed under GPL. For details see LICENSE file.
-+  */
-+ 
-+ 
-+ #include <stdio.h>
-+ #include <stdlib.h>
-+ #include <string.h>
-+ #include <fcntl.h>
-+ #include <unistd.h>
-+ 
-+ #include "state.h"
-+ 
-+ #include <err.h>
-+ #include <kvm.h>
-+ #include <nlist.h>
-+ #include <sys/rlist.h>
-+ #include <sys/conf.h>
-+ #include <sys/vmmeter.h>
-+ #include <sys/types.h>
-+ #include <sys/sysctl.h>
-+ #include <vm/vm_param.h>
-+ 
-+ extern struct asmem_state state;
-+ 
-+ kvm_t	*kd;
-+ 
-+ #define	SVAR(var) __STRING(var)	/* to force expansion */
-+ #define	KGET(idx, var)							\
-+ 	KGET1(idx, &var, sizeof(var), SVAR(var))
-+ #define	KGET1(idx, p, s, msg)						\
-+ 	KGET2(nl[idx].n_value, p, s, msg)
-+ #define	KGET2(addr, p, s, msg)						\
-+ 	if (kvm_read(kd, (u_long)(addr), p, s) != s)			\
-+ 		warnx("cannot read %s: %s", msg, kvm_geterr(kd))
-+ 
-+ struct nlist nl[] = {
-+ #define VM_SWAPLIST 0
-+     { "_swaplist" },/* list of free swap areas */
-+ #define VM_SWDEVT   1
-+ 	{ "_swdevt" },  /* list of swap devices and sizes */
-+ #define VM_NSWAP    2
-+ 	{ "_nswap" },   /* size of largest swap device */
-+ #define VM_NSWDEV   3
-+ 	{ "_nswdev" },  /* number of swap devices */
-+ #define VM_DMMAX    4
-+ 	{ "_dmmax" },   /* maximum size of a swap block */
-+ #define X_CNT		5
-+ 	{ "_cnt" },
-+ #define X_BUFSPACE  6
-+     { "_bufspace" },    /* K in buffer cache */
-+ 	{ "" }
-+ };
-+ 
-+ int close_meminfo()
-+ {
-+ 	kvm_close(kd);
-+ 	return 0;
-+ }
-+ 
-+ int read_meminfo()
-+ {
-+ 
-+ 	int nswap, nswdev, dmmax;
-+ 	int i, avail, nfree, used, bufspace = 0;
-+ 	struct swdevt *sw;
-+ 	struct vmmeter sum;
-+ 	long *perdev;
-+ 	struct rlist head;
-+ 	struct rlisthdr swaplist;
-+ 	struct rlist *swapptr;
-+ 	u_long ptr;
-+ 
-+ 	KGET(VM_NSWAP, nswap);
-+ 	KGET(VM_NSWDEV, nswdev);
-+ 	KGET(VM_DMMAX, dmmax);
-+ 	KGET1(VM_SWAPLIST, &swaplist, sizeof swaplist, "swaplist");
-+ 	if ((sw = (struct swdevt*)malloc(nswdev * sizeof(*sw))) == NULL ||
-+ 	    (perdev = (long *)malloc(nswdev * sizeof(*perdev))) == NULL)
-+ 		errx(1, "malloc");
-+ 	KGET1(VM_SWDEVT, &ptr, sizeof ptr, "swdevt");
-+ 	KGET2(ptr, sw, nswdev * sizeof(*sw), "*swdevt");
-+ 
-+ 	/* Count up swap space. */
-+ 	nfree = 0;
-+ 	memset(perdev, 0, nswdev * sizeof(*perdev));
-+ 	swapptr = swaplist.rlh_list;
-+ 	while (swapptr) {
-+ 		int	top, bottom, next_block;
-+ 
-+ 		KGET2(swapptr, &head, sizeof(struct rlist), "swapptr");
-+ 
-+ 		top = head.rl_end;
-+ 		bottom = head.rl_start;
-+ 
-+ 		nfree += top - bottom + 1;
-+ 
-+ 		/*
-+ 		 * Swap space is split up among the configured disks.
-+ 		 *
-+ 		 * For interleaved swap devices, the first dmmax blocks
-+ 		 * of swap space some from the first disk, the next dmmax
-+ 		 * blocks from the next, and so on up to nswap blocks.
-+ 		 *
-+ 		 * The list of free space joins adjacent free blocks,
-+ 		 * ignoring device boundries.  If we want to keep track
-+ 		 * of this information per device, we'll just have to
-+ 		 * extract it ourselves.
-+ 		 */
-+ 		while (top / dmmax != bottom / dmmax) {
-+ 			next_block = ((bottom + dmmax) / dmmax);
-+ 			perdev[(bottom / dmmax) % nswdev] +=
-+ 				next_block * dmmax - bottom;
-+ 			bottom = next_block * dmmax;
-+ 		}
-+ 		perdev[(bottom / dmmax) % nswdev] +=
-+ 			top - bottom + 1;
-+ 
-+ 		swapptr = head.rl_next;
-+ 	}
-+ 
-+ 	avail = 0;
-+ 	for (i = 0; i < nswdev; i++) {
-+ 		int xsize, xfree;
-+ 
-+ 		/*
-+ 		 * Don't report statistics for partitions which have not
-+ 		 * yet been activated via swapon(8).
-+ 		 */
-+ 		if (!(sw[i].sw_flags & SW_FREED))
-+ 			continue;
-+ 
-+ 		/* The first dmmax is never allocated to avoid trashing of
-+ 		 * disklabels
-+ 		 */
-+ 		xsize = sw[i].sw_nblks - dmmax;
-+ 		xfree = perdev[i];
-+ 		used = xsize - xfree;
-+ 		avail += xsize;
-+ 	}
-+ 
-+ 	/*
-+ 	 * If only one partition has been set up via swapon(8), we don't
-+ 	 * need to bother with totals.
-+ 	 */
-+ 	used = avail - nfree;
-+ 	free(sw);
-+ 	free(perdev);
-+ 
-+ 	state.fresh.swap_total = avail * 512;
-+ 	state.fresh.swap_used = used * 512;
-+ 	state.fresh.swap_free = (avail - used) * 512;
-+ 
-+ 	KGET(X_CNT, sum);
-+ 	KGET(X_BUFSPACE, bufspace);
-+ 
-+ 	state.fresh.total = sum.v_page_size * sum.v_page_count;
-+ 	state.fresh.used = sum.v_page_size * (sum.v_page_count - sum.v_free_count);
-+ 	state.fresh.free = sum.v_page_size * sum.v_free_count;
-+ 	state.fresh.shared = 0;
-+ 	state.fresh.cached = sum.v_page_size * sum.v_cache_count;
-+ 
-+ 	state.fresh.buffers = bufspace;
-+ 	return(0);
-+ 
-+ }
-+ 
-+ int open_meminfo()
-+ {
-+ 
-+ 	if (kd == 0) {
-+ 		kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, 0);
-+ 		if (kd != NULL) {
-+ 			if (kvm_nlist(kd, nl) < 0) {
-+ 				errx(1, "kvm_nlist: %s", kvm_geterr(kd));
-+ 			}
-+ 
-+ 			if (nl[0].n_type == 0) {
-+ 				errx(1, "no namelist");
-+ 			}
-+ 		} else {
-+ 			warnx("kvm not available");
-+ 			return(-1);
-+ 		}
-+ 	}
-+ 	return(0);
-+ }
-+ 
-+ 
	
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104141709.f3EH9MN42648>