Subject: Re: PGP262i for Sun3/60-NetBSD (fwd)
To: None <port-sun3@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: port-sun3
Date: 08/31/1995 22:56:36
> For some time now I've been trying to get pgp running on my Sun.  I
> found the sources for the current international version, 2.6.2i.
> They compile out of the box when I do a "make sun3gcc", without any
> warnings, but the resulting code won't work.  [...]  Probably, the
> problems stem from the lseek()-function that is used by the
> compression-code.

> So I would like to know wether there are any differences in the
> lseek() between SunOS and NetBSD (the makefile-target sun3gcc is of
> course for SunOS).

Yes, there are.  Almost certainly, what is happening is that the code
is calling lseek() without a correct prototype in scope, with an offset
argument of type long.  NetBSD's lseek takes a 64-bit offset argument
(type off_t, which is 64-bit); on a 32-bit machine like the Sun-3, if
you manage to actually pass a 32-bit offset - which is what happens if
you don't have a correct prototype in scope, and pass a long for that
argument - it won't work, because the third argument will end up being
misinterpreted as the other half of the offset, and some random garbage
(stack trash, or whatever's in some register, or some such) will get
used as the third argument.  Not Good.

> Also, could someone with more experience in these matters help me out
> with getting pgp running on my Sun?

Build with -Wstrict-prototypes -Wmissing-prototypes, and pull in the
necessary include files to prototype everything.

Of course, that assumes that the pgp code itself is fully prototyped.
I don't know whether it is or not.  If not, you may be able to get away
with just fixing lseek().  (You can do that by compiling everything to
.o files, using nm -o *.o | egrep lseek to find the ones that refer to
lseek, and adding the appropriate #include, or a correct prototype (ie,
second argument having type off_t) to each one, then rebuilding.)

					der Mouse