[comp.os.misc] Coherent Digest Vol. 91.1, No. 4

rose@galtee.cs.wisc.edu (Scott M. Rose) (01/16/91)

Coherent Digest Vol. 91.1, No. 4      Tue Jan 15 12:43:57 CST 1991

Today's Topics:

   Boot Strap News
   64k limit
   video ram
   Re: net news
   FAX software for Coherent
   /rdb under Coherent
   How did I get here?  Where did I get these clothes?
   Does anybody have a Coherent version of 'install'
   Availability of dmake via ftp
   O_CREAT and O_TRUNC ignored by open()
   Things to watch out for when porting to Coherent

Administrivia:

  The Coherent Digest is a forum for discussion of the MWC Coherent 3.x 
  operating system.  Send submissions to "coherent@cs.wisc.edu" and 
  administrivia to "coherent-reqeust@cs.wisc.edu".  Previous issues are 
  archived for anonymous FTP access on piggy.ucsb.edu in the directory
  "pub/coherent/mail-list".

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

Date: 10 Jan 91 11:30:20 EST (Thu)
From: frog!rmk%harvard.UUCP@spool.cs.wisc.edu
To: coherent@spool.cs.wisc.edu
Cc: rmk%frog.UUCP@spool.cs.wisc.edu
Subject: Boot Strap News

	I downloaded bsnews earlier this week, and I should be receiving
	news by tonight.

	The first problem that I found was that sh wouldn't unshar the
	file.  This is fixed by editing all the lines containing sed.

	Other than that it is pretty straight forward.  You can read news,
	and post news.  You can probably follow-up articles with some
	careful planning.

	I did receive some news last night, but I needed to fix various
	permissions.

	I will report further after I have used it a few days.

Rick Kelly	Charles River Data Systems rmk@frog.UUCP rmk@rmkhome.UUCP


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

Date: 10 Jan 91 14:53:38
From: mwc!hal@uunet.UU.NET (Hal Snyder)
To: cohmail@uunet.UU.NET
Cc: norm@uunet.UU.NET
Subject: 64k limit

> Anyone at MWC want to comment on a Coherent without a 64k segment limit?  It
> is very annoying not being able to compile anything bigger than a segment;
> in fact it's frustrating to have something completely compatible with
> coherent (function calls and all) that's too big.  

Anyone at Intel want to comment on 64k segment size in 286 protected mode?
As you may know, the 64k byte segment size limit imposed by the 286 CPU
architecture actually results in a 128k size limit for each COHERENT process,
since we use separate segments for code and data.

MWC is very much aware of how important it is to remove the "small model"
limitation from COHERENT.  The main concern is, which of several possible
approaches will provide the best trade-off in terms of development effort,
time to market, performance, and number of systems supported.  We are 
already working on a 386-based large-model COHERENT, with an initial release
still at least six months in the offing.  We are still looking at the
alternatives for bringing large-model COHERENT to our 286 customers.

Mark Williams Tech. Support		(708)-291-6700 (voice)
uunet!mwc!support			(708)-291-6750 (fax)

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

Date: 10 Jan 91 18:29:18
From: mwc!hal@uunet.UU.NET (Hal Snyder)
To: cohmail@uunet.UU.NET
Subject: video ram

> If shared memory is used to pass info to/from the video memory,
> a lot of trouble can be saved.
> But how explicitly making clear that e.g. memory at physical location
> B800: and up (start of video memory of Hercules graphics card) is
> to be treated as SHM?

The shared memory driver does not support sharing a fixed region of
physical ram.  If you want to access a specific range of memory
(up to 64k bytes in size - remember, COHERENT runs in 286 protected
mode), you will need to write your own driver.  For those of you with
the driver kit, what follows is part of a sample driver which reads
and writes page 0 of monochrome video ram:

/*
 * qq - sample device driver using absolute memory addressing
 *
 ...
 */
...
/*
 * Definitions.
 */
