Sun-Spots Digest, v6n72

William LeFebvre Sun-Spots-Request at RICE.EDU
Thu May 5 01:53:22 AEST 1988


SUN-SPOTS DIGEST           Tuesday, 3 May 1988         Volume 6 : Issue 72

Today's Topics:
                    Re: Sun 3/50 clock keeps resetting
                 Re: Symbolic Link Superceding Path Name
                Symbolic links (and other problems) in pwd
                 dynamic changing of suntools backgrounds
                          Query SunCore zbuffer
                 Questions: ESDI disks in old 3/160; APL
              Non-printing use of "lpr" queueing mechanism? 
                     multiuser performance on 3/60S?
                    converting a rasterfile to an icon

Send contributions to:  sun-spots at rice.edu
Send subscription add/delete requests to:  sun-spots-request at rice.edu
Bitnet readers can subscribe directly with the CMS command:
    TELL LISTSERV AT RICE SUBSCRIBE SUNSPOTS My Full Name
Recent backissues are available via anonymous FTP from "titan.rice.edu".
For volume X, issue Y, "get sun-spots/vXnY".  They are also accessible
through the archive server:  mail the request "send sun-spots vXnY" to
"archive-server at rice.edu" or mail the word "help" to the same address
for more information.

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

Date:    26 Apr 88 03:28:43 GMT
From:    Peter Marshall <peter at julian.uucp>
Subject: Re: Sun 3/50 clock keeps resetting

In article <1988.04.18.11.09.47.569.05715 at rice.edu> Sun-Spots at rice.edu writes:
>From:    ndmath!ndcheg!evan at iuvax.cs.indiana.edu (Evan Bauman)
>
>We've had a Sun 3/50 for just about a year, and lately, when we reboot we
>get a message that the clock has lost 29 days.  It also says to please
>check the clock and reset.

I have this same problem on a Sun 3/60 machine also running 3.5.  We got
two machines at the same time and only one displays this problem.  I
reported it to Sun (Canada) and they said that they would e-mail me the
appropriate patches.  I have not seen them yet.

The person that I talked to said that it was a problem that occurred
seemingly at random.  Since it is 29 days, it is probably somehow related
to this year being a leap year.

I'll send in a copy of the patches when they arrive.-- 
Peter Marshall, Data Comm. Manager
CCS, U. of Western Ontario, London, Canada N6A 5B7
(519)661-2151x6032 
pm at uwovax.BITNET; peter at julian.uucp; peter.marshall at uwo.ca

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

Date:    Tue, 26 Apr 88 01:16:58 EDT
From:    dan at wind.bellcore.com (Daniel R. Strick)
Subject: Re: Symbolic Link Superceding Path Name

A symbolic link can be used to change the meaning of a fixed file name
(e.g. /usr/appl_dir), but it still requires the host system to support the
fixed file name.  This can be rather painful if you don't have the
privilege needed to create the desired system entry or it conflicts with
established system administration policy.  This is not uncommon on large
systems.  Here are several conceivable system administrator reactions:

	"That is John Appl_dir's home directory.  He was here first.
	 Sorry, but you will have to pick another file name."

	"Nothing can be added to a system directory without the approval
	 of the Computer Center Committee on System File Structures.
	 The committee meets every six months.  The last meeting was
	 held last week."

	"Your $50,000 software package requires a special sorting program
	 called "/bin/ls"?  It must be setuid root? ... Excuse me for
	 a moment.  I seem to have misplaced by aspirin."

I have seen software packages that attempt to circumvent some of these
difficulties by living in the home directory of a pseudo user and reading
the home directory directly out of the password file.  This tends to
create huge heaps of bytes for which no real user claims responsibility
and software that does not work because it cannot correctly read the
password file (does not use Yellow Pages).

Here is a trivial solution to the problem of distributing configurable
binaries.  It seems a bit flakey, but is 99% reliable (i.e. portable to
slightly strange operating systems) because efficiency in loading
executables requires that they be in some sense images of main memory.

    Reserve an array of bytes which is large enough to hold any reasonable
    file name and set the first few bytes of this array to a "magic number".

    Example:
	struct conf_name {
		char magic[8];
		char name[100];
	};
	struct conf_name filename = { "MAGIC", ""};

    (char filename[108] = "MAGIC";   is simpler but there is a storage
    allocation bug in at least one venerable C compiler that breaks this
    expression.)

    Provide a file name patching program that scans a binary file to verify
    the existence of the "magic number" in exactly one place before writing
    the new file name into the executable binary file.

