HP-UX 11i and largefiles on rsync
Steve Bonds
knnf6cy7w001 at sneakemail.com
Mon Apr 4 18:33:30 GMT 2005
On Apr 1, 2005 5:30 PM, Wayne Davison wrote:
> I attempted a fix for this by having the code not use mkstemp() if
> open64() was around but mkstemp64() was not. However, not having any HP
> systems around to test this on, I never heard if this was helpful or
> not. Apparently not.
Don't you wish there were a good PA-RISC emulator out there? HP-UX is
so strange, I can't imagine writing software for HP-UX without a
build/test system.
> I'd prefer to add rules to configure that don't require trying to write
> a large sparse file or to use the O_LARGEFILE kluge, but I'm open to
> suggestions on whether creating a 64-bit binary is better than just
> disabling HAVE_SECURE_MKSTEMP for HP-UX. I think the latter would
> probably be good enough, if we just want to go that route. What's the
> best way to detect HP-UX, anyway?
If we can avoid using mktemp(), I'd like to since relying on file
locking for security on a UNIX system is potentially dangerous. I
think the chances of creating an exploitable security problem by using
mktemp() in the same directory as the destination file are pretty
slim, but it's possible.
My main concern with a 64-bit binary would be compatibility if the
binary were copied onto a system running 32-bit HPUX. These are
becoming quite rare, so this is less of a concern.
The comp.sys.hp.hpux FAQ number 6.2.7 has this to say on detecting HPUX:
-----
Subject: 6.2.7 How can I detect the HP-UX version at compile time?
The below macro sequence allows you to figure out the HP-UX major
version number:
#include <sys/privgrp.h>
#if defined(PRIV_PSET)
#define _hpux_11i
#elif defined(PRIV_SPUCTL)
#define __hpux_11x
#elif defined(PRIV_SERIALIZE)
#define __hpux_10x
#elif defined(PRIV_SETRUGID)
#define __hpux_9x
#endif
(Added by Ian, 05/02/02)
-----
>From either http://web.archive.org/web/20030324214118/faqs.org/faqs/hp/hpux-faq/
or http://www.faqs.org/faqs/hp/hpux-faq/.
This was also useful, since it could be used to limit building a 64
bit binary only on 64-bit systems:
-----
Subject: 5.5.1 How can I tell if I have a 32-bit or 64-bit kernel?
First off, in all versions of HP-UX prior to 11.00, the kernel is always
32-bit. That being said, on 11.x systems, there are several ways to
determine whether you're running a 32 or 64 bit kernel...
>From the command-line
=====================
$ getconf KERNEL_BITS
... trimmed ...
(Thanks to Brian Hackley <brian_hackley at hp.com> and Ian)
(Added by Ian, 04/19/01)
-----
The above can also be accomplished via C code using sysconf().
Finally, I found a problem trying to build a 64-bit HPUX binary using
the current configure script. syscall.c uses the results of
"AC_CHECK_SIZEOF(off64_t)" to infer the existence of lseek64(). This
fails on HP-UX since off64_t is defined, but lseek64() doesn't exist.
I'd suggest a direct check for lseek64() instead of this inference, if possible.
How's this for a plan?
1) On 64-bit HP-UX systems, build a 64-bit binary (above lseek64 fix
will be needed)
2) On 32-bit HP-UX systems, build using mktemp()
I've also noticed that "make test" fails every rsync daemon mode test
on HP-UX. I'm still investigating but it looks like a either typecast
in socket.c getsockname or a problem with "htonl(INADDR_LOOPBACK)" (of
all things) leads to a failure to bind the socket when run in daemon
mode.
-- Steve
More information about the rsync
mailing list