SUN-Spots Digest, v4n4

Scott Alexander Sun-Spots-Request at RICE.EDU
Sun Feb 9 09:03:13 AEST 1986


SUN-SPOTS DIGEST             Saturday, 8 Feb 1986            Volume 4 : Issue 4

Today's Topics:
			     managing swap space.
			  monitor scanning problems.
			 Sun 100 video problem fixed
			    Re: How to beep a Sun
		       Inverting a single shelltool (2)
				  refer bug
		 Run-Time Loadable Device Drivers for Sun 2.X
			Re: Anti-glare screen for Sun
	       Announcement - Miranda system available for SUN
			  Sun 3 as VAX replacement.
			      LEDs on SUN-2/50 ?
		       Question about SUN/VAX/Ethernet.
				vfont format.
				Cheap SCSI's??
				Thin Ethernet
				3/50 vs. 3/75
	  Can a SUN (with binary license) speak anything but TCP/IP?
			    printers and the such
				Xylogics 451?
		    Fixes for rwhod in an NFS environment
------------------------------------------------------------------------

Date: Sat, 8 Feb 86 02:22:50 est
From: mark at maryland.arpa (Mark Weiser )
Subject: managing swap space.

I find on my suns that paging space is a critical resource.  Back when
I had a 40M disk, and only 8M swap partition, I learned to tiptoe
through the emacs's.  Now, with an 80M disk and a 16M swap partition,
things are better, but I still run out.  The problem is not real memory
(I have 4M) because there is not that much active paging going on, and
anyway adding real memory would not increase the available virtual
process space.  The problem is the number of things I want to keep
semi-active (iconic).  I added a new option to perfmeter to plot "max
allocable process size" (as returned by pstat -s, for instance), and
have noticed some interesting things.  These are not sophisticated
observations, just helpful hints for others who have particularly
cluttered desktops like me.

The main lesson is, it matters how things are started up.  I have
played around with the order of startup in my .suntools, and gained
about 4M of available swap area.  The idea is that one can somehow
avoid fractionation (the pstat -s 'wasted' statistic) with certain
startup orders better than with others.  I just worked trial and
error.  There is probably a better way but I don't know it.  My current
order starts all the perfmeters at the front together, and all the
rlogined shelltools at the end.  The opposite order is 4M worse.
Probably an accident of disk organization.

A second lesson is, things get worse as you stay in suntools.  After
several days in the same suntools, killing and recreating things (often
things that were originally created from suntools, but died and had to
be recreated), the available process space was much less, by 2-3M.
Exiting suntools and starting it up again got the space back.  This is
probably just a special case of the main lesson above, and again I
think it is just an accident of disk organization.
-mark
-------
Spoken: Mark Weiser 	ARPA:	mark at maryland	Phone: +1-301-454-7817
CSNet:	mark at umcp-cs 	UUCP:	{seismo,allegra}!umcp-cs!mark
USPS: Computer Science Dept., University of Maryland, College Park, MD 20742

-----------------------------

Date: Mon, 27 Jan 86 19:57:01 est
From: mark at markssun.cs.umd.edu (Mark Weiser)
Subject: monitor scanning problems.

Thanks to everyone who told me to just take the monitor apart, the
horizontal and vertical size pots were easy to find.  They were, but
set very badly.  Never could get the horizontal inductor rotated far
enough for full screen scan.  A little vertical positioning tweaking
was needed as well as lots of vertial size.  It was easy, but I don't
recommend to anyone that their first CRT tweaking be done on their
Sun.  This was not my first CRT by a long shot.

My screen looks well at last!  
-mark

P.S. No one mentioned to me the glue on the pots.  Is this 'void the
warrantee' glue, I wonder, or just 'survive shipping' glue?

-----------------------------

Date: Mon 27 Jan 86 17:57:25-PST
From: Mark Murray <MKM at WASHINGTON.ARPA>
Subject: Sun 100 video problem fixed

We have a number of Sun Microsystems workstations with the model
M17P114H/2101 Philips monitor, better known as the old Model 100U, and
several of these units have been exibiting the following symptoms of
video circuitry malfunctions.

Within the top inch of the display, horizontal lines extending the
width of the raster wipe out video information to the extent that the
unit is extremely difficult to use.

Several weeks ago I replaced the following components on the video
deflection board of one of our units, and the problem has not
reappeared, although a minor side effect has been a very slight warp
in the shape of the raster.

