Thread: AIX port current

AIX port current

From
"Zeugswetter Andreas SB SD"
Date:
On AIX 4.3.2 dlfcn.h is not compatible with fcntl.h in the given constellation
(both define FREAD and FWRITE differently) and since fcntl.h in c.h is only needed
for O_BINARY I suggest to include fcntl.h only if O_BINARY is needed.

Second, LLONG_MIN (used in ecpg's misc.c) is not available on AIX.
I am not sure whether the original has a typo there or not
(using LONG_LONG_MIN instead of LONGLONG_MIN) (patch assumes no typo) ?

Fix for both attached, please (consider to) apply.
At least the second part of the patch has no risk, as far as I can see.

Andreas

Attachment

Re: AIX port current

From
Bruce Momjian
Date:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

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


Zeugswetter Andreas SB SD wrote:
>
> On AIX 4.3.2 dlfcn.h is not compatible with fcntl.h in the given constellation
> (both define FREAD and FWRITE differently) and since fcntl.h in c.h is only needed
> for O_BINARY I suggest to include fcntl.h only if O_BINARY is needed.
>
> Second, LLONG_MIN (used in ecpg's misc.c) is not available on AIX.
> I am not sure whether the original has a typo there or not
> (using LONG_LONG_MIN instead of LONGLONG_MIN) (patch assumes no typo) ?
>
> Fix for both attached, please (consider to) apply.
> At least the second part of the patch has no risk, as far as I can see.
>
> Andreas

Content-Description: aix_fcntl.patch

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: AIX port current

From
Tom Lane
Date:
"Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at> writes:

>   #include <errno.h>
> + #if defined(__CYGWIN__) || defined(WIN32)
>   #include <fcntl.h>                /* ensure O_BINARY is available */
> + #endif

I don't feel that this will fly.  The comment on the #include line is
hopelessly out of touch with reality --- if you check the list of
symbols defined in fcntl.h you will find a bunch that are used all over
the place, eg SEEK_SET, O_RDONLY, O_CREAT, O_NDELAY, S_IRUSR.  Perhaps
we could #include <fcntl.h> in the various .c files that use these
symbols rather than in c.h, but is that really a step forward?  If there
are any such .c files that also need the conflicting AIX header, we're
still screwed.  Please propose another answer.  Or get AIX to fix their
broken headers.

I have no strong objection to the ecpg part of the proposed patch,
though like Andreas I wonder what's really going on there.  The C99
spec is perfectly clear that LLONG_MIN is the standard spelling ---
why is ecpg apparently choosing another preferred spelling?

            regards, tom lane

Re: AIX port current

From
"Zeugswetter Andreas SB SD"
Date:
> >   #include <errno.h>
> > + #if defined(__CYGWIN__) || defined(WIN32)
> >   #include <fcntl.h>                /* ensure O_BINARY is available */
> > + #endif
>
> I don't feel that this will fly.  The comment on the #include line is
> hopelessly out of touch with reality --- if you check the list of
> symbols defined in fcntl.h you will find a bunch that are
> used all over
> the place, eg SEEK_SET, O_RDONLY, O_CREAT, O_NDELAY, S_IRUSR.  Perhaps
> we could #include <fcntl.h> in the various .c files that use these
> symbols rather than in c.h, but is that really a step
> forward?  If there

(iirc the include was introduced with the windows port, no ?)
Actually, I think the files (at least from the main source) that need those symbols
have the include in the respective .c files, but ...

> are any such .c files that also need the conflicting AIX header, we're
> still screwed.  Please propose another answer.  Or get AIX to fix their
> broken headers.

Since it is only dynloader.h and plpython.c that has dlfcn.h do you think a
patch that #undef's the offending symbols before the dlfcn.h include is ok,
or is an #ifndef _AIX in c.h better ?

Andreas

Re: AIX port current

From
Tom Lane
Date:
"Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at> writes:
>> I don't feel that this will fly.

> (iirc the include was introduced with the windows port, no ?)

Hmm, you are right; 7.3 c.h has

#ifdef __CYGWIN__
#include <errno.h>
#include <sys/fcntl.h>            /* ensure O_BINARY is available */
#endif

so actually there has never been an assumption that c.h would include
<fcntl.h> generally.  Okay, objection withdrawn.

            regards, tom lane

Re: AIX port current

From
Tom Lane
Date:
"Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at> writes:
> On AIX 4.3.2 dlfcn.h is not compatible with fcntl.h in the given constellat=
> ion
> (both define FREAD and FWRITE differently) and since fcntl.h in c.h is only=
>  needed=20
> for O_BINARY I suggest to include fcntl.h only if O_BINARY is needed.

> Second, LLONG_MIN (used in ecpg's misc.c) is not available on AIX.
> I am not sure whether the original has a typo there or not=20
> (using LONG_LONG_MIN instead of LONGLONG_MIN) (patch assumes no typo) ?

Patch committed.

            regards, tom lane

Re: AIX port current

From
Bruce Momjian
Date:
Applied by Tom.

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

Zeugswetter Andreas SB SD wrote:
>
> On AIX 4.3.2 dlfcn.h is not compatible with fcntl.h in the given constellation
> (both define FREAD and FWRITE differently) and since fcntl.h in c.h is only needed
> for O_BINARY I suggest to include fcntl.h only if O_BINARY is needed.
>
> Second, LLONG_MIN (used in ecpg's misc.c) is not available on AIX.
> I am not sure whether the original has a typo there or not
> (using LONG_LONG_MIN instead of LONGLONG_MIN) (patch assumes no typo) ?
>
> Fix for both attached, please (consider to) apply.
> At least the second part of the patch has no risk, as far as I can see.
>
> Andreas

Content-Description: aix_fcntl.patch

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073