#define	MONOVIDEO	0xB000		/* monochrome text RAM segment */
#define	VIDLENGTH	(2048*2)	/* screen locations (2 bytes each) */
...
/*
 * Local variables.
 */
static faddr_t	screen_fp;		/* (far *) to access screen */
static paddr_t	screen_base;		/* physical address of screen base */

/*
 * Load Routine.
 */
static qqload()
{
	/*
	 * Allocate a selector to map onto the video RAM.  ptov() will
	 * return the first available selector of the 8,192 possible.
	 * This is time consuming, so we only want to do this as part
	 * of our initialization code and not on every access.
	 *
	 * Since we are operating in 286 protected mode (ugh), the
	 * second argument to ptov() must not exceed 0x10000L.
	 */
	screen_base = (paddr_t)MONOVIDEO << 4;
	screen_fp = ptov(screen_base, (fsize_t)VIDLENGTH);
}

/*
 * Unload Routine.
  */
static qqunload()
{
	/*
	 * We have to free up the selector now that we're done using it.
	 */
	vrelse(screen_fp);
}
...
/*
 * Read Routine.
 */
qqread( dev, iop )
dev_t dev;
register IO * iop;
{
	static int offset;
	int c;
	/*
	 * Read a character code from video RAM
	 * Start reading RAM just after where previous read ended
	 *
	 * Note that "offset" is the value of the displacement into
	 * the screen RAM. Any expression which results in a value
	 * which is less than VIDLENGTH is OK here.
	 */
	while(iop->io_ioc) {
		c = ffbyte(screen_fp + offset); /* fetch a "far" byte */
		if(ioputc(c, iop) == -1)
			break;
		offset += 2;	/* skip over attribute byte */
		offset %= VIDLENGTH;
	}
}

/*
 * Write Routine.
 */
qqwrite( dev, iop )
dev_t dev;
register IO * iop;
{
	int offset = 0;
	int c;

	/*
	 * Write a character into the screen RAM
	 */
	while ((c = iogetc(iop)) >= 0 && offset < VIDLENGTH) {
		sfbyte(screen_fp + offset, c);	   /* store a "far" byte */
		offset += 2;	/* skip attribute byte */
	}
}

The full driver will be posted on mwcbbs as
	/usr/spool/uucppublic/downloads/qq.c.Z
Mark Williams Tech. Support		(708)-291-6700 (voice)
uunet!mwc!support			(708)-291-6750 (fax)

Mark Williams Tech. Support		(708)-291-6700 (voice)
uunet!mwc!support			(708)-291-6750 (fax)

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

Date: Thu, 10 Jan 91 20:59:18 EST
From: jep%baugo@nstar.rn.com (Joseph Perry)
To: coherent
Subject: Re: net news

Although a new subscriber to the Coherent Digest, I like the idea of a
Coherent newsgroup.  I do like the Digest though, where a lot of the
noise (like this?) is filtered by the editor.  How about several
newsgroups, moderated, un-moderated, and sources?

Comp.os.coherent is preferred over alt.coherent.

Something like:
    comp.os.coherent.forum	<- like present mailing list
    comp.os.coherent.mod	<- moderated newsgroup, like Digest
    comp.os.coherent.sources	<- Coherent sources (moderated?)
    comp.os.coherent.sources.d	<- discussion of the sources

Right now I use waffle under MS-DOS to get a Usenet newsfeed and then
read & post news.  I'd like to use Coherent for this but too much pure
Unix code just won't compile (and then run right) without messing with
the code.  Is a 'large memory model' version on the way?

I've seen some discussion of Coherent V3.1 in the Coherent Digest and
in magazine articles.  I've not gotten an announcement from MWC about
an upgrade offer although I'm a registered user of V3.0.  Is this
normal?
- ---
Joseph Perry    Osceola, IN USA
UUCP: uunet!mailrus!iuvax!ndcheg!nstar!baugo!jep
Internet: jep%baugo@nstar.rn.com -or- jep@baugo.UUCP
- ---

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