1.  C413	2.2uF, 100V, AL Electrolytic
2.  CR406	BY208/600.  Replaced with ECG 558.
3.  R541	31 ohm, 1/2 W resistor
4.  Q403	MJE 182 NPN transistor
5.  Q404	MJE 172 PNP     "

On item 1, if you can find these at a 105 degree C rating, as opposed
to the 85 degree C rating (the original design), you should get
them.  I was only able to locate the latter.

On item 2, I was told that this diode is no longer in production by
its original mfr, Amperex, so I crossed it with the Sylvania ECG 558.
It may be possible to find other sources.

Keep in mind that  a)  some of these parts are hard to find, and
b)  you may run into minimum order requirements. 

We are also considering installing a small fan to draw heat away from the
video board.

-----------------------------

Date: Tue, 28 Jan 86 05:22:52 EST
From: Chris Torek <chris at mimsy.umd.edu>
Subject: Re: How to beep a Sun

Sun 3.0 SunView does it right.

In 3.0 you can tell SunView to beep, flash, or both.  (Not neither?
though that would hardly be useful.)  Thanks to Guy Harris and
David DiGiacomo for pointing this out.  (We do not have 3.0 here
at Maryland yet.)

Chris

-----------------------------

Date: Tue, 28 Jan 86 10:48:20 pst
From: texsun!sun!swagman!swagman at sun.UUCP (Patrick J. McEvoy)
Subject: Inverting a single shelltool

To invert a shelltool, try the following:

	shelltool -Wf 255 255 255 -Wb 0 0 0 -Wg &

This works fine on a monochrome as well as on a color.  The '-Wg' forces
the color change to carry through to the subwindows.

The problem now arises that the mouse is invisible in the inverted window.
Add the following code to shelltool.c, just above tool_select():

	{
        struct cursor   cursor;

        cursor.cur_shape = mem_create(16, 16, 1);

        win_getcursor(tool->tl_windowfd, &cursor);
        cursor.cur_function = PIX_SRC^PIX_DST;
        win_setcursor(tool->tl_windowfd, &cursor);
        win_getcursor(tsw->ts_windowfd, &cursor);
        cursor.cur_function = PIX_SRC^PIX_DST;
        win_setcursor(tsw->ts_windowfd, &cursor);
        }

PIX_SRC^PIX_DST works fine whether or not the window is inverted.  ~PIX_SRC
won't do what you want, since the stenciling gets screwed up.  The menus look
a little funny, since they are still in sync with the rest of suntools.

-----------------------------

Date: 27-Jan-86 15:21:05-PST
From: gerolima at FORD-WDL1
Subject: Inverting a single shelltool


Someone asked how to invert a single monochrome window. To do this, you
do have to use the -Wb and -Wf flags, but also the -Wg (apply to sub-
windows... long form is -set_default_color) flag.
ie:

	shelltool -Wl "4.2 > 5" -Wf 1 1 1  -Wb 0 0 0 -Wg /bin/csh

Will make an inverted cshell window. (Actually, since you only have two
colors, all non-zero numbers have the same effect)

"Okay, Bud, why the -Wg flag?" you ask. On a color Sun, you may want
to have pleasant pastel-colored window borders (so your Sun will look
like those HORRIBLE trendy Sun portfolios...whoever heard of a workstation
in an adobe hut?!?!?!), but keep the traditional black-and-white windows.

NOTE: because SHELLTOOL does not use an XOR'd cursor, and the cursor will
be the same color as the inverted window, it WILL GET LOST in said window...


		Can somebody please pass the Coppertonetool?


"Eeez next...		Mark Gerolimatos
SOFTVARE!....		ARPA: gerolima at ford-wdl1.arpa
verrrry niiice..."	UUCP: {sun,fortune}!wdl1!gerolima

-----------------------------

Date: Thu, 30 Jan 86 17:04:33 est
From: mark at markssun.cs.umd.edu (Mark Weiser)
Subject: refer bug

