[comp.sys.sun] Sun-Spots Digest, v6n150

Sun-Spots-Request@RICE.EDU (William LeFebvre) (07/22/88)

SUN-SPOTS DIGEST          Thursday, 21 July 1988        Volume 6 : Issue 150

Today's Topics:
                       Re: QIC format documentation
                            Re: Sound on a Sun
               Re: SunOS umount and single-process deadlock
                                Big fonts
                        malloc() - free() problems
                          ptrace examples needed
             Anyone using Fortran on a Sun 4 running SunOS4.0
                 f77 on the Sun 4 -- is this a bug or ??
                   SLIPnet and ALM-2s under SunOS 3.5?
                  Graph format driver for Epson LQ-850?

Send contributions to:  sun-spots@rice.edu
Send subscription add/delete requests to:  sun-spots-request@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@rice.edu" or mail the word "help" to the same address
for more information.

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

Date:    Wed, 13 Jul 88 8:50 BST
From:    Piete Brooks <pb%computer-lab.cambridge.ac.uk@nss.cs.ucl.ac.uk>
Subject: Re: QIC format documentation
Reference: v6n136

> Since Sun went to QIC-24 format tapes for their distribution, they have paid
> a little more attention to documenting the format.  Try page 84 in the
> "System & Network Administration" manual in the 4.0 distribution manual set.
> That's not much detail either, however.  It's a start.

Have you actually READ it ?
It sure was thrown together in a hurry !

% QIC-11 means the tape is in four-track format.
% QIC-24 means the tape is in nine-track format.
% The table below fives the calue of n that corresponds to each of these
  Yup ........... ^ ....... ^ they WERE in a hurry

Then it goes on to say:
% Usually QIC-11 capable tape drives are 4 track and QIC-24 capable drives
% are 9 track, but that is not always the case.

Fine if a drive is only capable of QIC-11 OR QIC-24 but not both ...
I assume that it really means:
+ IF   QIC-24 THEN likely to be 9-track
+ ELIF QIC-11 THEN likely to be 4-track

However, it does seem to contradict the initial statement that QIC-11
MEANS (rather than indicates a likelyhood) 4-track.  It appears from the
tables that a particular tape drive does indeed always use a set number of
tracks, and that the QIC format is irrelevant to the amount of information
stored.  [ I often wondered how they changed the head / de-actived half
the coils ! ]

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

Date:    Wed, 13 Jul 88 08:06:48 EDT
From:    reg%lti.UUCP@bu-it.bu.edu (Rick Genter x18)
Subject: Re: Sound on a Sun

Check out Diamond from BBN Software Products Corporation (70 Fawcett St.,
Cambridge, MA).  Diamond is a multimedia mail facility; sound is one of
the supported media.

					- reg

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

Date:    Wed, 13 Jul 88 09:58:16 PDT
From:    marks@sun.com (Mark Stein)
Subject: Re: SunOS umount and single-process deadlock

In Sun-Spots v6n134, dae@shire.cs.psu.edu describes doing a "umount -a"
command which fails with a "Device busy" error, and which recurs after a
"cd /" command and retrying the umount.

> At this point a ps shows a "umount -a" running in the background, off in
> /usr, trying furiously to unmount the file system it can't unmount because
> it's trying to umount it.

This is not quite what the background umount is really doing.  If the
incantation "umount /usr" had been used, the operation would have simply
failed and umount would have exited.  The cd followed by umount again
would have worked.

However, the "-a" option (if filesystem type "NFS" is included, as it is
by default) does the unmounts, but it then sends out a broadcast
MOUNTPROC_UMNTALL ("unmount all") request to the various mount servers on
the network.  The umount process hangs around for about one minute while
doing this, then exits.  It is not deadlocked wating for the umount of
/usr to succeed.

Mark Stein
Sun Microsystems, ONC Software

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

Date:    Wed, 13 Jul 88 15:59:56 BST
From:    Richard Tobin <richard%aiai.edinburgh.ac.uk@nss.cs.ucl.ac.uk>
Subject: Big fonts

> Does anyone have any vfont format (i.e., SunView-type) fonts that I could
> get my hands on?  Especially large ones.

No, but here's a vfont magnification program.  It doesn't do anything
clever, but it's fine if you just want to be able to read the screen from
a large distance.