This hack is an obvious and almost inevitable solution resulting from any
serious consideration of the problem.  I don't know why it is not widely
used.  I suspect most software developers don't care about the problem.

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

Date:    Mon, 25 Apr 88 23:10:35 PDT
From:    hoptoad.UUCP!gnu at cgl.ucsf.edu (John Gilmore)
Subject: Symbolic links (and other problems) in pwd

I noticed an odd problem here with "df" and traced it to a problem in pwd;
it looks similar to Steve Simmons' problem.

Pwd (or getwd()) is actually a little loop that does a stat on ".", opens
"..", and stats everything in it until it finds the same entry.  That
gives it the name of the current directory in its parent.  It recurses on
this until it finds the root (a dir where ".." is the same as ".").

My problem with "df" was that it is doing a "pwd" (for no good reason) and
this was causing hangs when a machine I've mounted some file systems from
is down.  The problem was that pwd would do a stat() on the mount point of
the file system (in the root dir) and the stat would try to talk to the
remote system, causing a hang.  I tried to fix it by moving the mount
points out of the root (and creating symlinks to the new mount points).
This sometimes works, sometimes doesn't.

What it sounds like is happening at Schlumberger is that pwd is doing
"stat" rather than "lstat".  Stat follows symlinks, Lstat just says "this
file is a symlink".  Pwd should definitely be doing lstat's.  Can somebody
with the sources check?

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

Date:    Mon, 25 Apr 88 14:24:05 MDT
From:    steve beaty <cinelli!ciocc!beaty at relay.cs.net>
Subject: dynamic changing of suntools backgrounds

here is a small hack i put into `suntools.c' and `suntools_menu.c' to
allow for dynamic changing of the background rasterfile for suntools.  in
3.4 you can specify at startup, with the "-background" option, a
rasterfile to be used in place of the boring grey pattern that is the
default.  i hadn't found any way to change the background once suntools
had started.  i'm assuming that everyone has the two source files because
we don't have a `source license' and we had them.  [[ Yes, they are in
"/usr/src/sun/suntool", even on binary distributions.  --wnl ]]
here are the diffs:
________________________________________

*** suntools.c.old	Tue Apr 19 11:10:05 1988
--- suntools.c	Mon Apr 18 10:02:08 1988
***************
*** 1232,1234 ****
--- 1232,1241 ----
  	}
  }

+ void change_background (name)
+ char *name;
+ {
+ 	root_set_background (name);
+ 	wmgr_refreshwindow(rootfd);
+ }

*** suntools_menu.c.old	Tue Apr 19 11:11:15 1988
--- suntools_menu.c	Mon Apr 18 10:02:09 1988
***************
*** 229,237 ****
  	} else if (strcmp(prog, "REFRESH") == 0) {
  		wmgr_refreshwindow(rootfd);
  	} else {
! 		suntools_mark_close_on_exec();
!                 expand_path(prog, full_prog);
! 		(void)wmgr_forktool(full_prog, args, &rectnormal, &recticon, 0);
  	}
  	return (returncode);
  }
--- 229,245 ----
  	} else if (strcmp(prog, "REFRESH") == 0) {
  		wmgr_refreshwindow(rootfd);
  	} else {
! 		if (strcmp (prog, "BACKGROUND") == 0)
! 		{
! 			change_background (args);
! 		}
! 		else
! 		{
! 			suntools_mark_close_on_exec();
! 			expand_path(prog, full_prog);
! 			(void) wmgr_forktool
! 				(full_prog, args, &rectnormal, &recticon, 0);
! 		}
  	}
  	return (returncode);
  }
________________________________________

i made a copy of the two files in a local directory that is before
/usr/bin/suntools in my search path.  here is the makefile i used:
________________________________________

CFLAGS = -O -DSTANDALONE

suntools: suntools.o suntools_menu.o
    $(CC) $(CFLAGS) suntools.o suntools_menu.o -o $@ \
    -lsuntool -lsunwindow -lpixrect
________________________________________

