*BSD News Article 4813


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!uunet!mcsun!sun4nl!eur.nl!pk
From: pk@cs.few.eur.nl (Paul Kranenburg)
Subject: [386BSD] bugfix for kern__physio.c [Was: kvm.c patch wanted]
Message-ID: <1992Sep9.131126.1009@cs.few.eur.nl>
Sender: news@cs.few.eur.nl
Reply-To: pk@cs.few.eur.nl
Organization: Erasmus University Rotterdam
References: <1992Sep7.190727.9631@Urmel.Informatik.RWTH-Aachen.DE> <Bu975K.4n7@ibmpcug.co.uk>
Date: Wed, 9 Sep 1992 13:11:26 GMT
Lines: 62

In <Bu975K.4n7@ibmpcug.co.uk> root@ibmpcug.co.uk (The root of all evil) writes:

>In article <1992Sep7.190727.9631@Urmel.Informatik.RWTH-Aachen.DE> kuku@acds.physik.rwth-aachen.de writes:
>>
>>Has anyone gotten ps to output the user command line?
>>
>>There were two posts on that issue in July, I believe. These two patches
>>for kvm.c at al.gave this  "hunk 2 failed" - oh I love these kind of
>>messages. Should add it to my .signature file :-)

>Thats because whoever did the patch missed off semi-colons in the
>most awkward of places... The best plan is to look at the original
>and the patch and decide which semicolons to delete from the patch :)

>If you e-mail me, I will send you a patched copy of kvm.c.

An even more patched version of kvm.c is available from `ftp.cs.few.eur.nl'
in directory: ~/pub/386BSD/unofficial.

This version contains a first attempt to cul the u area and command arguments
from the swap device if the pages containing them are not available from
/dev/mem. This is a rather costly operation since it involves traversing a
lot of VM data structures (fortunately, I need it only for arguments since
I've set enableswap to zero in `vm/vm_glue.c'). It may also have difficulties
in retrieving more than a page full of args.

Before you try this, you need to apply a patch to `kern/kern__physio.c' to
prevent your machine from crashing on an attempt to read from /dev/drum.
This problem is due to an improperly initialized buffer in the routine
`physstrat'. Here's a diff:


------- kern__physio.c -------
*** /tmp/da16742	Wed Sep  9 14:51:37 1992
--- kern__physio.c	Tue Sep  8 19:03:09 1992
***************
*** 95,100 ****
--- 95,101 ----
  
  	/* create and build a buffer header for a transfer */
  	bp = (struct buf *)malloc(sizeof(*bp), M_TEMP, M_NOWAIT);
+ 	bzero((char *)bp, sizeof(*bp));
  	bp->b_flags = B_BUSY | B_PHYS | rw;
  	bp->b_proc = p;
  	bp->b_dev = dev;
***************
*** 120,126 ****
  			ftype = VM_PROT_READ | VM_PROT_WRITE;
  		else
  			ftype = VM_PROT_READ;
! 		for (adr = trunc_page(base) ; adr < base + bp->b_bcount;
  			adr += NBPG) {
  			vm_fault(&curproc->p_vmspace->vm_map,
  				adr, ftype, FALSE);
--- 121,127 ----
  			ftype = VM_PROT_READ | VM_PROT_WRITE;
  		else
  			ftype = VM_PROT_READ;
! 		for (adr = (caddr_t)trunc_page(base); adr < base + bp->b_bcount;
  			adr += NBPG) {
  			vm_fault(&curproc->p_vmspace->vm_map,
  				adr, ftype, FALSE);