Date: 12 Jan 91 01:29:19
From: Anders Fongen <anders@fongen.uu.no>
To: coherent
Subject: FAX software for Coherent

I own a WorldPort FAX modem which has not sent many FAXes since I
converted to Coherent, because it requires DOS-specific software
to work as a FAX machine.

I would like to make attempts to write FAX software for this modem
under Coherent, and have studied some relevant CCITT-rec's. My present
point of view is that the software could be small in terms of number
of code lines, but the recommendations behind G3 FAX are hard to
understand.

Are there any in this conference who would like to form a group which
could make joint efforts in the study and implementations of such software,
which should be public-domain? Please send me a message if you like this
idea.

Best regards,

- --------------------------------------------------------------------
Anders Fongen			BIX : afongen
Vallerveien 57E			INET: anders@fongen.uu.no
N-1344 HASLUM			USENET: ...uunet!fongen.uu.no!anders
NORWAY				tlf: +47-2-530505
- --------------------------------------------------------------------

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

Date: 12 Jan 91 01:35:01
From: Anders Fongen <anders@fongen.uu.no>
To: coherent
Subject: /rdb under Coherent

I am suprised that there has been few comments on the /rdb software
for Coherent. I am the happy owner of this relational database, which
is well thought-out, easy to use, complete and efficient. I run
both business and home accounting under /rdb, and enjoy this very
much.

Is there anyone out there who use this software and could share their
experience with us?

I wrote a review of /rdb for a Norwegian PC-magazine which I translated
into English. Those who might be interested in it could send me a message.

Best regards,

- --------------------------------------------------------------------
Anders Fongen			BIX : afongen
Vallerveien 57E			INET: anders@fongen.uu.no
N-1344 HASLUM			USENET: ...uunet!fongen.uu.no!anders
NORWAY				tlf: +47-2-530505
- --------------------------------------------------------------------

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

Date: Sat, 12 Jan 91 14:33 EST
From: NMILLER@vax1.trincoll.edu
To: coherent
Subject: How did I get here?  Where did I get these clothes?

I'm a brand new user of Coherent (and of Unix), so some of this has
to be put down to tyro anxiety and so on.  

The Manual is outstanding.  On page 17 it explains what a terminal is.
On page 18 we're told what the carriage return key looks like.  Then, 
having tired of that little joke, it proceeds to omit some of the things 
a newcomer is most likely to look for.

For instance:

1. One of Unix's great strengths is multi-tasking.  Fine.  How exactly
does a fella who's accustomed to MS-DOS and VMS go about it?

2. It explains how to configure external modems.  Does this mean that
my internal modem can't be used?

3. The dos command enables a user to use his MS-DOS files.  But what does it
mean when it says that I have to link /dev/dos to the "most commonly used 
device name"?  And is that all I have to do, or is there more to it?

4. I intend to be the sole user of Coherent.  Do I still have to put on 
various hats and pose as superuser, trade passwords with myself and all that?
Reminds me a bit of the drearier parts of Huckleberry Finn.

I imagine that with time I'll get accustomed to the beast, but for right
now a bit of advice would be appreciated.

Norman Miller


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

Date: Fri, 11 Jan 91 11:42:11 CST
From: rosevax.rosemount.com!grante%rutgers.UUCP@spool.cs.wisc.edu (Grant B. Edwards)
To: coherent@spool.cs.wisc.edu
Subject: Does aonbody have a Coherent version of 'install'

In many makefiles, there is a target that when made will install the
executables with apporpriate owner, group, and mode in the desired
directory.

This is usually done with the 'install' command (which is /bin/install
on SunOS and /usr/bin/install on BSD4.3).

Does anybody have a Coherent version of this command?


                                  Grant Edwards