and finally here is a portion of my `.rootmenu' file that makes it all
work:
________________________________________
	.
	.
	.
</u1/beaty/images/background.icon>	MENU
	"aspens"	BACKGROUND /usr/include/images/aspens.background
	"columbine"	BACKGROUND /usr/include/images/columbine.background
	"hands"		BACKGROUND /usr/include/images/hands.background
	"mandel"	BACKGROUND /usr/include/images/mandel.background
		.
		.
		.
</u1/beaty/images/background.icon>	END
	.
	.
	.
________________________________________

steve beaty		QTC/Horizon Labs/Colorado State University

beaty at handel.colostate.edu	...hplabs!hpfcla!handel!beaty

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

Date:    Tue, 26 Apr 88 15:53 N
From:    <POMPE at HLERUL5.BITNET>
Subject: Query SunCore zbuffer

Using SunCore to demonstrate a certain convergence in 3D I noted the
zbuffer procedure. It seemed to me the ideal solution to make a nice
picture without having to study the underlying algorithms.  I have
succeeded in plotting a number of 3D polygons, however, after closer
examination, I don't understand how to use the zbuffer procedure (from C).

Can anybody explain to me (in a clearer way than the manual does) how the
parameters should be used, especially xlist and zlist?  Are xlist and
zlist input or output? Must xlist and zlist be initialized?

I have included a description from the manual below.  Please include some
simple sort of example, if available.  Please send responses directly to
POMPE at HLERUL5.BITNET.  Thanx.

Kees Pompe
________________________________________

Set Z Buffer Cut

set_zbuffer_cut(surface_name, xlist, zlist, n)
struct vwsurf *surface_name;
float xlist [], zlist [];
int n;

set_zbuffer_cut specifies a cutaway view of 3D polygon objects when hid-
den surfaces are being removed. set_zbuffer_cut specifies an array of
depths in NDC space. Any parts of objects which are closer to the viewer
than this piecewise-linear function are clipped away.

xlist is assumed to be monotonically increasing. This function specifies
a piecewise-linear cutaway threshold in the z coordinate, which,
given any x coordinate, is constant in y. The default cutaway depth
is 0 for all values of x. Values of x less than xlist [0] or greater
than xlist [n-1] will have the default depth.
The view surface must have been initialized with the hidden flag on.
________________________________________

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

Date:    Mon, 25 Apr 88 18:12:31 PDT
From:    Jim Frew <frew at hub.ucsb.edu>
Subject: Questions: ESDI disks in old 3/160; APL

A couple of (compound) questions:

1) I have a 3-year-old 3/160 with 2 71-MByte SCSI disks.  Both disks have
   augured in, and I'd like to replace them with the newer/faster/etc. ESDI
   models.  Is this a simple swap, or impossible, or ... (I'd like to use the
   existing host adapter)?  Anybody out there done it?

2) Has anybody gotten the user-contributed APL on the 4.3BSD tape to run on a
   Sun?  What's involved?  Any other APL-on-Suns recommendations?

All pointers appreciated.

James Frew	(805)961-8413		frew at hub.ucsb.edu
CSL, UCSB, Santa Barbara, CA 93106	ucbvax!ucsbcsl!frew

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

Date:    Mon, 25 Apr 88 12:06:05 PDT
From:    dwiggins at atsun.local (Don Dwiggins)
Subject: Non-printing use of "lpr" queueing mechanism? 

I'm in the process of constructing an application that involves
serializing access to a resource, much in the manner of the lpr/lpd
mechanism (although the resource is computational rather than an output
device).  I've looked at the documentation for the printer queuing
programs, and they basically do about 80% of what I want -- submitting a
request containing a packet of information, managing the queue of
requests, dequeuing and driving one of a number of "servers", providing
for multiple classes of requests (i.e.  troff, postscript, graphics, etc.
files).

Natcherly, I'd like to be able to piggyback on this existing stuff.  It
looks like I might be able to hack it, but it's not clear, and the
documentation falls short of telling me what I need to know (like how to
add a new class of "print" request, how to write a "filter" for it).  Has
anyone been down this path before?  Am I barking up the wrong tree?
Should I seek greener pastures elsewhere?  Am I mixing my metaphors?  If
you'd like to mail responses, I'll post a summary of whatever looks
promising (and whatever I decide to do if it seems like being of general
interest).

Don Dwiggins
{scgvaxd,crash}!ashtate!dwiggins

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

Date:    Mon, 25 Apr 88 07:01:58 PDT
From:    JQ Johnson <intel.com!uoregon!drizzle.cs.uoregon.edu!jqj%omepd.Berkeley.EDU at ucbvax.berkeley.edu>
Subject: multiuser performance on 3/60S?

Various people have commented on their success in using a 3/260 or larger
SUN as a timesharing system.  Has anyone played with a 3/60S in that role?
With the new fast 327MB disks, lots of memory, and a processor that is 80%
the speed of a 3/260, it is at least possible that this would make a
reasonable timesharing system.  Presumably SCSI controllers make a big
(negative) difference in timesharing performance, but can anyone quantify
that difference?  For example, compare 2 3/60 systems with 2 SCSI disk
strings to a single 3/260+SMD ?

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

Date:    Mon, 25 Apr 88 15:32:58 EDT
From:    jwm at stdc.jhuapl.edu (James W. Meritt)
Subject: converting a rasterfile to an icon

After seeing the special icon issue, I couldn't resist.  Here is a chunck
of C code that converts a rasterfile, produced however (digitizer,
screenlift,....) into an icon: and not just 64x64: ANY size.

[[ This is also the last message in the digest, and the source is just
barely small enough to let it slide through...  --wnl ]]

use: pic2icon (in rasterfile name) (out icon name)
___________________________________________________________

#include <stdio.h>
#include <suntool/sunview.h>
#include <suntool/panel.h>
#include <suntool/scrollbar.h>
#include <suntool/canvas.h>
#include <sys/types.h>
#include <suntool/icon_load.h>
#include <pixrect/pixrect.h>
#include <pixrect/pixrect_hs.h>
#include <pixrect/pr_io.h>
#define ITEMS_PER_LINE 8
#define BITS_PER_BYTE  8

static void dump_rf_proc(),mevent_proc();;

Frame base_frame;
Canvas canvas;
Pixwin *canvas_pw;
Panel select_panel;
Panel_item pick_icon,dump_file,pos_x,pos_y,file_item;
Scrollbar scroll_x,scroll_y;

int x0,y0,x1,y1;


static struct pixrect *chart, *icon;
static struct rasterfile bkgd_rf_hdr;
struct pixrect *pr_load();
FILE *input_rf, *output_rf,*fopen();
unsigned short	*data;
struct pixrect	*pr;
colormap_t *colormap = 0;
int type = RT_STANDARD;
int copy_flag = 1;
int count;
char error_msg[IL_ERRORMSG_SIZE];



main(argc,argv)
int argc;
char **argv;

{


        if ((input_rf = fopen(argv[1], "r")) == NULL)
                printf("Picture cannot be opened\n");

        pr_load_header(input_rf, &bkgd_rf_hdr);
        fseek(input_rf, 0, 0);

	pr = pr_load(input_rf,NULL);

                if ((output_rf = fopen(argv[2], "a")) == NULL)
                     printf("Output icon cannot be opened\n");  
                data = (unsigned short *)
                ((struct mpr_data *)(LINT_CAST(pr->pr_data)))->md_image;
                fprintf(output_rf,
"/* Format_version=1, Width=%d, Height=%d, Depth=%d, Valid_bits_per_item=%d\n",
                pr->pr_size.x, pr->pr_size.y, pr->pr_depth,
                BITS_PER_BYTE*sizeof(*data));
                fprintf(output_rf, " */\n");
                count = mpr_linebytes(pr->pr_size.x, pr->pr_depth) *
                pr->pr_size.y / sizeof(*data);
                while (count > ITEMS_PER_LINE){
                fprintf(output_rf,
        "\t0x%-04X,0x%-04X,0x%-04X,0x%-04X,0x%-04X,0x%-04X,0x%-04X,0x%-04X,\n",
                data[0], data[1], data[2], data[3],
                data[4], data[5], data[6], data[7]
                );
                data += ITEMS_PER_LINE;
                count -= ITEMS_PER_LINE;
                }
                putc('\t', output_rf);
                while (count-- > 0)
                fprintf(output_rf, "0x%-04X%s", *data++, count ? "," : "");
                putc('\n', output_rf);
		fclose(output_rf);
}
_________________________________________________________

jwm at aplvax.jhuapl.edu 128.244.65.5

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

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



More information about the Comp.sys.sun mailing list