I recently ran into several problems with 'refer' under Sun 2.0 (might
have been there earlier, I don't know).  The problem basically is that
under a number of reasonable circumstances the '-s' option in refer
gives strange results.  I have told Sun, and also sent them a
workaround which is not for everyone: a one line bug fix (darn zero
pointer dereference) to the 4.3bsd Unix sources enables those sources
to compile and work and fix the problem on suns.

The strange results by the way are 1. a not quite completely sorted
list 2. occasional reference number [0] in the text instead of the
correct number 3. other incorrect reference numbers in the text.  This
does not always show up with small numbers of references, but I have a
really small shar (three references) file that seems to be diagnostic
of the problem if anyone wants it (I sent it to sun).

Thought I'd warn you all before it drives you crazy like it almost did me.
-mark
Spoken: Mark Weiser 	ARPA:	mark at maryland	Phone: +1-301-454-7817
CSNet:	mark at umcp-cs 	UUCP:	{seismo,allegra}!umcp-cs!mark
USPS: Computer Science Dept., University of Maryland, College Park, MD 20742

-----------------------------

From: trwrb!trwspp!spp2!hasiuk at ucbvax.berkeley.edu (Lee Hasiuk)
Date:  3 Feb 1986 0019-PST (Monday)
Subject: Run-Time Loadable Device Drivers for Sun 2.X


I have a package available that will enable users of Sun Workstations to
develop and test new device drivers without having to constantly link
and reboot their kernel.  The package consists of two basic parts:

1) A device driver template, which is linked into the kernel once for the
   device driver to be developed.  It contains a large array into which
   device driver code may be loaded and run, and a jump table which
   contains the addresses of the device specific routines (read, write, etc)
   in the array.

2) A user program which correctly links a drivers '.o' file for the currently
   running kernel, loads the result into the large array (through /dev/kmem)
   and fills in the jump table.

This package can save you hours and hours during the development of your
device drivers, and encourages you to make improvements that you normally
wouldn't, simply because you don't want go through another relink-reboot
phase.  Don't write another driver without it!  Write for your free copy
today!  (Also posted to net.sources, if your site happens to get it.)

Lee Hasiuk
{decvax, ihnp4, ucbvax}!trwrb!trwspp!spp2!hasiuk

-----------------------------

Date: Mon, 3 Feb 86 14:43:50 pst
From: SUG Mailing Administrator <sma at lll-lcc>

ATTENTION SUN USERS! 

During our current membership drive, we are offering you a FREE 
INTRODUCTORY SUN USER GROUP membership through June 30, 1986.

           ** Increase your communication with other Sun users.

           ** Have an official channel of communication to Sun
              Microsystems, Inc.

           ** Get involved with one or several of our standing committees
              including the Technical Committee,
              Donated Software Tape Committee and OEM Council.
 
           ** Keep current with our quarterly newsletter which features
              articles by your colleagues in the Sun community and
              informs you of upcoming Sun User Group events.

           ** Purchase our unsupported donated software tape, 
              available ONLY to Sun User Group members.  It includes valuable
              editors, routines and utilities.

           ** Get involved with the local chapter of your Sun community.
              Start your own chapter if there isn't one near you- we'll help!

           
Our goal is for these services to prove so valuable this Spring that
you will choose to renew your membership in June.  There are NO STRINGS
ATTACHED to the free membership.