Richard Tobin,                         JANET: R.Tobin@uk.ac.ed             
AI Applications Institute,             ARPA:  R.Tobin%uk.ac.ed@nss.cs.ucl.ac.uk
Edinburgh University.                  UUCP:  ...!ukc!ed.ac.uk!R.Tobin

/* fontmag: magnify a vfont format font
 *
 * Copyright Richard Tobin/AIAI 1988.
 * Maybe freely redistributed if this comment remains intact.
 *
 * usage: fontmag mag <oldfont >newfont
 */

#include <stdio.h>
#include <vfont.h>
#include <malloc.h>

struct font {
    struct header header;
    struct dispatch dispatch[NUM_DISPATCH];
    unsigned char *data[NUM_DISPATCH];
};

void readfont(), charmag(), rowmag(), writefont();
extern double atof();

main(argc, argv)
int argc;
char **argv;
{
    int i;
    double mag;
    struct font oldfont, newfont;

    if(argc != 2 || (mag = atof(argv[1])) <= 0.0 || mag > 100.0)
    {
	fprintf(stderr, "usage: %s mag <oldfont >newfont\n", argv[0]);
	exit(1);
    }

    readfont(&oldfont, stdin);

    for(i=0; i<NUM_DISPATCH; ++i)
    {
	charmag(&oldfont.dispatch[i], oldfont.data[i],
		&newfont.dispatch[i], &newfont.data[i],
		mag);
    }

    writefont(&newfont, stdout);

    exit(0);
}

void readfont(font, file)
struct font *font;
FILE *file;
{
    int i;

    if(fread(&font->header, sizeof(font->header), 1, file) == 0)
    {
	fprintf(stderr, "can't read font header\n");
	exit(1);
    }

    if(font->header.magic != VFONT_MAGIC)
    {
	fprintf(stderr, "not a vfont file\n");
	exit(1);
    }

    if(fread(font->dispatch, sizeof(font->dispatch[0]), NUM_DISPATCH, file) == 0)
    {
	fprintf(stderr, "can't read font dispatch table\n");
	exit(1);
    }

    for(i=0; i<NUM_DISPATCH; ++i)
    {
	if(font->dispatch[i].nbytes == 0) continue;
	font->data[i] = (unsigned char *)malloc(font->dispatch[i].nbytes);
	if(fread(font->data[i], 1, font->dispatch[i].nbytes, file) == 0)
	{
	    fprintf(stderr, "can't read character %d\n", i);
	    exit(1);
	}
    }
}

void charmag(olddispatch, olddata, newdispatch, newdata, mag)
struct dispatch *olddispatch, *newdispatch;
unsigned char *olddata, **newdata;
double mag;
{
    int oldx, oldy, newx, newy, bwidth, oldbwidth, nbytes;
    register int count, newrow;
    register unsigned char *oldptr, *newptr, *prevoldptr, *data;

    oldx = olddispatch->left + olddispatch->right;
    oldy = olddispatch->down + olddispatch->up;
    newx = oldx * mag + 0.5;
    newy = oldy * mag + 0.5;

    if(newx == 0 || newy == 0)
    {
	newdispatch->nbytes = 0;
	return;
    }

    oldbwidth = (oldx + 7) / 8;
    bwidth = (newx + 7) / 8;
    nbytes = bwidth * newy;
    data = (unsigned char *)malloc(nbytes);
    bzero(data, nbytes);

    newdispatch->left = olddispatch->left * mag + 0.5;
    newdispatch->right = newx - newdispatch->left;
    newdispatch->down = olddispatch->down * mag + 0.5;
    newdispatch->up = newy - newdispatch->down;
    newdispatch->width = olddispatch->width * mag + 0.5;
    newdispatch->nbytes = nbytes;

    *newdata = data;

    oldptr = olddata;
    prevoldptr = 0;
    newptr = data;
    count = 0;

    for(newrow = 0; newrow < newy; newptr += bwidth, ++newrow)
    {
	if(oldptr != prevoldptr)
	{
	    rowmag(oldptr, newptr, oldx, newx);
	    prevoldptr = oldptr;
	}
	else
	    bcopy(newptr - bwidth, newptr, bwidth);

	count += oldy;
	while(count >= newy)
	{
	    oldptr += oldbwidth;
	    count -= newy;
	}
    }
}

