Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Dec 1999 20:44:15 -0500
From:      "Vladimir N. Silyaev" <vsilyaev@mindspring.com>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        freebsd-emulation@FreeBSD.ORG
Subject:   Re: vmware questions
Message-ID:  <19991212204415.A18746@jupiter.delta.ny.us>
In-Reply-To: <14420.14744.875394.54896@grasshopper.cs.duke.edu>; from gallatin@cs.duke.edu on Sun, Dec 12, 1999 at 07:25:51PM -0500
References:  <14420.14744.875394.54896@grasshopper.cs.duke.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 12, 1999 at 07:25:51PM -0500, Andrew Gallatin wrote:
> This is tremendous.  Thank you for doing this!  
Thank you for trying this port.

> I'm running your
> latest port & I've run Win98 and have installed NT4 under vmware.
> It seems very solid.  I was expecting my machine to crash at least
> once, but it did not ;-)
Really it's very easy, just try to launch second vmware copy ;-(.
It's easy to fix this, and enable only one vmware session per
host, but I'm looking for better solution.

> 
> I have a few questions:
> 
> - Is sound supposed to work?  I have sound configured as:
> 
Oh no, I never tried to use sound. Ok it's added into my TODO list.

> 
> 
> - Are SCSI CD-ROM's supposed to work?  When attempting to use one,
> Windows claims the device is not available & I see many messages on
> console:
> 
> Dec 11 16:00:26 grasshopper /kernel: (cd0:ahc0:0:5:0): ILLEGAL REQUEST asc:24,0
> Dec 11 16:00:26 grasshopper /kernel: (cd0:ahc0:0:5:0): Invalid field in CDB
> Dec 11 16:00:37 grasshopper /kernel: (cd0:ahc0:0:5:0): READ SUB-CHANNEL. CDB: 42 0 40 1 0 0 8 0 18 0
> 
> After ripping the SCSI CDROM drive out & replacing it with an ATAPI
> drive, everything works just dandy.
I don't have a SCSI CDROM, so I can't to test this. I suppose that vmware use 
ioctl to read subchannel, and SCSI cdrom driver complained about it.

> 
> 
> - Are you planning on implementing the bridged networking feature?
> I'm just using NATD now in combination with host-only networking & all
> I care about is working fine.  But I was just curious.
I really don't know what is the sense of bridging networking, may
only to use some brain damaged protocols such as NetBEUI. If someone
really needed the bridge networking, probable much more easy to enable
BRIDGE support in kernel, and added support for bridge in the vmnet
driver.

> 
> I have appended a small patch to linprocfs_misc so that linprocfs
> reports memory size correctly.
Really this is patch must be addressed to Pierre Beyssac.
If you are interested on more correctly work of .../meminfo I have
just another patch, probably much more correct (probably only one leak 
in swap info).

--
Vladimir Silyaev 


Index: linprocfs_misc.c
===================================================================
RCS file: /home/vns/cvs/linprocfs/sys/miscfs/linprocfs/linprocfs_misc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- linprocfs_misc.c	1999/12/06 05:35:02	1.1.1.1
+++ linprocfs_misc.c	1999/12/06 05:57:53	1.2
@@ -48,6 +48,8 @@
 #include <sys/vnode.h>
 #include <sys/tty.h>
 #include <sys/resourcevar.h>
+#include <sys/vmmeter.h>
+#include <sys/sysctl.h>
 #include <miscfs/linprocfs/linprocfs.h>
 
 #include <vm/vm.h>
@@ -60,6 +62,41 @@
 
 struct proc;
 
+/* next function imported from /usr/src/lib/libc/gen/sysctlbyname.c */
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
+ * ----------------------------------------------------------------------------
+ */
+static int
+kernel_sysctlbyname(struct proc *p, const char *name, void *oldp, size_t *oldlenp, void *newp,
+	     size_t newlen)
+{
+	int name2oid_oid[2];
+	int real_oid[CTL_MAXNAME+2];
+	int error;
+	size_t oidlen;
+	size_t retval;
+
+	name2oid_oid[0] = 0;	/* This is magic & undocumented! */
+	name2oid_oid[1] = 3;
+
+	oidlen = sizeof(real_oid);
+	error = kernel_sysctl(p, name2oid_oid, 2, real_oid, &oidlen, (void *)(u_long)name, strlen(name), &retval);
+	if (error) {
+		return error;
+	}
+	oidlen = retval / sizeof (int); /* VnS: Why not oidlen? I really don't know */
+	error = kernel_sysctl(p, real_oid, oidlen, oldp, oldlenp, newp, newlen, &retval);
+	if (error) {
+		return error;
+	}
+	return (error);
+}
+
 int
 linprocfs_domeminfo(curp, p, pfs, uio)
 	struct proc *curp;