Rosemount Inc, CB7                                            He who dies with
12001 Technology Drive      grante@hydro.rosemount.com        the most manuals
Eden Prairie, MN  55344     uunet!rosevax!hydro!grante        wins.

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

Date: Fri, 11 Jan 91 11:31:34 CST
From: rosevax.rosemount.com!grante%rutgers.UUCP@spool.cs.wisc.edu (Grant B. Edwards)
To: coherent@spool.cs.wisc.edu
Subject: Availability of dmake via ftp

My apologies to those who have been unsuccessful in their attempts
to ftp stuff from cs.umn.edu.

That machine apparently has problems sending large files -- it can
receive arbitrarily large files but doesn't seem to be able to send
them (either putting from this end or getting from your end).

I have uuencoded and split the Coherent release of dmake and it is now
available on both piggy.ucs.edu in /pub/incoming and cs.umn.edu in
/pub/grante as the set of files named dmake.uue.*


                                  Grant Edwards
Rosemount Inc, CB7                                            He who dies with
12001 Technology Drive      grante@hydro.rosemount.com        the most manuals
Eden Prairie, MN  55344     uunet!rosevax!hydro!grante        wins.

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

Date: Sat, 12 Jan 91 14:28:56 CST
From: rosevax.rosemount.com!grante%rutgers.UUCP@spool.cs.wisc.edu (Grant B. Edwards)
To: coherent@spool.cs.wisc.edu, mwc!support%uunet.UUCP@spool.cs.wisc.edu
Subject: O_CREAT and O_TRUNC ignored by open()

I have been working on porting RCS version 5.5 to Coherent.  In one of
the files, there is a test to see if O_CREAT and O_TRUNC are defined.

If they are defined, then a call is made to

	fd = open(filename, O_CREAT+O_TRUNC, mode);

If they are not defined then a call is made to

	fd = creat(filename, mode);

Where mode is the mode of the file to be created, as in <sys/stat.h>

O_CREAT and O_TRUNC are defined in <sys/fcntl.h> and if you look in
that file, there is a comment about open() using O_CREAT and O_TRUNC
and another comment about a third argument to open().

But, the man page (and test programs I wrote) confirm that the syntax
for open() is:

	fd = open(filename, type);

Where type is the type of access desired: 0,1,2 (read,write,both).

To what do the comments in <sys/fcntl.h> refer?

(The problem with RCS is solved by undefining the things that make
everybody think the open() exists in its new form.)

UNRELATED SUGGESTION:

Everything I have tried to port to Coherent required either _doprnt()
or vfprintf().  I hacked up a vfprintf(), but it isn't too robust or
portable -- how about a real one in the next release?

                                  Grant Edwards
Rosemount Inc, CB7                                            He who dies with
12001 Technology Drive      grante@hydro.rosemount.com        the most manuals
Eden Prairie, MN  55344     uunet!rosevax!hydro!grante        wins.


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

Date: Sun, 13 Jan 91 13:45:34 CST
From: rosevax.rosemount.com!grante%rutgers.UUCP@spool.cs.wisc.edu (Grant B. Edwards)
To: coherent@spool.cs.wisc.edu, mwc!support%uunet.UUCP@spool.cs.wisc.edu
Subject: Things to watch out for when porting to Coherent

I have been porting various packages to Coherent over the last several
weeks.  Overall, I'm very impressed with Coherent and have had very
good luck porting software to it.

I have run across a few glitches.  The ones marked as Incompatibility
issues mean that the feature in question is in agreement with Coherent
documentation, but different than Berkley and SysV, (I don't know how
things compare to V7).  Bugs are things that seem to operate
differently from the behavior stated in the documentation.

I = Incompatiblity 
B = Bug (IMHO)


1. I	Others implementations of sed allow multiple commands separated
	by semicolons:

		sed "s/${this}/${that}/; s/asdf/qwer/; ${n}d"

	Coherent sed complains about a bad flag.  Since double quoted
	strings are used when shell variable substitution is desired
	in the sed commands, this means that you can't put newlines
	between the commands either.


2. I	Shell scripts expect the output from the 'date' command to be
	
		Sun Jan 13 12:02:09 CST 1991

	Coherent's 'date' has the order of the last two fields reversed.


3. I	The Berkley and SysV versions of fputs() return an int value
	(EOF on error).  The Coherent version has a void return type.


4. I	Newlines aren't allowed in double-quoted strings in Coherent's
	Bourne shell.  Most other bourne shells allow this.  I have run
	across several shell scripts that depend on this feature.


5. B	When redirecting input from a 'here document' nothing can follow
	the redirection NOT EVEN WHITE SPACE.

	cmd <<EOF (whitespace)			FAILS
	cmd <<EOF && someOtherCommand		FAILS


6. ?	The Coherent version of make throws away everything from
	a # to the end of the line.  This means that you can't
	have any #'s in commands used to build a target -- not
	even in single quoted strings.  I tried all of the ways
	I could think of to escape or quote a # in a makefile, but
	nothing seemed to work.

	target: source
		sed 's/#/pound/' source >target

	doesn't work, since make will try to execute the command

		sed 's/

	The following also produces problems:

	target: source
		command1
	# 	comment line
		command2
	
	In the above case, command2 isn't executed, and make expects
	command2 to be another target:source line or something.


7. I	Most other versions of make which I have used treat $(VAR)
	and ${VAR} identically.  Coherent make only knows about $(VAR).


8. I 	The bourne shell case statement is slightly different from other
	bourne shells which I've used.  The Coherent version requires 
	either a newline or semicolon between the 'in' and the first case.

	case $var in 1) echo 1;; 2) echo 2;; esac

	works on other systems, but on Coherent you have to put in a
	semicolon after the in

	case $var in; 1) echo 1;; 2) echo 2;; esac
	            

9. B	The bourne shell ${var-word} substitution doesn't work for the 
	case where var is undefined and word is either a back-quoted command
	or something like $otherVariable.  

	It also appears that ${x=$y} doesn't work, you may want to
	take a look at that whole family of substitutions.

	I have run the following shell script on a number of systems:

#!/bin/sh
#
#
# we are testing the case where z is undefined !
#
y=${z-plainWord}

if [ "$y" != plainWord ] ; then
	echo '${z-plainWord} FAIL'
else
	echo '${z-plainWord} PASS'
fi
	
x=1

y=${z-$x}

if [ "$y" != "$x" ] ; then
	echo '${z-$x} FAIL'
else
	echo '${z-$x} PASS'
fi

testfileContents="testfile contents"

cat >testfile <<EOF
$testfileContents
EOF

y=${z-`cat testfile`}

if [ "$y" != "$testfileContents" ] ; then
	echo '${z-`cmd`} FAIL'
else
	echo '${z-`cmd`} PASS'
fi



	The results are:

	System / shell		plain	var	`cmd`
	----------------------	------	------	------
	Sequent Dynix / bourne	PASS	PASS	PASS
	BSD4.3 / bourne		PASS	PASS	PASS
	BSD4.3 / korn		PASS	PASS	PASS
	SunOS / bourne		PASS	PASS	PASS
	SunOS / korn		PASS	PASS	PASS
	PC-DOS / mks korn	PASS	PASS	PASS
	Coherent / bourne	PASS	FAIL	FAIL



In summary, porting to Coherent is usually pretty easy, but some of
the more intricate shell scripts usually require more work than one
would expect.

Stay tuned, The Coherent port of RCS 5.5 should be ready any day.


                                  Grant Edwards
Rosemount Inc, CB7                                            He who dies with
12001 Technology Drive      grante@hydro.rosemount.com        the most manuals
Eden Prairie, MN  55344     uunet!rosevax!hydro!grante        wins.


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

End of Coherent Digest Vol. 91.1, No. 4
***************************************
-- 
	Scott Rose
	rose@cs.wisc.edu