void rowmag(oldptr, newptr, oldx, newx)
unsigned char *oldptr, *newptr;
int oldx, newx;
{
    register int count, newbit, oldbit, newcol;
    register unsigned char *newbyte, *oldbyte;

    newbyte = newptr;
    newbit = 128;
    oldbyte = oldptr;
    oldbit = 128;
    count = 0;

    for(newcol=0; newcol < newx; ++newcol)
    {
	if(*oldbyte & oldbit) *newbyte |= newbit;

	if(newbit == 1)
	{
	    newbit = 128;
	    newbyte++;
	}
	else
	    newbit >>= 1;

	count += oldx;
	while(count >= newx)
	{
	    if(oldbit == 1)
	    {
		oldbit = 128;
		oldbyte++;
	    }
	    else
		oldbit >>= 1;
	    count -= newx;
	}
    }
}	

void writefont(font, file)
struct font *font;
FILE *file;
{
    int i, size=0, maxx=0, maxy=0;

    for(i=0; i<NUM_DISPATCH; ++i)
    {
	int x, y;


	if(font->dispatch[i].nbytes > 0)
	{
	    font->dispatch[i].addr = size;
	    size += font->dispatch[i].nbytes;
	}

	x = font->dispatch[i].left + font->dispatch[i].right;
	if(x > maxx) maxx = x;

	y = font->dispatch[i].down + font->dispatch[i].up;
	if(y > maxy) maxy = y;
    }

    font->header.magic = VFONT_MAGIC;
    font->header.size = size;
    font->header.maxx = maxx;
    font->header.maxy = maxy;
    font->header.xtend = 0;	/* unused, but make identical fonts be identical! */


    if(fwrite(&font->header, sizeof(font->header), 1, file) == 0)
    {
	fprintf(stderr, "can't write font header\n");
	exit(1);
    }

    if(fwrite(font->dispatch, sizeof(font->dispatch[0]), NUM_DISPATCH, file) == 0)
    {
	fprintf(stderr, "can't write font dispatch table\n");
	exit(1);
    }

    for(i=0; i<NUM_DISPATCH; ++i)
    {
	if(font->dispatch[i].nbytes == 0) continue;
	if(fwrite(font->data[i], 1, font->dispatch[i].nbytes, file) == 0)
	{
	    fprintf(stderr, "can't write character %d\n", i);
	    exit(1);
	}
    }
}



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

Date:    Wed, 13 Jul 88 10:23:10 EDT
From:    jas@proteon.com (John A. Shriver)
Subject: malloc() - free() problems

It all depends on how Sun has implemented malloc().  Remember that
malloc() is a library call, not a system call.  The underlying system call
is sbrk(), which asks to extend your heap.  If malloc(), for whatever
reason, is not allocating the same 10 MB you just free()'d, it will wind
up having done two sbrk()'s asking for 10 MB.  Indeed, there are some
interesting behaviors that malloc() is required to have, due to the
specification of how realloc() works.  (There may also some backwards
compatability issues with certain nominally improper, but popular,
operations.)  This may be why the old memory was not available.

Put a breakpoint on sbrk(), and run the program and see what happens.

[[ Or better yet, just ditch malloc completely and do your own memory
management using "sbrk" as a primitive!  But watch for all those other
library functions that secretly call "malloc".  --wnl ]]

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

Date:    13 Jul 88 07:40:55 GMT
From:    prlb2!kulcs!dannyb@uunet.uu.net (Danny Backx)
Subject: ptrace examples needed

I am looking for simple examples on the use of the ptrace system call.

I tried the one in M.J. Bach's book, but didn't get it to work.  (Maybe
somebody knows why? I tried in on SunOS 3.4)

Any working example program will do. I can use Suns (SunOS 3.4), VAXen
(Mt.Xinu 4.3), Sequent (DYNIX 3.0.8).

All help is appreciated. Thanks.

Danny

 Danny Backx                            mail: Katholieke Universiteit Leuven 
 Tel: +32 16 200656 x 3544                    Dept. Computer Science
 E-mail: dannyb@kulcs.UUCP                    Celestijnenlaan 200 A
         ... mcvax!prlb2!kulcs!dannyb         B-3030 Leuven
         dannyb@blekul60.BITNET               Belgium     

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

Date:    Wed, 13 Jul 88 12:43:01 MDT
From:    brownj@boulder.colorado.edu (James Brown)
Subject: Anyone using Fortran on a Sun 4 running SunOS4.0

