[net.unix-wizards] ps problem solved - more stupidity on our part

rcj@burl.UUCP (Curtis Jackson) (09/04/85)

The first reply to my HELP!! article gave me the answer -- many thanks
to dutoit!norman for his insight.  Although we changed the location of
the swap area in the config file, reconfig'd properly, and remade the
system properly; but it does help if you remove the old /dev/swap and
do a mknod for a new one with the new major and minor device numbers;
we were swapping onto a garbage area that used to hold news.

One question, though:  since we were swapping into the old swap area
because we forgot the mknod, just what does changing the 'swap' line
in the system definition file (config input) do?

Thanks to anyone whose reply is already on the way!
-- 

The MAD Programmer -- 919-228-3313 (Cornet 291)
alias: Curtis Jackson	...![ ihnp4 ulysses cbosgd mgnetp ]!burl!rcj
			...![ ihnp4 cbosgd akgua masscomp ]!clyde!rcj

dave@lsuc.UUCP (David Sherman) (09/06/85)

In article <845@burl.UUCP> rcj@burl.UUCP (Curtis Jackson) writes:
>The first reply to my HELP!! article gave me the answer -- many thanks
>to dutoit!norman for his insight.  Although we changed the location of
>the swap area in the config file, reconfig'd properly, and remade the
>system properly; but it does help if you remove the old /dev/swap and
>do a mknod for a new one with the new major and minor device numbers;
>we were swapping onto a garbage area that used to hold news.

No, you were swapping where you were supposed to be swapping.
It just that ps wasn't looking in the right place for the swapped
processes.

However, you shouldn't need to do a mknod. Just rm the previous /dev/swap
and ln from the appropriate device. You normally have disk devices in
/dev, already mknod'ed, with names something like /dev/msm0a, msm0b, msm0c,
and so on (those are ours, yours will depend on the name of your disk).
I just changed our swap area this morning on lsuc, and what I did was
	rm swap
	ln fuja swap
because the swap is now in the first partition of our new Fujitsu drive.

>One question, though:  since we were swapping into the old swap area
>because we forgot the mknod, just what does changing the 'swap' line
>in the system definition file (config input) do?

THAT is what determines where you swap. You never have to do a mknod
for swap if you don't want to, but ps needs it to see what's going on
out there. The kernel itself doesn't need a /dev/swap.

Oh, and by the way, you should make sure /dev/swap is mode
644 if ps is not setUID (although that leaves a small security
hole in that someone can look at your process while it's swapped out);
conversely there rest of /dev/msm0[a-g] or whatever should be mode
600 and owned by root, so people can't look at files through the
back door.

Dave Sherman
The Law Society of Upper Canada
Toronto
-- 
{  ihnp4!utzoo  pesnta  utcs  hcr  decvax!utcsri  }  !lsuc!dave

chris@umcp-cs.UUCP (Chris Torek) (09/10/85)

Actually, ``ps'' and other kernel-grubbers should generally be
setgid (not setuid) to a special group that can read the appropriate
files.

I have a question, though: is SysV's /dev/swap somehow different
from 4.xBSD's /dev/drum?  If not, the suggestion given here
(approximately ``ln /dev/fuji /dev/swap'') won't work.

Under 4BSD, /dev/drum is a ``magic'' raw disk device that gives
access to all swap areas, no matter what or where they are.
Internally only, there is also a fake block device.  I quote from
the bottom of /sys/vax/conf.c:

	/*
	 * Swapdev is a fake device implemented
	 * in sw.c used only internally to get to swstrategy.
	 * It cannot be provided to the users, because the
	 * swstrategy routine munches the b_dev and b_blkno entries
	 * before calling the appropriate driver.  This would horribly
	 * confuse, e.g. the hashing routines. Instead, /dev/drum is
	 * provided as a character (raw) device.
	 */

This actually seems like a cleaner way to implement user I/O to
the swap areas, as one need do nothing other than reconfigure the
kernel and edit /etc/fstab to change the swap and paging configuration.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland