[comp.unix.ultrix] N-Buffering document bug?

wyatt@cfa.UUCP (Bill Wyatt) (11/18/87)

Reply-Path:



I've had two problems with Ultrix documentation, one of which 
I'm warning others about, the second I'd like input about:

(1) I've been writing a disk-to-tape copier, for which I naturally wanted
the best performance. This means using the new Ultrix (2.0) n-buffering
options, of course. 

Well, I couldn't get it to work for many hours. That is, the program
would copy files to tape, but it just *wouldn't* do the
multiple-buffering, even though I handled all the ioctl()'s correctly,
got back all the right return values, etc.

Finally, I looked at the source for dd (thank god we had it!). It seems
that dd makes calls to sbrk(bufsize+1024) instead of malloc(), which
I had been using. As far as I can see, this forces the buffers to be
on page boundaries, which my code didn't. I duplicated the use of
sbrk(), and poof! it worked.

The point is, as far as I can tell THE DOCUMENTATION SAYS NOTHING
ABOUT REQUIRED PAGE ALIGNMENT. I've looked through the release notes
and all the section 4 manual pages. I've wasted a lot of time! Does
anyone know about the reasons for this requirement?

(2) As part of this same program, I have to copy these files in a certain
default blocking format (FITS files, for you astronomy types out there),
and I'd like to always add data to the end of the tape, i.e. search for
the double tape mark, backspace over the last, then start writing. 
 
The trouble is, in order to do the right thing no matter where the tape
is positioned, I need to be able to query the tape device as to
whether it is at the BOT. Actually, I could do it, but error messages
print out on the console if you attempt a backspace while at the BOT, 
and I'd like to eliminate that.

I can see how to do this (by looking at the drivers) for ts11 devices,
using the MTIOCGET ioctl(), but there simply doesn't seem to be an
equivalent for the tmscp devices. At least, the M_ST_BOT flag never
seems to be set and available to either the MTIOCGET or DEVIOCGET
calls in one of the output status words.

Does anyone have any ideas about this?

Bill    UUCP:  {seismo|ihnp4}!harvard!cfa!wyatt
Wyatt   ARPA:  wyatt@cfa.harvard.edu
         (or)  wyatt%cfa@harvard.harvard.edu
      BITNET:  wyatt@cfa2
        SPAN:  cfa2::wyatt