Limits on 4.2BSD lseek(2)?
Greg Earle
earle at smeagol.UUCP
Fri May 16 15:06:31 AEST 1986
In article <717 at smeagol.UUCP>, earle at smeagol.UUCP I wrote:
> In the Netnews 2.10.3 4.3bsd-beta 6/6/85 distibution, there is a program
> called article (written by Peter Honeyman, down!honey) that comes in
> the `misc' directory. This program will take an article message ID
> (like 1052 at ellie, 1424 at lll-crg, etc.), look it up in the dbm version
> of the news history file, and if it finds it, will print out the
> first pathname it finds for the article (if it was cross-posted), by
> fetching the line containing the article ID from the history file.
[ Example omitted ]
> The problem I have found, is that more often than not, the program will
> blow up on a Bus Error. This happens on a Sun 2-120 workstation, running
> Sun OS 2.0 (4.2BSD based). The cause of this Bus Error is an execution
> of lseek(2).
No it's not, idiot ...
> I am finding that it retrieves some articles with no problem, but most of
> them are gagging with the accompaning Bus Error.
Like the guy at the school crossing once said:
Look both ways before posting.
I got bitten by the Famous 680x0 long-pointer-must-be-word-aligned
problem ...
The program blows up when the pointer value in the datum that is returned
by fetch() is odd; i.e. not word aligned. When interpreted as a (long *)
and dereferenced, gag city ...
Thanks to voder!jeff for pointing this out just as I was realizing it myself.
That's what I get for not being a dbm expert, & forgetting Machine Dependencies
to boot :-(
Hopefully this will get out before I get too much "Geez, what a MAROON" mail.
BTW, the fix:
Add a
long fpos;
declaration to main, and before the lseek insert
/* The bcopy is NECESSARY to insure alignment on some machines */
bcopy(content.dptr, (char *)&fpos, sizeof (long));
This is from the file funcs2.c, function findhist(); in the 2.10.3 4.3bsd-beta
Netnews distribution.
Again, my apologies for the original posting. Oh well, maybe some of you
got a good laugh out of it, so ...
--
Greg Earle UUCP: sdcrdcf!smeagol!earle; (new!!) attmail!earle
JPL ARPA: elroy!smeagol!earle at csvax.caltech.edu
Hello, GORRY-O!! I'm a GENIUS from HARVARD!!
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list