Send us your (and your colleagues') name, company, address, phone number,
and electronic mail address by MARCH 31, 1986.

By return mail you will receive a new member packet including 
our newsletter, local chapter details, and the software tape
information.

GET INVOLVED-- JOIN THE SUN USER GROUP TODAY!

-----------------------------

From: fluke!jeff at uw-beaver.arpa
Date: Thu, 30 Jan 86 14:42:11 pst
Subject: Re: Anti-glare screen for Sun
Organization: John Fluke Mfg. Co., Inc., Everett, WA

We use SUNFLEX mesh filters on our model 120's and 50's; they are a
considerable improvement over the naked tube.  The model 50 on which I
am typing the reply has a SUNFLEX conductive mesh filter #T 191-CD90.
Price is roughly $88.  (So far as I know, SUNFLEX has no connection
whatsoever with Sun Microsystems.)

Be sure to:
   - Order the finest mesh available.  A simple side-by-side comparison
     will illustrate the differences.
   - Use a CONDUCTIVE mesh with a drain wire.  You don't want static
     electricity sucking dust and cigarette smoke into the mesh.

It's important to hold the mesh tightly against the crt face.  We attach a
ring of adhesive foam weatherstripping to the inside of the bezel, then
sandwich the mesh between bezel and crt face.  With this method you can get
every square inch of the mesh screen to touch the crt faceplate.

By the way, have you noticed that Sun has finally reintroduced the OCLI
coating option?

    Jeff Stearns	John Fluke Mfg. Co, Inc.	(206) 356-5064
    {uw-beaver, decvax!microsoft, ucbvax!lbl-csam, allegra, sun}!fluke!jeff

-----------------------------

Date: Sat, 1 Feb 86 0:58:48 GMT
From: dat%ukc.ac.uk at cs.ucl.ac.uk
Subject: Announcement - Miranda system available for SUN

	MIRANDA  -  PRODUCT ANNOUNCEMENT
	--------------------------------

This  is  to  inform  anyone  who  may  be  interested   that   a   UNIX
implementation  of  the  Miranda  functional  programming  system is now
available for the following machines: VAX (under 4.2  BSD),  ORION,  and
SUN  workstations.  It will be ported to a number of other UNIX machines
in the  near  future.   The  rest  of  this  message  contains  a  brief
description  of the Miranda system, followed by information about how to
obtain it.

 What is Miranda?
 ----------------

Miranda is an advanced functional programming language designed by David
Turner  of the University of Kent.  It is based on the earlier languages
SASL, KRC and ML.  A program in Miranda is a set of equations describing
the  functions  and  data  structures  which the user wishes to compute.
Programs written in Miranda are typically ten to  twenty  times  shorter
than  the equivalent programs in a conventional high level language such
as PASCAL.  The main features of Miranda are:
	1) Purely functional - no side effects
	2) Higher order - functions can be treated as values
	3) Infinite data structures can be described and used
	4) Concise notation for sets and sequences ("zf expressions")
	5) Polymorphic strong typing
The basic  types  of  the  language  are  numbers  (integer  and  double
precision  floating  point),  characters,  booleans,  lists, tuples, and
functions.  In addition a rich variety  of  user-defined  types  may  be
introduced by writing appropriate equations.  A more detailed discussion
of the language may  be  found  in  "Miranda:  a  non-strict  functional
language  with polymorphic types", in Springer Lecture Notes in Computer
Science, vol 201.