@@ -67,39 +104,77 @@
 	struct pfsnode *pfs;
 	struct uio *uio;
 {
-	char *ps;
-	int xlen;
-	int error;
-	char psbuf[512];		/* XXX - conservative */
-	unsigned long memtotal, memfree, memshared;
-	unsigned long buffers, cached, swaptotal, swapfree;
+struct {
+  u_long mem_total, mem_used, mem_free, mem_shared, mem_buffers, mem_cached;
+  u_long swap_total, swap_used, swap_free;
+} minfo;
+char psbuf[512], *ps;		/* XXX - conservative */
+const int maxlen=sizeof(psbuf);
+int mib[2];
+int len, error;
+size_t retval;
+int nprinted, xlen;
+struct vmtotal total;
 
 	if (uio->uio_rw != UIO_READ)
 		return (EOPNOTSUPP);
+
+	bzero(&minfo, sizeof(minfo));
 
-	memtotal = 32768; memfree = 32768;
-	buffers = 16384; cached = 8192;
-	swaptotal = 32768; swapfree = 16384;
-	memshared = 0;
 
-	ps = psbuf;
-	ps += sprintf(ps,
+	mib[0] = CTL_HW;
+	mib[1] = HW_PHYSMEM;
+	len = sizeof(minfo.mem_total);
+
+	error = kernel_sysctl(curp, mib, 2, &minfo.mem_total, &len, 0, 0, &retval); 
+	if (error)
+		return error;
+	
+	mib[0] = CTL_VM;
+	mib[1] = VM_METER;
+	len = sizeof(total);
+
+	error = kernel_sysctl(curp, mib, 2, &total, &len, 0, 0, &retval); 
+	if (error)
+		return error;
+	
+
+	minfo.mem_free = ptoa(total.t_free);
+	minfo.mem_used = minfo.mem_total - minfo.mem_free;
+	minfo.mem_cached = ptoa(cnt.v_cache_count);
+	minfo.mem_shared = ptoa(total.t_rmshr);
+
+	len = sizeof(minfo.mem_total);
+	error = kernel_sysctlbyname(p, "vfs.bufspace", &minfo.mem_buffers, &len, 0, 0); 
+	if (error) 
+		return error;
+		
+	/* XXX Fetch swap information */
+
+	nprinted = snprintf(psbuf, maxlen,
 		"        total:    used:    free:  shared: buffers:  cached:\n"
-		"Mem:  %ld %ld %ld %ld %ld %ld\nSwap: %ld %ld %ld\n"
-		"MemTotal: %9ld kB\n"
-		"MemFree:  %9ld kB\n"
-		"MemShared:%9ld kB\n"
-		"Buffers:  %9ld kB\n"
-		"Cached:   %9ld kB\n"
-		"SwapTotal:%9ld kB\n"
-		"SwapFree: %9ld kB\n",
-		memtotal*1024, (memtotal-memfree)*1024, memfree*1024,
-		memshared*1024, buffers*1024, cached*1024,
-		swaptotal*1024, (swaptotal-swapfree)*1024, swapfree*1024,
-		memtotal, memfree, memshared, buffers, cached,
-		swaptotal, swapfree);
+		"Mem: \t%8lu %8lu %8lu %8lu %8lu %8lu\n"
+		"Swap:\t%8lu %8lu %8lu\n", 
+		minfo.mem_total, minfo.mem_used, minfo.mem_free, minfo.mem_shared, minfo.mem_buffers, minfo.mem_cached,
+		minfo.swap_total, minfo.swap_used, minfo.swap_free);
+	nprinted += snprintf(psbuf+nprinted, maxlen-nprinted,
+		"MemTotal:  %8lu kB\n"
+		"MemFree:   %8lu kB\n"
+		"MemShared: %8lu kB\n"
+		"Buffers:   %8lu kB\n"
+		"Cached:    %8lu kB\n"
+		"SwapTotal: %8lu kB\n"
+		"SwapFree:  %8lu kB\n",
+		minfo.mem_total/1024, 
+		minfo.mem_free/1024, 
+		minfo.mem_shared/1024, 
+		minfo.mem_buffers/1024, 
+		minfo.mem_cached/1024,
+		minfo.swap_total, 
+		minfo.swap_free);	
+
 
-	xlen = ps - psbuf;
+	xlen = nprinted;
 	xlen -= uio->uio_offset;
 	ps = psbuf + uio->uio_offset;
 	xlen = imin(xlen, uio->uio_resid);


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




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