[net.unix-wizards] Reading user structure from /dev/swap on 3B2

mb@abspc.UUCP (Michael E. Burg) (03/19/86)

Hi!
	I'm having problems trying to find how to read the user block
of a process when it's swapped to /dev/swap. I've tried using proc.p_swaddr
(Swap Address) and have try the following address in swap -

		ctod(proc.p_swaddr)*BSIZE		(BSIZE = 512)
		ctod(proc.p_swaddr)*1024
		ctob(proc.p_swaddr)*BSIZE
		ctob(proc.p_swaddr)*1024
		ctob(proc.p_swaddr)
		ctod(proc.p_swaddr)

	All the above produce junk. Any System V R2V2 experts have any ideas?

brent@poseidon.UUCP (Brent P. Callaghan) (03/24/86)

>	I'm having problems trying to find how to read the user block
>of a process when it's swapped to /dev/swap. I've tried using proc.p_swaddr
>(Swap Address) and have try the following address in swap -
>
>		ctod(proc.p_swaddr)*BSIZE		(BSIZE = 512)
>		ctod(proc.p_swaddr)*1024
>		ctob(proc.p_swaddr)*BSIZE
>		ctob(proc.p_swaddr)*1024
>		ctob(proc.p_swaddr)
>		ctod(proc.p_swaddr)
>
>	All the above produce junk. Any System V R2V2 experts have any ideas?
This works on a 3B2:

addr = (swplo + proc.p_swaddr + ctod(proc.p_size - proc.p_ssize - USIZE)) << BSHIFT ;
lseek(devswap, addr, 0) ;
read(devswap, (char *)&ublock, sizeof(ublock)) ;

Declare swplo as "daddr_t swplo ;" and gets it's value
from /dev/kmem ; It's value is often zero anyway.
-- 
				
Made in New Zealand -->		Brent Callaghan
				AT&T Information Systems, Lincroft, NJ
				{ihnp4|mtuxo|pegasus}!poseidon!brent
				(201) 576-3475