The Miranda system is a self contained sub-system, running  under  UNIX.
The Miranda compiler works in conjunction with a screen editor (normally
this is `vi', but it is easy to arrange for this to be another editor if
preferred).  Programs are automatically recompiled in response to source
edits and any syntax or type errors  signalled  immediately.   The  type
system  enables  a  high proportion of semantic errors to be detected at
compile time.  There is an online reference manual, which documents  the
system at a level appropriate for someone already familiar with the main
ideas  of  functional  programming  (more  tutorial   material   is   in
preparation).  Execution is by a fast interpreter, using an intermediate
code based on combinatory logic.

The Miranda system is a powerful tool, enabling complex applications  to
be  developed  in  a  fraction  of  the  time required in a conventional
programming system.  Applications which have been developed  in  Miranda
include  -  compilers,  theorem provers, and digital circuit simulation.
It is envisaged that the main uses of Miranda will be:
	1) Teaching the concepts of functional programming
	2) Rapid prototyping
	3) As a specification language
	4) For further research into functional programming
	5) As a general purpose programming language

 Release Information
 -------------------

The Miranda system has been developed by Research Software Ltd.   It  is
distributed  in  object  code  form  and  is currently available for the
following machines - VAX (under 4.2BSD), ORION, SUN 2, SUN 3.

The license fee, per cpu, is 300 pounds for an educational  license  and
975   pounds   for   a  commercial  license  (US  prices:  $450,  $1450,
respectively).  If you think you may be interested in obtaining  a  copy
of  the Miranda system please send your name and (postal) address to the
following  electronic  mail  address,  and  you  will  be  sent  further
information and a copy of the license form etc:
		USENET:  ...!mcvax!ukc!mira-request
		JANET:   mira-request at ukc.ac.uk
		ARPANET: mira-request%ukc at ucl-cs
Or  telephone Research Software on: +44 227 471844

If you are interested in obtaining Miranda on a different machine, or  a
different  version  of  Unix,  from those listed above, it is also worth
mailing details of your situation, since future porting policy  will  be
largely  determined  by  perceived  demand.   ((NB  - UNIX systems only,
please.))

-----------------------------

From: John Lee <mcvax!edcaad.ed.ac.uk!john at seismo.css.gov>
Date: Wed, 5 Feb 86 20:51:46 GMT
Subject: Sun 3 as VAX replacement.


Can anyone out there tell us how a Sun 3 will *really* perform as a 
replacement for a VAX?
We have in mind this configuration: Sun 3 (75?)  as fileserver for a
network (Ethernet) containing two diskless Sun 350s.  The large Sun will
also have to service a multiplexer with 16 serial ports, and very likely
the serial ports on the diskless suns will have to be used as well.
How well will this perform?
We know that in CPU terms a Sun massively outperforms the VAX
(especially since we only have a 750!)  - but how well will those in the
system described perform, handling that volume of communication traffic?
Any other information that you think might be helpful to us will also
be appreciated.
Thanks.

John Lee.

-----------------------------

Date:     Mon, 27 Jan 86 20:15:28 EST
From: Mike Muuss <mike at BRL.ARPA>
Subject:  LEDs on SUN-2/50 ?

On the back of a SUN-2/50, there are 8 LEDs.  The manual indicates that
these have meaning during power-on self-test ("Unpacking and Setting
up the Sun-2/50, Revision A of 19 November 1984", pages 1-10..1-12).
However, during normal UNIX operation, the lights seem to be correlated
with network and/or CPU use.  Can anybody tell me what they mean?
For a few more weeks, we are running SUN 1.4, and then will switch
to 2.0, so if the answer depends on version, how about both?
	Thanks,
	 -Mike Muuss

uucp:  decvax!brl-bmd!mike

-----------------------------

Date: Fri, 31 Jan 86 15:39:56 -0100
From: mcvax!diku!nordita!ohn at seismo.CSS.GOV (Ole Holm Nielsen)
Subject: Question about SUN/VAX/Ethernet.


Question about networking SUN's to VAX/VMS
------------------------------------------

We have a SUN-1 and a SUN-2 connected via an Ethernet.   Our
institute has acquired a VAX 8600 which will drive terminals
etc.  via a DEC-supplied Ethernet.  Of course we desire con-
necting  our  SUNs  to  the VAX which is running VMS, and we
have ordered TCP/IP software from  Wollongong  (supplied  by
GEC in the UK).
 
Our current problem concerns  the  Ethernets.   DEC  doesn't
want  any  other vendor's Ethernet to become part of theirs.
I was optimistically thinking that the SUN net could  become
a  section  of  the DEC one.  Therefore I have two questions
for you:

1.   Do you know anyone who has  successfully  combined  the
     SUN  Ethernet  (using  3COM  boxes) with a DEC Ethernet
     (using H-4000 connectors).

2.   Do you know anyone who has SUNs running on a DEC Ether-
     net, i.e. with the SUN transceiver cable being attached
     to a DEC H-4000 or DELNI.

Any further comments or advice will be much appreciated !

With greetings,
Ole H. Nielsen
Nordic Institute of Theoretical Physics, Copenhagen.
ohn at nordita.uucp

[We have two ethernets connected by a Xerox repeater.  On one side that
repeater is connected to a 3com xcvr.  All of our other xcvrs are either DEC
or TCL (Xerox).  We have Suns connected to delnis and (I think) to h-4000s.
To do that, you need to play with a jumper or some such.  I'll try to get
the person who does that here to write a description of the process for the
next copy of sun-spots.  ---dsa]

-----------------------------

Date: Tue, 4 Feb 86 00:41:46 est
From: mark at mimsy.umd.edu (Mark Weiser )
Subject: vfont format.

4.2bsd came with a huge directory called /usr/lib/vfont.  When I
try to use the fonts in here on my sun (i.e. look at them with fonttool),
I get the message that they are not in vfont format.  Is this a byte-order
problem, or did vfont format change?
-mark

[By 4.2bsd, I assume you mean the VAX version.  Talking to the people here
who have played with vfonts I found that to move the fonts you need to byte
swap the shorts in the header of the file and to pad the rows to word rather
than byte boundaries.  ---dsa]

-----------------------------

Date: Tue, 4 Feb 86 00:01:37 est
From: Ken Mandelberg <km%emory.csnet at CSNET-RELAY.ARPA>
Subject: Cheap SCSI's??

There seem to be a lot of very cheap self contained SCSI
boxes being released for the Macintosh. I think I recall seeing
some 20 Meg boxes for about $1000. Does anyone have any thoughts
on how hard it would be to adapt them to the diskless Sun 3/50
which has a built in SCSI interface?

-----------------------------

Date: Mon, 3 Feb 86 23:54:10 est
From: Ken Mandelberg <km%emory.csnet at CSNET-RELAY.ARPA>
Subject: Thin Ethernet

The installation doc for the Sun 3/50 gives the following
spec for thin ethernet cabling:

MAX contiguous length of coaxial segments  200 meters
MAX length of Thin Ethernet network        380 meters

I guess I don't understand the definitions. Suppose I have
one ethernet consisting of a combination of thin ethernet,
fat ethernet, Sun 3/50s (with built in thin ethernet transceiver),
and conventional ethernet transceivers; but no repeaters. Am I
bound by the total length of 200?

-----------------------------

Date: Wed, 5 Feb 86 00:15:58 est
From: mark at markssun.cs.umd.edu (Mark Weiser)
Subject: 3/50 vs. 3/75

The only difference between the 3/50 and 3/75 seems to be 15Mhz
vs. 16.67Mhz clock rate, and $10,000.  Is it worth the price, or should
those of us who have ordered the 75 start tearing our hair out now?
-mark

-----------------------------

Date: Thu, 6 Feb 86 16:02:09 -0100
From: mcvax!diku!daimi!pederch at seismo.CSS.GOV (Peder Chr. N|rgaard)
Subject: Can a SUN (with binary license) speak anything but TCP/IP?

The problem: We have an Ethernet with several SUNs and other 4.2 bsd stuff,
as well as other computers speaking a Babylon of different protocols. We
wish the SUNs to be able to speak some of the other protocols on a low level.

More precisely, we ask for documentation on some kind of device which can
be opened with a protocol type, ready for receiving and sending hard Ether-
net packets. Of course we will not open the device on protocol types 0x0800
(TCP/IP), 0x0806 (Address Resolution Protocol) and 0x8035 (Reverse ARP).
That would surely cause the operating system to break. But it would be nice
to be able to do other kinds of networking, specifically some XNS and ISOs.

Thank you in advance.		Peder Chr. N|rgaard
				University of Aarhus, Denmark.
				UUCP: ..seismo!mcvax!diku!daimi!pederh

-----------------------------

From: lmatthe at NSWC-OAS.ARPA  Thu Feb  6 13:52:12 1986
Date: Thu, 6 Feb 86 14:45:09 EST
From: lmatthe at NSWC-OAS.ARPA
Subject: printers and the such

It has come time for me to add a printer(s) to my Sun 2 system. I need a laser
writer for high quality printouts, where speed is not really a factor.  I am,
however, a software developer, and in some cases my printouts are as large as
600+ pages.   I also like fanfold paper on days when I am feeling clumsy.

I figure the laser printer will not be that difficult a problem to satisfy.
But where do I get the high speed 80-132 column paper printer from? And
once I've got it, is it going to suck my system down with interrupts to the
serial tty driver?  Can I get high speed, wide column, fan-fold and DMA all 
at the same time?

				Laura Matthews

-----------------------------

Organization: The MITRE Corp., Bedford, MA
Date: Wed, 29 Jan 86 17:56:09 est
From: Sid Stuart <sid%linus at mitre-bedford.ARPA>
Subject: Xylogics 451?


	I would like to try Xylogic's new disk controller board, the 451,
in my 2/170. The board is supposed to be able to handle the new class
of disk drives that have come on the market in the last year, like the
replacement for the Eagle that has around 650 meg of storage. (I never
can remember the numbers on these things.) Since the
new drive costs me $10,250 and I am currently getting the 400 meg Eagle for 
$9,500, I have quite an incentive. My questions are, has any 
brave soul tried the 451 on their Sun yet and did it work?

	If no one has tried the thing, I am willing to give it a shot
anyway. We have a source code licence in case we need to mess with the
driver and my dealer will give me a money back guarentee. I would like
any advice that people have to give though.


					sid at linus

-----------------------------

Date: Fri, 31 Jan 86 17:54:30 cst
From: knutson at ngp.UTEXAS.EDU (Jim Knutson)
Subject: Fixes for rwhod in an NFS environment

We have 10 clients spread around on one of our servers here at UT and
have found rwhod useful for keeping track of which machine is up.
Unfortunately there are approximately 40 other machines on the same
network.  With all the clients trying to update their rwho database at
the same time our poor server was brought to its knees.

To remedy the situation, we took the rwhod code from a bsd distribution
and modified it to allow for broadcast only.  With each client running
a broadcast-only rwhod and the server running a "listening" rwhod, disk
accesses are kept to a minimum.  That leaves only exporting the
server's rwho spool area via NFS to the clients to complete the fix.

The mods also fix a problem with DEBUG defines used in testing.
Someone apparently had descided that using your own version of sendto()
when debugging was a good way to display the packet information from
rwhod.  However, with yellow pages, gethostbyname(), getservbyname(),
etc. use sendto().  The fix is to not use a local routine named
sendto().

Below is a context diff of the bsd code for rwhod.c.  Hopefully Sun
will get the hint and fix this.  Enjoy

*** rwhod.c.old	Fri Jan 31 15:47:55 1986
--- rwhod.c	Fri Jan 31 16:43:23 1986
***************
*** 2,8
  static char sccsid[] = "@(#)rwhod.c	4.19 (Berkeley) 83/07/01";
  #endif
  
! #include <sys/types.h>
  #include <sys/socket.h>
  #include <sys/stat.h>
  #include <sys/ioctl.h>

--- 2,8 -----
  static char sccsid[] = "@(#)rwhod.c	4.19 (Berkeley) 83/07/01";
  #endif
  
! #include <sys/param.h>
  #include <sys/socket.h>
  #include <sys/stat.h>
  #include <sys/ioctl.h>
***************
*** 52,57
  struct	whod mywd;
  struct	servent *sp;
  int	s, utmpf, kmemf = -1;
  
  #define	WHDRSIZE	(sizeof (mywd) - sizeof (mywd.wd_we))
  #define	RWHODIR		"/usr/spool/rwho"

--- 52,58 -----
  struct	whod mywd;
  struct	servent *sp;
  int	s, utmpf, kmemf = -1;
+ int     nolisten = 0;
  
  #ifdef DEBUG
  #define sendto          send_to
***************
*** 53,58
  struct	servent *sp;
  int	s, utmpf, kmemf = -1;
  
  #define	WHDRSIZE	(sizeof (mywd) - sizeof (mywd.wd_we))
  #define	RWHODIR		"/usr/spool/rwho"
  

--- 54,62 -----
  int	s, utmpf, kmemf = -1;
  int     nolisten = 0;
  
+ #ifdef DEBUG
+ #define sendto          send_to
+ #endif
  #define	WHDRSIZE	(sizeof (mywd) - sizeof (mywd.wd_we))
  #define	RWHODIR		"/usr/spool/rwho"
  
***************
*** 62,68
  int	getkmem();
  struct	in_addr inet_makeaddr();
  
! main()
  {
  	struct sockaddr_in from;
  	char path[64];

--- 66,74 -----
  int	getkmem();
  struct	in_addr inet_makeaddr();
  
! main(argc,argv)
! int argc;
! char **argv;
  {
  	struct sockaddr_in from;
  	char path[64];
***************
*** 69,74
  	int addr;
  	struct hostent *hp;
  
  	sp = getservbyname("who", "udp");
  	if (sp == 0) {
  		fprintf(stderr, "rwhod: udp/who: unknown service\n");

--- 75,88 -----
  	int addr;
  	struct hostent *hp;
  
+ 	if (argc > 1) {
+ 		if (!strcmp(*(++argv),"-b"))	/* Broadcast only mode ? */
+ 			nolisten++;
+ 		else {
+ 			fprintf(stderr,"unknown parameter %s\n",*argv);
+ 			exit(1);
+ 		}
+ 	}
  	sp = getservbyname("who", "udp");
  	if (sp == 0) {
  		fprintf(stderr, "rwhod: udp/who: unknown service\n");
***************
*** 137,142
  		struct whod wd;
  		int cc, whod, len = sizeof (from);
  
  		cc = recvfrom(s, (char *)&wd, sizeof (struct whod), 0,
  			&from, &len);
  		if (cc <= 0) {

--- 151,162 -----
  		struct whod wd;
  		int cc, whod, len = sizeof (from);
  
+ 		if (nolisten) {
+ 			sleep(60);
+ 			onalrm();
+ 			continue;
+ 		}
+ 
  		cc = recvfrom(s, (char *)&wd, sizeof (struct whod), 0,
  		        &from, &len);
  		if (cc <= 0) {
***************
*** 138,144
  		int cc, whod, len = sizeof (from);
  
  		cc = recvfrom(s, (char *)&wd, sizeof (struct whod), 0,
! 			&from, &len);
  		if (cc <= 0) {
  			if (cc < 0 && errno != EINTR)
  				perror("rwhod: recv");

--- 158,164 -----
  		}
  
  		cc = recvfrom(s, (char *)&wd, sizeof (struct whod), 0,
! 		        &from, &len);
  		if (cc <= 0) {
  			if (cc < 0 && errno != EINTR)
  				perror("rwhod: recv");
***************
*** 226,231
  	struct stat stb;
  	register struct whoent *we = mywd.wd_we, *wlast;
  	int cc;
  	double avenrun[3];
  	time_t now = time(0);
  	register struct neighbor *np;

--- 246,254 -----
  	struct stat stb;
  	register struct whoent *we = mywd.wd_we, *wlast;
  	int cc;
+ #ifdef sun
+ 	long avenrun[3];
+ #else
  	double avenrun[3];
  #endif
  	time_t now = time(0);
***************
*** 227,232
  	register struct whoent *we = mywd.wd_we, *wlast;
  	int cc;
  	double avenrun[3];
  	time_t now = time(0);
  	register struct neighbor *np;
  

--- 250,256 -----
  	long avenrun[3];
  #else
  	double avenrun[3];
+ #endif
  	time_t now = time(0);
  	register struct neighbor *np;
  
***************
*** 265,270
  	(void) lseek(kmemf, (long)nl[NL_AVENRUN].n_value, L_SET);
  	(void) read(kmemf, (char *)avenrun, sizeof (avenrun));
  	for (i = 0; i < 3; i++)
  		mywd.wd_loadav[i] = htonl((u_long)(avenrun[i] * 100));
  	cc = (char *)we - (char *)&mywd;
  	mywd.wd_sendtime = htonl(time(0));

--- 289,297 -----
  	(void) lseek(kmemf, (long)nl[NL_AVENRUN].n_value, L_SET);
  	(void) read(kmemf, (char *)avenrun, sizeof (avenrun));
  	for (i = 0; i < 3; i++)
+ #ifdef sun
+ 		mywd.wd_loadav[i] = htonl((u_long)(((double)avenrun[i]/FSCALE) * 100));
+ #else
  		mywd.wd_loadav[i] = htonl((u_long)(avenrun[i] * 100));
  #endif
  	cc = (char *)we - (char *)&mywd;
***************
*** 266,271
  	(void) read(kmemf, (char *)avenrun, sizeof (avenrun));
  	for (i = 0; i < 3; i++)
  		mywd.wd_loadav[i] = htonl((u_long)(avenrun[i] * 100));
  	cc = (char *)we - (char *)&mywd;
  	mywd.wd_sendtime = htonl(time(0));
  	mywd.wd_vers = WHODVERSION;

--- 293,299 -----
  		mywd.wd_loadav[i] = htonl((u_long)(((double)avenrun[i]/FSCALE) * 100));
  #else
  		mywd.wd_loadav[i] = htonl((u_long)(avenrun[i] * 100));
+ #endif
  	cc = (char *)we - (char *)&mywd;
  	mywd.wd_sendtime = htonl(time(0));
  	mywd.wd_vers = WHODVERSION;
***************
*** 274,280
  		(void) sendto(s, (char *)&mywd, cc, 0,
  			np->n_addr, np->n_addrlen);
  done:
! 	(void) alarm(60);
  }
  
  getkmem()

--- 302,309 -----
  		(void) sendto(s, (char *)&mywd, cc, 0,
  			np->n_addr, np->n_addrlen);
  done:
! 	if (!nolisten)
! 		(void) alarm(60);
  }
  
  getkmem()
***************
*** 388,394
  }
  
  #ifdef DEBUG
! sendto(s, buf, cc, flags, to, tolen)
  	int s;
  	char *buf;
  	int cc, flags;

--- 417,423 -----
  }
  
  #ifdef DEBUG
! send_to(s, buf, cc, flags, to, tolen)
  	int s;
  	char *buf;
  	int cc, flags;

Jim Knutson
ARPA: knutson at ngp.UTEXAS.EDU
UUCP: {ihnp4,seismo,kpno,ctvax}!ut-sally!ut-ngp!knutson
Phone: (512) 471-3241

-----------------------------

End of SUN-Spots Digest
***********************



More information about the Mod.computers.sun mailing list