We are considering bringing up a machine with SunOS 4.0, but cannot unless
we are sure a working implementation of Fortran is available. We currently
have SPARC FORTRAN v1.1 for SunOS4.0. We don't have another machine to run
this on as a test. There are rumors about that FORTRAN v1.1 is plagued
with bugs so that it barely works, if even at all.

If someone has used this or has it running, could you please mail me your
comments? I'll post a summary of what I find.

Thanks,
James D. Brown				brownj@boulder.Colorado.EDU
Univ. of Colorado at Boulder		...!ncar!boulder!anchor!brownj
Dept. of Computer Science

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

Date:    13 Jul 88 07:49:17 GMT
From:    munnari!natmlab.dms.oz.au!ronb@uunet.uu.net (Ron Baxter)
Subject: f77 on the Sun 4 -- is this a bug or ??

The f77 compiler on the Sun 4 appears to do the wrong thing with a '\0' in
character strings.  The script below shows the 2-line program:

		write(*,*)ichar("\0")
		end

compiled and run first on the Sun 3, then on the Sun 4.  The Sun 3 prints
0 as I expected --- but the Sun 4 prints 3.  Where the hell did it get 3
from?

Can anyone suggest what to put between the double quotes in the above to
get it to print zero.  I know that ichar(char(0)) gets the desired result,
but the software I am compiling would be fixed more easily if there is
something that can go between the double quotes (because there is macro
pre-processing using m4 before it is compiled).

	Here is the script:
Script started on Wed Jul 13 17:27:59 1988

1 Sun-3% cat junk.f
	write(*,*)ichar("\0")
	end
2 Sun-3% f77 junk.f
junk.f:
 MAIN:
3 Sun-3% a.out
  0
4 Sun-3% Sun-4

Last login: Wed Jul 13 17:26:48 from Sun-3.dms.oz
SunOS Release Sys4-3.2_REV2_EXPORT (DMSYIP) #1: Mon Jun 20 16:21:12 EST 1988

1 Sun-4% cat junk.f
	write(*,*)ichar("\0")
	end
2 Sun-4% f77 junk.f
junk.f:
 MAIN:
3 Sun-4% a.out
  3
4 Sun-4% exit
5 Sun-4% logout

5 Sun-3% 
script done on Wed Jul 13 17:30:08 1988

Ron Baxter, CSIRO Div Maths & Stats, PO Box 218, Lindfield, NSW, Australia.
PHONE:	+61 2 467 6059			ACSNET:	ronb@natmlab.oz		
ARPA: ronb%natmlab.oz@seismo.css.gov	
UUCP:	....{seismo,hplabs,mcvax,ukc,nttlab}!munnari!natmlab.oz!ronb

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

Date:    Wed, 13 Jul 88 11:14:47 EDT
From:    Steve A. Shumway <sas@cs.duke.edu>
Subject: SLIPnet and ALM-2s under SunOS 3.5?

We have a need to connect several slipnet lines to an ALM-2 on a
Sun-3/180.  Quoting from the slipnet documentation:

   "the use of the the built-in serial ports on the sun 2 and sun 3 is
recommended as these ports support modem control and reliable
throughput up to 19200 baud.  although not suggested, the driver can be
used with a systech serial board provided a minor hardware adjustment
is made.  the problem is that the default hardware interrupt priority
for the systech board is set too high (it is higher than splimp).  the
problem manifests itself as `mget' panics and can be fixed by lowering
the hardware interrupt level of the board by one."

and by golly, if you try and run slipnet on an ALM-2 your machine will
stay up for about 5 minutes and crash with an mget panic!

So, has anyone made the "minor hardware adjustment" to get this to work (I
assume it's either cutting a trace on the ALM or substituting a "DEC
BR"-style plug) that would be willing to divulge this information?  We are
attempting to go through Sun in parallel with this query (I bet sun-spots
wins! :-)  TIA

Steve Shumway
Sr. Systems Programmer
Duke CS Dept.
sas@cs.duke.edu

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

Date:    Wed, 13 Jul 88 11:11:29 pdt
From:    1dharvey@teknowledge-vaxc.arpa (Doug Harvey)
Subject: Graph format driver for Epson LQ-850?

I am looking for a printer driver for a Sun 3/50 that can convert a device
independent graphics file (output from plot) into a format that can be
printed on an Epson LQ-850.  

Can anyone help me out?

Thanks,

Doug Harvey 
Electronic Data Systems

(313) 556-9507
mail: 1dharvey@teknowledge-vaxc.arpa


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

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