threads / patch / 11327

patchHP-UX does not have select.h

Subject: [PATCH] HP-UX does not have select.h

## tl;dr

20 messages between Dec 17, 2007 and Dec 23, 2007. Diffs are folded; open one to read it.

replies: 19people: 6as markdown or json

H.Merijn Brand· Dec 17, 2007, 18:23 UTC · lore

HP-UX does not have select.h, but it offers all select () functionality. The defines are in <sys/types.h> and <X11/fd.h>

Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
---

diff -pur git-2007-12-10_01/git-compat-util.h git-2007-12-10/git-compat-util.h --- git-2007-12-10_01/git-compat-util.h 2007-12-09 10:23:48 +0100 +++ git-2007-12-10/git-compat-util.h 2007-12-10 14:25:26 +0100

Show changes to diff +2 −0
@@ -68,7 +68,9 @@
 #include <sys/poll.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+#ifndef _HPUX_SOURCE
 #include <sys/select.h>
+#endif
 #include <assert.h>
 #include <regex.h>
 #include <netinet/in.h>
-- 
git-2007-12-17

-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x  on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin.       http://qa.perl.org
http://mirrors.develooper.com/hpux/            http://www.test-smoke.org
                        http://www.goldmark.org/jeff/stupid-disclaimers/
Junio C Hamano· Dec 17, 2007, 21:00 UTC · re: H.Merijn Brand · lore

Re: [PATCH] HP-UX does not have select.h

"H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> HP-UX does not have select.h, but it offers all select () functionality.
> The defines are in <sys/types.h> and <X11/fd.h>

Will apply the patch as-is for now, only because I do not want major surgery during rc period, but I think is can be improved.

POSIX.1-2001 expects <sys/select.h> declares select(2). With earlier standards, including <sys/time.h>, <sys/types.h> and <unistd.h> would have given it.

HP-UX cannot be the only pre-POSIX system; "#ifndef _HPUX_SOURCE" feels very wrong.

Besides, isn't _HPUX_SOURCE a feature-test macro? Feature test macros are for the application to define, and for the implementation (iow, the header files) to find out what set of names the application wants to see. You are making the application examine the symbol to see what implementation it is on, which feels backwards to me.

H.Merijn Brand· Dec 17, 2007, 22:22 UTC · re: Junio C Hamano · lore

Re: [PATCH] HP-UX does not have select.h

On Mon, 17 Dec 2007 13:00:22 -0800, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> 
> > HP-UX does not have select.h, but it offers all select () functionality.
> > The defines are in <sys/types.h> and <X11/fd.h>
> 
> Will apply the patch as-is for now, only because I do not want major
> surgery during rc period, but I think is can be improved.
Probably. but there is so much to be improved :)
> POSIX.1-2001 expects <sys/select.h> declares select(2).  With earlier
> standards, including <sys/time.h>, <sys/types.h> and <unistd.h> would
> have given it.

Those three are there. I have 10.20 through 11.23 on PA-RISC and 11.23 on Itanium 2.

10.20, 11.00, and 11.11 (11i v1) do not have sys/select.h. 11.23 and on do have it. The problem for now is that git on HP-UX does not build with HP's C-ANSI-C compiler. I need to use gcc. Up to and including 11.11, I cannot use 4.x, as that has serious problems when used in 64bit mode, so I'm stuck with gcc-3.4.6

> HP-UX cannot be the only pre-POSIX system; "#ifndef _HPUX_SOURCE" feels
> very wrong.

HP-UX 11.23/IPC, which is rather recent, does include sys/select.h I didn't sent my HP-UX patch yet for the Makefile, as that is still very premature. It is OK for 11.00, but as I need 64bit on 11.23, because I only have 64bit OpenSSL and other util libraries, the 32bit addition would not work.

> Besides, isn't _HPUX_SOURCE a feature-test macro?  Feature test macros
That is defined in GNU gcc. I did not pass it with -D...
> are for the application to define, and for the implementation (iow, the
> header files) to find out what set of names the application wants to
> see.  You are making the application examine the symbol to see what
> implementation it is on, which feels backwards to me.
-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x  on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin.       http://qa.perl.org
http://mirrors.develooper.com/hpux/            http://www.test-smoke.org
                        http://www.goldmark.org/jeff/stupid-disclaimers/
Junio C Hamano· Dec 18, 2007, 05:29 UTC · re: H.Merijn Brand · lore

Re: [PATCH] HP-UX does not have select.h

"H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
Show 13 quoted lines
> On Mon, 17 Dec 2007 13:00:22 -0800, Junio C Hamano <gitster@pobox.com> wrote:
>
>> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
>> 
>> > HP-UX does not have select.h, but it offers all select () functionality.
>> > The defines are in <sys/types.h> and <X11/fd.h>
>> 
>> Will apply the patch as-is for now, only because I do not want major
>> surgery during rc period, but I think is can be improved.
> ...
>> Besides, isn't _HPUX_SOURCE a feature-test macro?  Feature test macros
>
> That is defined in GNU gcc. I did not pass it with -D...
Actually I changed my mind.  I won't be applying this as is.

For the selective inclusion of <sys/select.h>, I would prefer it see it done like the attached.

The main point is to limit the "platform" dependency to configure and Makefile, and keep #ifdef in the actual header files expressed in more generic terms (e.g. "do we need to (and can we) include sys/select.h here?").

I am fuzzy about the uname_S part, so I won't be applying the attached patch either; the attached is for demonstration purposes only.

Show changes to 4 files +15 −0

Makefile, config.mak.in, configure.ac, git-compat-util.h

diff --git a/Makefile b/Makefile
index 617e5f5..f9f724a 100644
--- a/Makefile
+++ b/Makefile
@@ -100,6 +100,9 @@ all::
 #
 # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
 #
+# Define NO_SYS_SELECT_H if your C library header files do not have <sys/select.h>
+# but you do have select(2) (pre POSIX.1-2001 systems, e.g. HP-UX before 11.23).
+#
 # Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
 # that tells runtime paths to dynamic libraries;
 # "-Wl,-rpath=/path/lib" is used instead.
@@ -504,6 +507,9 @@ endif
 ifneq (,$(findstring arm,$(uname_M)))
 	ARM_SHA1 = YesPlease
 endif
+ifeq ($(uname_S),HP-UX)
+	NO_SYS_SELECT_H = YesPlease
+endif
 
 -include config.mak.autogen
 -include config.mak
@@ -676,6 +682,10 @@ ifdef NO_DEFLATE_BOUND
 	BASIC_CFLAGS += -DNO_DEFLATE_BOUND
 endif
 
+ifdef NO_SYS_SELECT_H
+	BASIC_CFLAGS += -DNO_SYS_SELECT_H
+endif
+
 ifdef PPC_SHA1
 	SHA1_HEADER = "ppc/sha1.h"
 	LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
diff --git a/config.mak.in b/config.mak.in
index 15fb26c..e8890e0 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -44,3 +44,4 @@ NO_MKDTEMP=@NO_MKDTEMP@
 NO_ICONV=@NO_ICONV@
 OLD_ICONV=@OLD_ICONV@
 NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
+NO_SYS_SELECT_H=@NO_SYS_SELECT_H@
diff --git a/configure.ac b/configure.ac
index 6f641e3..3bfd0b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -256,6 +256,8 @@ AC_COMPILE_IFELSE(OLDICONVTEST_SRC,
 	OLD_ICONV=UnfortunatelyYes])
 AC_SUBST(OLD_ICONV)
 
+AC_CHECK_HEADER([sys/select.h], [], [NO_SYS_SELECT_H=YesPlease])
+AC_SUBST(NO_SYS_SELECT_H)
 
 ## Checks for typedefs, structures, and compiler characteristics.
 AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics])
diff --git a/git-compat-util.h b/git-compat-util.h
index 79eb10e..ec3585e 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -68,7 +68,9 @@
 #include <sys/poll.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+#ifndef NO_SYS_SELECT_H
 #include <sys/select.h>
+#endif
 #include <assert.h>
 #include <regex.h>
 #include <netinet/in.h>
H.Merijn Brand· Dec 18, 2007, 07:11 UTC · re: Junio C Hamano · lore

Re: [PATCH] HP-UX does not have select.h

On Mon, 17 Dec 2007 21:29:31 -0800, Junio C Hamano <gitster@pobox.com> wrote:
Show 20 quoted lines
> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> 
> > On Mon, 17 Dec 2007 13:00:22 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> >
> >> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> >> 
> >> > HP-UX does not have select.h, but it offers all select () functionality.
> >> > The defines are in <sys/types.h> and <X11/fd.h>
> >> 
> >> Will apply the patch as-is for now, only because I do not want major
> >> surgery during rc period, but I think is can be improved.
> > ...
> >> Besides, isn't _HPUX_SOURCE a feature-test macro?  Feature test macros
> >
> > That is defined in GNU gcc. I did not pass it with -D...
> 
> Actually I changed my mind.  I won't be applying this as is.
> 
> For the selective inclusion of <sys/select.h>, I would prefer it see it
> done like the attached.
So do I
Show 29 quoted lines
> The main point is to limit the "platform" dependency to configure and
> Makefile, and keep #ifdef in the actual header files expressed in more
> generic terms (e.g. "do we need to (and can we) include sys/select.h
> here?").
> 
> I am fuzzy about the uname_S part, so I won't be applying the attached
> patch either; the attached is for demonstration purposes only.
> 
> diff --git a/Makefile b/Makefile
> index 617e5f5..f9f724a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -100,6 +100,9 @@ all::
>  #
>  # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
>  #
> +# Define NO_SYS_SELECT_H if your C library header files do not have <sys/select.h>
> +# but you do have select(2) (pre POSIX.1-2001 systems, e.g. HP-UX before 11.23).
> +#
>  # Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
>  # that tells runtime paths to dynamic libraries;
>  # "-Wl,-rpath=/path/lib" is used instead.
> @@ -504,6 +507,9 @@ endif
>  ifneq (,$(findstring arm,$(uname_M)))
>  	ARM_SHA1 = YesPlease
>  endif
> +ifeq ($(uname_S),HP-UX)
> +	NO_SYS_SELECT_H = YesPlease
> +endif

# uname -s HP-UX # uname -r B.11.00 #

-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x  on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin.       http://qa.perl.org
http://mirrors.develooper.com/hpux/            http://www.test-smoke.org
                        http://www.goldmark.org/jeff/stupid-disclaimers/
Johannes Sixt· Dec 18, 2007, 08:16 UTC · re: Junio C Hamano · lore

Re: [PATCH] HP-UX does not have select.h

Junio C Hamano schrieb:
Show 18 quoted lines
> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> 
>> On Mon, 17 Dec 2007 13:00:22 -0800, Junio C Hamano <gitster@pobox.com> wrote:
>>
>>> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
>>>
>>>> HP-UX does not have select.h, but it offers all select () functionality.
>>>> The defines are in <sys/types.h> and <X11/fd.h>
>>> Will apply the patch as-is for now, only because I do not want major
>>> surgery during rc period, but I think is can be improved.
>> ...
>>> Besides, isn't _HPUX_SOURCE a feature-test macro?  Feature test macros
>> That is defined in GNU gcc. I did not pass it with -D...
> 
> Actually I changed my mind.  I won't be applying this as is.
> 
> For the selective inclusion of <sys/select.h>, I would prefer it see it
> done like the attached.

Is select() actually needed? The one instance in pager.c can easily be replaced by poll(), which I've already done in my own tree. The other one in http.c is only used as a timer, but I don't know how to get rid of that. Maybe a setitimer()/pause() combo?

-- Hannes
Johannes Schindelin· Dec 18, 2007, 12:38 UTC · re: Johannes Sixt · lore

Re: [PATCH] HP-UX does not have select.h

Hi,
On Tue, 18 Dec 2007, Johannes Sixt wrote:
Show 25 quoted lines
> Junio C Hamano schrieb:
> > "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> > 
> >> On Mon, 17 Dec 2007 13:00:22 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> >>
> >>> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> >>>
> >>>> HP-UX does not have select.h, but it offers all select () 
> >>>> functionality. The defines are in <sys/types.h> and <X11/fd.h>
> >>> Will apply the patch as-is for now, only because I do not want major 
> >>> surgery during rc period, but I think is can be improved.
> >> ...
> >>> Besides, isn't _HPUX_SOURCE a feature-test macro?  Feature test 
> >>> macros
> >> That is defined in GNU gcc. I did not pass it with -D...
> > 
> > Actually I changed my mind.  I won't be applying this as is.
> > 
> > For the selective inclusion of <sys/select.h>, I would prefer it see 
> > it done like the attached.
> 
> Is select() actually needed? The one instance in pager.c can easily be 
> replaced by poll(), which I've already done in my own tree. The other 
> one in http.c is only used as a timer, but I don't know how to get rid 
> of that. Maybe a setitimer()/pause() combo?

I'd be cautious about using poll(). AFAIK MacOSX 10.2.8 does not have poll(), and IIRC I had problems finding it in MinGW, too. I know, we use it in daemon, upload-archive and upload-pack, but these are not typically functions performed by a client, so I would not know if it worked on my (now-dead) iBook, or on msysGit.

Ciao, Dscho

Johannes Sixt· Dec 18, 2007, 12:45 UTC · re: Johannes Schindelin · lore

Re: [PATCH] HP-UX does not have select.h

Johannes Schindelin schrieb:
Show 33 quoted lines
> Hi,
> 
> On Tue, 18 Dec 2007, Johannes Sixt wrote:
> 
>> Junio C Hamano schrieb:
>>> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
>>>
>>>> On Mon, 17 Dec 2007 13:00:22 -0800, Junio C Hamano <gitster@pobox.com> wrote:
>>>>
>>>>> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
>>>>>
>>>>>> HP-UX does not have select.h, but it offers all select () 
>>>>>> functionality. The defines are in <sys/types.h> and <X11/fd.h>
>>>>> Will apply the patch as-is for now, only because I do not want major 
>>>>> surgery during rc period, but I think is can be improved.
>>>> ...
>>>>> Besides, isn't _HPUX_SOURCE a feature-test macro?  Feature test 
>>>>> macros
>>>> That is defined in GNU gcc. I did not pass it with -D...
>>> Actually I changed my mind.  I won't be applying this as is.
>>>
>>> For the selective inclusion of <sys/select.h>, I would prefer it see 
>>> it done like the attached.
>> Is select() actually needed? The one instance in pager.c can easily be 
>> replaced by poll(), which I've already done in my own tree. The other 
>> one in http.c is only used as a timer, but I don't know how to get rid 
>> of that. Maybe a setitimer()/pause() combo?
> 
> I'd be cautious about using poll().  AFAIK MacOSX 10.2.8 does not have 
> poll(), and IIRC I had problems finding it in MinGW, too.  I know, we use 
> it in daemon, upload-archive and upload-pack, but these are not typically 
> functions performed by a client, so I would not know if it worked on my 
> (now-dead) iBook, or on msysGit.

So what? If we use poll() already in daemon, upload-archive and upload-pack, and no MacOSX 10.2.8 user has spoken up with a proposal for replacement, then yet another use won't raise a complaint, either.

And if it were a problem for msysGit, I wouldn't have suggested it ;) The particular use in pager.c would be inside #ifndef __MINGW32__ #endif anyway.

-- Hannes
Johannes Schindelin· Dec 18, 2007, 13:53 UTC · re: Johannes Sixt · lore

Re: [PATCH] HP-UX does not have select.h

Hi,
On Tue, 18 Dec 2007, Johannes Sixt wrote:
Show 37 quoted lines
> Johannes Schindelin schrieb:
> > 
> > On Tue, 18 Dec 2007, Johannes Sixt wrote:
> > 
> >> Junio C Hamano schrieb:
> >>> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> >>>
> >>>> On Mon, 17 Dec 2007 13:00:22 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> >>>>
> >>>>> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> >>>>>
> >>>>>> HP-UX does not have select.h, but it offers all select () 
> >>>>>> functionality. The defines are in <sys/types.h> and <X11/fd.h>
> >>>>> Will apply the patch as-is for now, only because I do not want 
> >>>>> major surgery during rc period, but I think is can be improved.
> >>>> ...
> >>>>> Besides, isn't _HPUX_SOURCE a feature-test macro?  Feature test 
> >>>>> macros
> >>>> That is defined in GNU gcc. I did not pass it with -D...
> >>> Actually I changed my mind.  I won't be applying this as is.
> >>>
> >>> For the selective inclusion of <sys/select.h>, I would prefer it see 
> >>> it done like the attached.
> >> Is select() actually needed? The one instance in pager.c can easily 
> >> be replaced by poll(), which I've already done in my own tree. The 
> >> other one in http.c is only used as a timer, but I don't know how to 
> >> get rid of that. Maybe a setitimer()/pause() combo?
> > 
> > I'd be cautious about using poll().  AFAIK MacOSX 10.2.8 does not have 
> > poll(), and IIRC I had problems finding it in MinGW, too.  I know, we 
> > use it in daemon, upload-archive and upload-pack, but these are not 
> > typically functions performed by a client, so I would not know if it 
> > worked on my (now-dead) iBook, or on msysGit.
> 
> So what? If we use poll() already in daemon, upload-archive and 
> upload-pack, and no MacOSX 10.2.8 user has spoken up with a proposal for 
> replacement, then yet another use won't raise a complaint, either.

daemon, upload-archive and upload-pack are server-side functions, so they are substantially less well tested.

> And if it were a problem for msysGit, I wouldn't have suggested it ;) 
> The particular use in pager.c would be inside #ifndef __MINGW32__ #endif 
> anyway.
We still did not integrate the 'daemon' branch of 4msysgit, correct?

I'm just wary to replace a tried-and-tested select() with a poll() that I had plenty of problems with.

Ciao, Dscho

Johannes Sixt· Dec 18, 2007, 14:22 UTC · re: Johannes Schindelin · lore

Re: [PATCH] HP-UX does not have select.h

Johannes Schindelin schrieb:
Show 13 quoted lines
> On Tue, 18 Dec 2007, Johannes Sixt wrote:
>> Johannes Schindelin schrieb:
>>> I'd be cautious about using poll().  AFAIK MacOSX 10.2.8 does not have 
>>> poll(), and IIRC I had problems finding it in MinGW, too.  I know, we 
>>> use it in daemon, upload-archive and upload-pack, but these are not 
>>> typically functions performed by a client, so I would not know if it 
>>> worked on my (now-dead) iBook, or on msysGit.
>> So what? If we use poll() already in daemon, upload-archive and 
>> upload-pack, and no MacOSX 10.2.8 user has spoken up with a proposal for 
>> replacement, then yet another use won't raise a complaint, either.
> 
> daemon, upload-archive and upload-pack are server-side functions, so they 
> are substantially less well tested.

upload-pack is used for local fetches and, therefore, should be well-tested on all systems.

Show 5 quoted lines
>> And if it were a problem for msysGit, I wouldn't have suggested it ;) 
>> The particular use in pager.c would be inside #ifndef __MINGW32__ #endif 
>> anyway.
> 
> We still did not integrate the 'daemon' branch of 4msysgit, correct?
No, we didn't.
-- Hannes
Andreas Ericsson· Dec 18, 2007, 09:30 UTC · re: Junio C Hamano · lore

Re: [PATCH] HP-UX does not have select.h

Junio C Hamano wrote:
Show 6 quoted lines
> 
> Besides, isn't _HPUX_SOURCE a feature-test macro?  Feature test macros
> are for the application to define, and for the implementation (iow, the
> header files) to find out what set of names the application wants to
> see.  You are making the application examine the symbol to see what
> implementation it is on, which feels backwards to me.
  #if defined(hpux) || defined(_hpux) || defined(__hpux)
should work ok, although as you say, trying
  #if _POSIX_VERSION < 200112
  # include <non-POSIX.1-2001 headers>
  #else
  # include <sys/select.h>
  #endif
would probably be more suitable.
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Junio C Hamano· Dec 18, 2007, 09:47 UTC · re: Andreas Ericsson · lore

Re: [PATCH] HP-UX does not have select.h

Andreas Ericsson <ae@op5.se> writes:
Show 20 quoted lines
> Junio C Hamano wrote:
>>
>> Besides, isn't _HPUX_SOURCE a feature-test macro?  Feature test macros
>> are for the application to define, and for the implementation (iow, the
>> header files) to find out what set of names the application wants to
>> see.  You are making the application examine the symbol to see what
>> implementation it is on, which feels backwards to me.
>
>
>  #if defined(hpux) || defined(_hpux) || defined(__hpux)
>
> should work ok, although as you say, trying
>
>  #if _POSIX_VERSION < 200112
>  # include <non-POSIX.1-2001 headers>
>  #else
>  # include <sys/select.h>
>  #endif
>
> would probably be more suitable.

I cannot take credit for having said that (I didn't), but it sounds like a sensible thing to compare _POSIX_VERSION with 200112L. For previous SUS, <sys/time.h> would have defined select(2), but that header file is already included anyway.

Merijn, discarding the earlier patch I did to configure it out for HP-UX, does the following patch based on Andreas's idea work for you?

---
 git-compat-util.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Show changes to git-compat-util.h +2 −0
diff --git a/git-compat-util.h b/git-compat-util.h
index 79eb10e..68a580f 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -68,7 +68,9 @@
 #include <sys/poll.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+#if _POSIX_VERSION >= 200112L
 #include <sys/select.h>
+#endif
 #include <assert.h>
 #include <regex.h>
 #include <netinet/in.h>
H.Merijn Brand· Dec 18, 2007, 10:49 UTC · re: Junio C Hamano · lore

Re: [PATCH] HP-UX does not have select.h

On Tue, 18 Dec 2007 01:47:53 -0800, Junio C Hamano <gitster@pobox.com> wrote:
Show 30 quoted lines
> Andreas Ericsson <ae@op5.se> writes:
> 
> > Junio C Hamano wrote:
> >>
> >> Besides, isn't _HPUX_SOURCE a feature-test macro?  Feature test macros
> >> are for the application to define, and for the implementation (iow, the
> >> header files) to find out what set of names the application wants to
> >> see.  You are making the application examine the symbol to see what
> >> implementation it is on, which feels backwards to me.
> >
> >
> >  #if defined(hpux) || defined(_hpux) || defined(__hpux)
> >
> > should work ok, although as you say, trying
> >
> >  #if _POSIX_VERSION < 200112
> >  # include <non-POSIX.1-2001 headers>
> >  #else
> >  # include <sys/select.h>
> >  #endif
> >
> > would probably be more suitable.
> 
> I cannot take credit for having said that (I didn't), but it sounds like
> a sensible thing to compare _POSIX_VERSION with 200112L.  For previous
> SUS, <sys/time.h> would have defined select(2), but that header file is
> already included anyway.
> 
> Merijn, discarding the earlier patch I did to configure it out for
> HP-UX, does the following patch based on Andreas's idea work for you?
Probably not:
HP-UX 10.20, 11.00, 11.11, 11.23/PA, and 11.23/IPF all have:

/usr/include 103 > grep -r POSIX_VERSION * sys/unistd.h:# define _POSIX_VERSION _POSIX1_VERSION_88 sys/unistd.h:# define _POSIX_VERSION _POSIX1_VERSION_90 sys/unistd.h:# define _POSIX_VERSION _POSIX1_VERSION_93 sys/unistd.h:# define _SC_1_VERSION_88 7 /* _POSIX_VERSION: Date of POSIX.1-1988 */ sys/unistd.h:# define _SC_1_VERSION_90 102 /* _POSIX_VERSION: Date of POSIX.1-1990 */ sys/unistd.h:# define _SC_1_VERSION_93 103 /* _POSIX_VERSION: Date of POSIX.1b-1993 */ sys/unistd.h:# if (_POSIX_VERSION == _POSIX1_VERSION_88) sys/unistd.h:# if (_POSIX_VERSION == _POSIX1_VERSION_90)

and the two 11.23 do have select.h
Show 19 quoted lines
> ---
> 
>  git-compat-util.h |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 79eb10e..68a580f 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -68,7 +68,9 @@
>  #include <sys/poll.h>
>  #include <sys/socket.h>
>  #include <sys/ioctl.h>
> +#if _POSIX_VERSION >= 200112L
>  #include <sys/select.h>
> +#endif
>  #include <assert.h>
>  #include <regex.h>
>  #include <netinet/in.h>
-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x  on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin.       http://qa.perl.org
http://mirrors.develooper.com/hpux/            http://www.test-smoke.org
                        http://www.goldmark.org/jeff/stupid-disclaimers/
Junio C Hamano· Dec 19, 2007, 19:57 UTC · re: H.Merijn Brand · lore

Re: [PATCH] HP-UX does not have select.h

"H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
Show 20 quoted lines
> On Tue, 18 Dec 2007 01:47:53 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> ...
>> Merijn, discarding the earlier patch I did to configure it out for
>> HP-UX, does the following patch based on Andreas's idea work for you?
>
> Probably not:
>
> HP-UX 10.20, 11.00, 11.11, 11.23/PA, and 11.23/IPF all have:
>
> /usr/include 103 > grep -r POSIX_VERSION *
> sys/unistd.h:#    define _POSIX_VERSION _POSIX1_VERSION_88
> sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_90
> sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_93
> sys/unistd.h:#  define _SC_1_VERSION_88    7     /* _POSIX_VERSION: Date of POSIX.1-1988 */
> sys/unistd.h:#  define _SC_1_VERSION_90   102 /* _POSIX_VERSION: Date of POSIX.1-1990 */
> sys/unistd.h:#  define _SC_1_VERSION_93   103 /* _POSIX_VERSION: Date of POSIX.1b-1993 */
> sys/unistd.h:#  if (_POSIX_VERSION == _POSIX1_VERSION_88)
> sys/unistd.h:#    if (_POSIX_VERSION == _POSIX1_VERSION_90)
>
> and the two 11.23 do have select.h

Does that prove anything? unistd.h seem to define _POSIX_VERSION to various values but we do not see surrounding "#ifdef WE_DO_NOT_KNOW" from the grep output above unfortunately.

If the folllowing actually works I think that is the cleanest fix for this issue (note that I added defined(_POSIX_VERSION) there just to be safe if it is not defined at all).

 git-compat-util.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Show changes to git-compat-util.h +2 −0
diff --git a/git-compat-util.h b/git-compat-util.h
index 79eb10e..68a580f 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -68,7 +68,9 @@
 #include <sys/poll.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L
 #include <sys/select.h>
+#endif
 #include <assert.h>
 #include <regex.h>
 #include <netinet/in.h>
H.Merijn Brand· Dec 19, 2007, 20:12 UTC · re: Junio C Hamano · lore

Re: [PATCH] HP-UX does not have select.h

On Wed, 19 Dec 2007 11:57:21 -0800, Junio C Hamano <gitster@pobox.com> wrote:
Show 26 quoted lines
> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> 
> > On Tue, 18 Dec 2007 01:47:53 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> > ...
> >> Merijn, discarding the earlier patch I did to configure it out for
> >> HP-UX, does the following patch based on Andreas's idea work for you?
> >
> > Probably not:
> >
> > HP-UX 10.20, 11.00, 11.11, 11.23/PA, and 11.23/IPF all have:
> >
> > /usr/include 103 > grep -r POSIX_VERSION *
> > sys/unistd.h:#    define _POSIX_VERSION _POSIX1_VERSION_88
> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_90
> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_93
> > sys/unistd.h:#  define _SC_1_VERSION_88    7     /* _POSIX_VERSION: Date of POSIX.1-1988 */
> > sys/unistd.h:#  define _SC_1_VERSION_90   102 /* _POSIX_VERSION: Date of POSIX.1-1990 */
> > sys/unistd.h:#  define _SC_1_VERSION_93   103 /* _POSIX_VERSION: Date of POSIX.1b-1993 */
> > sys/unistd.h:#  if (_POSIX_VERSION == _POSIX1_VERSION_88)
> > sys/unistd.h:#    if (_POSIX_VERSION == _POSIX1_VERSION_90)
> >
> > and the two 11.23 do have select.h
> 
> Does that prove anything?  unistd.h seem to define _POSIX_VERSION to
> various values but we do not see surrounding "#ifdef WE_DO_NOT_KNOW"
> from the grep output above unfortunately.

What I tried to demonstrate is that I have no clue about the actual value of this define, and if values like 88, 90, and 93 (7, 102, and 103) do have any relation with the higher value of 200112L that you use.

Also because these are the *only* _POSIX_VERSION defines in the entire include tree, and 11.23 does have a select.h, which makes the patch below to be not OK on 11.23. I'm not stating that HP follows the rules in any correct way, but if this is to be sure that select.h gets included if the OS supports it, it will fail.

Show 21 quoted lines
> If the folllowing actually works I think that is the cleanest fix for
> this issue (note that I added defined(_POSIX_VERSION) there just to be
> safe if it is not defined at all).
> 
>  git-compat-util.h |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 79eb10e..68a580f 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -68,7 +68,9 @@
>  #include <sys/poll.h>
>  #include <sys/socket.h>
>  #include <sys/ioctl.h>
> +#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L
>  #include <sys/select.h>
> +#endif
>  #include <assert.h>
>  #include <regex.h>
>  #include <netinet/in.h>
-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x  on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin.       http://qa.perl.org
http://mirrors.develooper.com/hpux/            http://www.test-smoke.org
                        http://www.goldmark.org/jeff/stupid-disclaimers/
Junio C Hamano· Dec 19, 2007, 21:31 UTC · re: H.Merijn Brand · lore

Re: [PATCH] HP-UX does not have select.h

"H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
Show 42 quoted lines
> On Wed, 19 Dec 2007 11:57:21 -0800, Junio C Hamano <gitster@pobox.com> wrote:
>
>> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
>> 
>> > On Tue, 18 Dec 2007 01:47:53 -0800, Junio C Hamano <gitster@pobox.com> wrote:
>> > ...
>> >> Merijn, discarding the earlier patch I did to configure it out for
>> >> HP-UX, does the following patch based on Andreas's idea work for you?
>> >
>> > Probably not:
>> >
>> > HP-UX 10.20, 11.00, 11.11, 11.23/PA, and 11.23/IPF all have:
>> >
>> > /usr/include 103 > grep -r POSIX_VERSION *
>> > sys/unistd.h:#    define _POSIX_VERSION _POSIX1_VERSION_88
>> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_90
>> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_93
>> > sys/unistd.h:#  define _SC_1_VERSION_88    7     /* _POSIX_VERSION: Date of POSIX.1-1988 */
>> > sys/unistd.h:#  define _SC_1_VERSION_90   102 /* _POSIX_VERSION: Date of POSIX.1-1990 */
>> > sys/unistd.h:#  define _SC_1_VERSION_93   103 /* _POSIX_VERSION: Date of POSIX.1b-1993 */
>> > sys/unistd.h:#  if (_POSIX_VERSION == _POSIX1_VERSION_88)
>> > sys/unistd.h:#    if (_POSIX_VERSION == _POSIX1_VERSION_90)
>> >
>> > and the two 11.23 do have select.h
>> 
>> Does that prove anything?  unistd.h seem to define _POSIX_VERSION to
>> various values but we do not see surrounding "#ifdef WE_DO_NOT_KNOW"
>> from the grep output above unfortunately.
>
> What I tried to demonstrate is that I have no clue about the actual value
> of this define, and if values like 88, 90, and 93 (7, 102, and 103)  do
> have any relation with the higher value of 200112L that you use.
>
> Also because these are the *only* _POSIX_VERSION defines in the entire
> include tree, and 11.23 does have a select.h, which makes the patch below
> to be not OK on 11.23. I'm not stating that HP follows the rules in any
> correct way, but if this is to be sure that select.h gets included if the
> OS supports it, it will fail.
>
>> If the folllowing actually works I think that is the cleanest fix for
>> this issue (note that I added defined(_POSIX_VERSION) there just to be
>> safe if it is not defined at all).

But your grep did not catch their definition of _POSIX1_VERSION_$YEAR which are used to define the actual value of _POSIX_VERSION.

H.Merijn Brand· Dec 20, 2007, 07:18 UTC · re: Junio C Hamano · lore

Re: [PATCH] HP-UX does not have select.h

On Wed, 19 Dec 2007 13:31:58 -0800, Junio C Hamano <gitster@pobox.com> wrote:
Show 47 quoted lines
> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> 
> > On Wed, 19 Dec 2007 11:57:21 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> >
> >> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> >> 
> >> > On Tue, 18 Dec 2007 01:47:53 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> >> > ...
> >> >> Merijn, discarding the earlier patch I did to configure it out for
> >> >> HP-UX, does the following patch based on Andreas's idea work for you?
> >> >
> >> > Probably not:
> >> >
> >> > HP-UX 10.20, 11.00, 11.11, 11.23/PA, and 11.23/IPF all have:
> >> >
> >> > /usr/include 103 > grep -r POSIX_VERSION *
> >> > sys/unistd.h:#    define _POSIX_VERSION _POSIX1_VERSION_88
> >> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_90
> >> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_93
> >> > sys/unistd.h:#  define _SC_1_VERSION_88    7     /* _POSIX_VERSION: Date of POSIX.1-1988 */
> >> > sys/unistd.h:#  define _SC_1_VERSION_90   102 /* _POSIX_VERSION: Date of POSIX.1-1990 */
> >> > sys/unistd.h:#  define _SC_1_VERSION_93   103 /* _POSIX_VERSION: Date of POSIX.1b-1993 */
> >> > sys/unistd.h:#  if (_POSIX_VERSION == _POSIX1_VERSION_88)
> >> > sys/unistd.h:#    if (_POSIX_VERSION == _POSIX1_VERSION_90)
> >> >
> >> > and the two 11.23 do have select.h
> >> 
> >> Does that prove anything?  unistd.h seem to define _POSIX_VERSION to
> >> various values but we do not see surrounding "#ifdef WE_DO_NOT_KNOW"
> >> from the grep output above unfortunately.
> >
> > What I tried to demonstrate is that I have no clue about the actual value
> > of this define, and if values like 88, 90, and 93 (7, 102, and 103)  do
> > have any relation with the higher value of 200112L that you use.
> >
> > Also because these are the *only* _POSIX_VERSION defines in the entire
> > include tree, and 11.23 does have a select.h, which makes the patch below
> > to be not OK on 11.23. I'm not stating that HP follows the rules in any
> > correct way, but if this is to be sure that select.h gets included if the
> > OS supports it, it will fail.
> >
> >> If the folllowing actually works I think that is the cleanest fix for
> >> this issue (note that I added defined(_POSIX_VERSION) there just to be
> >> safe if it is not defined at all).
> 
> But your grep did not catch their definition of _POSIX1_VERSION_$YEAR
> which are used to define the actual value of _POSIX_VERSION.

If it is used to *define* _POSIX_VERSION, it should have come up too, wouldn't it?

The only define that comes close to something like YYYYMM is:
X11/Xosdefs.h:#define X_POSIX_C_SOURCE 199300L

usr/include 111 > grep -r POSIX.*YEAR . Exit 1

/usr/include 112 > grep -P -r 'POSIX.*\b(19\d\d|200\d)' . ./sys/buf.h:#if (_POSIX_C_SOURCE >= 199309) ./sys/buf.h:#endif /* (_POSIX_C_SOURCE >= 199309) */ ./sys/stdsyms.h:/* XPG3 semantics gets POSIX.1-1988 semantics by default */ ./sys/stdsyms.h: * This usage is obsolescent, "-D_POSIX_C_SOURCE=199506" is preferred */ ./sys/stdsyms.h:# if (_POSIX_C_SOURCE >= 199506) && !defined(_INCLUDE_POSIX1C_SOURCE) ./sys/stdsyms.h:# endif /* _POSIX_C_SOURCE >= 199506 && !_INCLUDE_POSIX1C_SOURCE */ ./sys/stdsyms.h:# if (_POSIX_C_SOURCE >= 199506) && !defined(_REENTRANT) ./sys/stdsyms.h:# endif /* _POSIX_C_SOURCE >= 199506 && !_REENTRANT */ ./sys/stdsyms.h:# if (_POSIX_C_SOURCE >= 199309) && !defined(_INCLUDE_POSIX4_SOURCE) ./sys/stdsyms.h:# endif /* _POSIX_C_SOURCE >= 199309 && !_INCLUDE_POSIX4_SOURCE */ ./sys/unistd.h:# define _POSIX1_VERSION_88 198808L /* We support POSIX.1-1988 */ ./sys/unistd.h:# define _POSIX1_VERSION_90 199009L /* We support POSIX.1-1990 */ ./sys/unistd.h:# define _POSIX1_VERSION_93 199309L /* We support POSIX.1b-1993 */ ./sys/unistd.h:# if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE < 199309L) ./sys/unistd.h:# else /* _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199309L */ ./sys/unistd.h:# endif /* _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199309L */ ./sys/unistd.h:/* Symbolic constants for sysconf() variables defined by POSIX.1-1988: 0-7 */ ./sys/unistd.h:# define _SC_1_VERSION_88 7 /* _POSIX_VERSION: Date of POSIX.1-1988 */ ./sys/unistd.h:/* Symbolic constants for sysconf() variables added by POSIX.1-1990: 100-199 */ ./sys/unistd.h:# define _SC_1_VERSION_90 102 /* _POSIX_VERSION: Date of POSIX.1-1990 */ ./sys/unistd.h:# define _SC_1_VERSION_93 103 /* _POSIX_VERSION: Date of POSIX.1b-1993 */ ./sys/unistd.h:# define _POSIX2_VERSION 199209L /* IEEE POSIX.2-1992 base standard */ ./sys/unistd.h:# define _POSIX2_C_VERSION 199209L /* IEEE POSIX.2-1992 C language binding */ ./limits.h:# define _POSIX_CLOCKRES_MIN 20000000 /* The CLOCK_REALTIME clock ./X11/Xosdefs.h:#define X_POSIX_C_SOURCE 199300L ./dce/cdsclerk.h:#if _POSIX_C_SOURCE >= 199506L ./dce/rpcexc.h:#if _POSIX_C_SOURCE >= 199506L ./dce/stubbase.h:#if _POSIX_C_SOURCE >= 199506L

-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x  on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin.       http://qa.perl.org
http://mirrors.develooper.com/hpux/            http://www.test-smoke.org
                        http://www.goldmark.org/jeff/stupid-disclaimers/
Junio C Hamano· Dec 20, 2007, 07:52 UTC · re: H.Merijn Brand · lore

Re: [PATCH] HP-UX does not have select.h

"H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
Show 11 quoted lines
>> > Also because these are the *only* _POSIX_VERSION defines in the entire
>> > include tree, and 11.23 does have a select.h, which makes the patch below
>> > to be not OK on 11.23. I'm not stating that HP follows the rules in any
>> > correct way, but if this is to be sure that select.h gets included if the
>> > OS supports it, it will fail.
>> ...
>> But your grep did not catch their definition of _POSIX1_VERSION_$YEAR
>> which are used to define the actual value of _POSIX_VERSION.
>
> If it is used to *define* _POSIX_VERSION, it should have come up too,
> wouldn't it?

Sorry, I should re-read your grep output. It is possible that I am quite confused.

Your grep session begins like this:
>> >> > /usr/include 103 > grep -r POSIX_VERSION *
>> >> > sys/unistd.h:#    define _POSIX_VERSION _POSIX1_VERSION_88
>> >> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_90
>> >> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_93
Now, if they had
	#define _POSIX1_VERSION_88	198808L
        #define _POSIX1_VERSION_90	199009L
        #define _POSIX1_VERSION_93	199309L
        #define _POSIX1_VERSION_95	199506L
        #define _POSIX1_VERSION_01	200112L
elsewhere in their include files, then
 (1) "grep -r POSIX_VERSION *" wouldn't have matched them;
 (2) not all of the three output form sys/unistd.h could be in effect at
     the same time.  There may be #ifdef around it to control which
     definition is used, but your "grep" wouldn't have shown them
     either.

Maybe HP-UX include files #ifdef the definition of _POSIX_VERSION depending on what is asked for with feature test macros? We do not define _POSIX_C_SOURCE to 200112L but we do define _XOPEN_SOURCE to 600. According to:

    http://www.opengroup.org/onlinepubs/000095399/functions/xsh_chap02_02.html
this should be sufficient to ask for POSIX.1-2001 features.

But in any case, 88/90/93 are all too old (predates 2001-12) so if these three definitions are only possible values in their include files, then we wouldn't see _POSIX_VERSION set to 200112L. That is unfortunate. It seems we need to go back to that "NO_SYS_SELECT_H=YesPlease" thing.

Jan Hudec· Dec 23, 2007, 08:37 UTC · re: H.Merijn Brand · lore

Re: [PATCH] HP-UX does not have select.h

On Thu, Dec 20, 2007 at 08:18:06 +0100, H.Merijn Brand wrote:
Show 17 quoted lines
> On Wed, 19 Dec 2007 13:31:58 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> > "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> > > On Wed, 19 Dec 2007 11:57:21 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> > >> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> > >> > On Tue, 18 Dec 2007 01:47:53 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> > >> > ...
> > >> >> Merijn, discarding the earlier patch I did to configure it out for
> > >> >> HP-UX, does the following patch based on Andreas's idea work for you?
> > >> >
> > >> > Probably not:
> > >> >
> > >> > HP-UX 10.20, 11.00, 11.11, 11.23/PA, and 11.23/IPF all have:
> > >> >
> > >> > /usr/include 103 > grep -r POSIX_VERSION *
> > >> > sys/unistd.h:#    define _POSIX_VERSION _POSIX1_VERSION_88
> > >> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_90
> > >> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_93
Please, note that the defines are _POSIX1_VERSION_*
                                        ^
Show 13 quoted lines
> > >> > sys/unistd.h:#  define _SC_1_VERSION_88    7     /* _POSIX_VERSION: Date of POSIX.1-1988 */
> > >> > sys/unistd.h:#  define _SC_1_VERSION_90   102 /* _POSIX_VERSION: Date of POSIX.1-1990 */
> > >> > sys/unistd.h:#  define _SC_1_VERSION_93   103 /* _POSIX_VERSION: Date of POSIX.1b-1993 */
> > >> > sys/unistd.h:#  if (_POSIX_VERSION == _POSIX1_VERSION_88)
> > >> > sys/unistd.h:#    if (_POSIX_VERSION == _POSIX1_VERSION_90)
> > >> >
> > >> > and the two 11.23 do have select.h
> [...]
> 
> If it is used to *define* _POSIX_VERSION, it should have come up too,
> wouldn't it?
> 
> The only define that comes close to something like YYYYMM is:

No, it's not the only one. The _POSIX1_VERSION_* macros we are looking for are there below and they are defined this way too (did you miss them because of the trailing comment?)

Show 19 quoted lines
> X11/Xosdefs.h:#define X_POSIX_C_SOURCE 199300L
> 
> usr/include 111 > grep -r POSIX.*YEAR .
> Exit 1
> 
> /usr/include 112 > grep -P -r 'POSIX.*\b(19\d\d|200\d)' .
> ./sys/buf.h:#if         (_POSIX_C_SOURCE >= 199309)
> ./sys/buf.h:#endif      /* (_POSIX_C_SOURCE >= 199309) */
> ./sys/stdsyms.h:/* XPG3 semantics gets POSIX.1-1988 semantics by default */
> ./sys/stdsyms.h: * This usage is obsolescent, "-D_POSIX_C_SOURCE=199506" is preferred */
> ./sys/stdsyms.h:#  if (_POSIX_C_SOURCE >= 199506) && !defined(_INCLUDE_POSIX1C_SOURCE)
> ./sys/stdsyms.h:#  endif /* _POSIX_C_SOURCE >= 199506 && !_INCLUDE_POSIX1C_SOURCE */
> ./sys/stdsyms.h:#  if (_POSIX_C_SOURCE >= 199506) && !defined(_REENTRANT)
> ./sys/stdsyms.h:#  endif /* _POSIX_C_SOURCE >= 199506 && !_REENTRANT */
> ./sys/stdsyms.h:#  if (_POSIX_C_SOURCE >= 199309) && !defined(_INCLUDE_POSIX4_SOURCE)
> ./sys/stdsyms.h:#  endif /* _POSIX_C_SOURCE >= 199309 && !_INCLUDE_POSIX4_SOURCE */
> ./sys/unistd.h:#  define _POSIX1_VERSION_88     198808L    /* We support POSIX.1-1988 */
> ./sys/unistd.h:#  define _POSIX1_VERSION_90     199009L    /* We support POSIX.1-1990 */
> ./sys/unistd.h:#  define _POSIX1_VERSION_93     199309L    /* We support POSIX.1b-1993 */

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ And they are defined HERE.

Obviously, there is no value for the 2001 standard, so if this is from HP-UX version that already has sys/select.h, it does not claim conformance to the posix standard. But than it might be that sys/select.h is not required, so the test might still work.

Show 15 quoted lines
> ./sys/unistd.h:#    if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE < 199309L)
> ./sys/unistd.h:#    else /* _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199309L */
> ./sys/unistd.h:#    endif /* _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199309L */
> ./sys/unistd.h:/* Symbolic constants for sysconf() variables defined by POSIX.1-1988: 0-7 */
> ./sys/unistd.h:#  define _SC_1_VERSION_88    7   /* _POSIX_VERSION: Date of POSIX.1-1988 */
> ./sys/unistd.h:/* Symbolic constants for sysconf() variables added by POSIX.1-1990: 100-199 */
> ./sys/unistd.h:#  define _SC_1_VERSION_90   102 /* _POSIX_VERSION: Date of POSIX.1-1990 */
> ./sys/unistd.h:#  define _SC_1_VERSION_93   103 /* _POSIX_VERSION: Date of POSIX.1b-1993 */
> ./sys/unistd.h:#  define _POSIX2_VERSION   199209L  /* IEEE POSIX.2-1992 base standard */
> ./sys/unistd.h:#  define _POSIX2_C_VERSION 199209L  /* IEEE POSIX.2-1992 C language binding */
> ./limits.h:#  define _POSIX_CLOCKRES_MIN        20000000 /* The CLOCK_REALTIME clock
> ./X11/Xosdefs.h:#define X_POSIX_C_SOURCE 199300L
> ./dce/cdsclerk.h:#if _POSIX_C_SOURCE >= 199506L
> ./dce/rpcexc.h:#if _POSIX_C_SOURCE >= 199506L
> ./dce/stubbase.h:#if _POSIX_C_SOURCE >= 199506L
-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
H.Merijn Brand· Dec 23, 2007, 08:59 UTC · re: Jan Hudec · lore

Re: [PATCH] HP-UX does not have select.h

On Sun, 23 Dec 2007 09:37:08 +0100, Jan Hudec <bulb@ucw.cz> wrote:
Show 21 quoted lines
> On Thu, Dec 20, 2007 at 08:18:06 +0100, H.Merijn Brand wrote:
> > On Wed, 19 Dec 2007 13:31:58 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> > > "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> > > > On Wed, 19 Dec 2007 11:57:21 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> > > >> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> > > >> > On Tue, 18 Dec 2007 01:47:53 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> > > >> > ...
> > > >> >> Merijn, discarding the earlier patch I did to configure it out for
> > > >> >> HP-UX, does the following patch based on Andreas's idea work for you?
> > > >> >
> > > >> > Probably not:
> > > >> >
> > > >> > HP-UX 10.20, 11.00, 11.11, 11.23/PA, and 11.23/IPF all have:
> > > >> >
> > > >> > /usr/include 103 > grep -r POSIX_VERSION *
> > > >> > sys/unistd.h:#    define _POSIX_VERSION _POSIX1_VERSION_88
> > > >> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_90
> > > >> > sys/unistd.h:#      define _POSIX_VERSION       _POSIX1_VERSION_93
> 
> Please, note that the defines are _POSIX1_VERSION_*
>                                         ^
Ow. good catch. Sorry, yes, missed that.
Show 17 quoted lines
> > > >> > sys/unistd.h:#  define _SC_1_VERSION_88    7     /* _POSIX_VERSION: Date of POSIX.1-1988 */
> > > >> > sys/unistd.h:#  define _SC_1_VERSION_90   102 /* _POSIX_VERSION: Date of POSIX.1-1990 */
> > > >> > sys/unistd.h:#  define _SC_1_VERSION_93   103 /* _POSIX_VERSION: Date of POSIX.1b-1993 */
> > > >> > sys/unistd.h:#  if (_POSIX_VERSION == _POSIX1_VERSION_88)
> > > >> > sys/unistd.h:#    if (_POSIX_VERSION == _POSIX1_VERSION_90)
> > > >> >
> > > >> > and the two 11.23 do have select.h
> > [...]
> > 
> > If it is used to *define* _POSIX_VERSION, it should have come up too,
> > wouldn't it?
> > 
> > The only define that comes close to something like YYYYMM is:
> 
> No, it's not the only one. The _POSIX1_VERSION_* macros we are looking for
> are there below and they are defined this way too (did you miss them because
> of the trailing comment?)
No, because of the trailing _88, _90, and _93
Show 26 quoted lines
> > X11/Xosdefs.h:#define X_POSIX_C_SOURCE 199300L
> > 
> > usr/include 111 > grep -r POSIX.*YEAR .
> > Exit 1
> > 
> > /usr/include 112 > grep -P -r 'POSIX.*\b(19\d\d|200\d)' .
> > ./sys/buf.h:#if         (_POSIX_C_SOURCE >= 199309)
> > ./sys/buf.h:#endif      /* (_POSIX_C_SOURCE >= 199309) */
> > ./sys/stdsyms.h:/* XPG3 semantics gets POSIX.1-1988 semantics by default */
> > ./sys/stdsyms.h: * This usage is obsolescent, "-D_POSIX_C_SOURCE=199506" is preferred */
> > ./sys/stdsyms.h:#  if (_POSIX_C_SOURCE >= 199506) && !defined(_INCLUDE_POSIX1C_SOURCE)
> > ./sys/stdsyms.h:#  endif /* _POSIX_C_SOURCE >= 199506 && !_INCLUDE_POSIX1C_SOURCE */
> > ./sys/stdsyms.h:#  if (_POSIX_C_SOURCE >= 199506) && !defined(_REENTRANT)
> > ./sys/stdsyms.h:#  endif /* _POSIX_C_SOURCE >= 199506 && !_REENTRANT */
> > ./sys/stdsyms.h:#  if (_POSIX_C_SOURCE >= 199309) && !defined(_INCLUDE_POSIX4_SOURCE)
> > ./sys/stdsyms.h:#  endif /* _POSIX_C_SOURCE >= 199309 && !_INCLUDE_POSIX4_SOURCE */
> > ./sys/unistd.h:#  define _POSIX1_VERSION_88     198808L    /* We support POSIX.1-1988 */
> > ./sys/unistd.h:#  define _POSIX1_VERSION_90     199009L    /* We support POSIX.1-1990 */
> > ./sys/unistd.h:#  define _POSIX1_VERSION_93     199309L    /* We support POSIX.1b-1993 */
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> And they are defined HERE.
> 
> Obviously, there is no value for the 2001 standard, so if this is from HP-UX
> version that already has sys/select.h, it does not claim conformance to the
> posix standard. But than it might be that sys/select.h is not required, so
> the test might still work.
Good explanation
Show 15 quoted lines
> > ./sys/unistd.h:#    if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE < 199309L)
> > ./sys/unistd.h:#    else /* _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199309L */
> > ./sys/unistd.h:#    endif /* _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199309L */
> > ./sys/unistd.h:/* Symbolic constants for sysconf() variables defined by POSIX.1-1988: 0-7 */
> > ./sys/unistd.h:#  define _SC_1_VERSION_88    7   /* _POSIX_VERSION: Date of POSIX.1-1988 */
> > ./sys/unistd.h:/* Symbolic constants for sysconf() variables added by POSIX.1-1990: 100-199 */
> > ./sys/unistd.h:#  define _SC_1_VERSION_90   102 /* _POSIX_VERSION: Date of POSIX.1-1990 */
> > ./sys/unistd.h:#  define _SC_1_VERSION_93   103 /* _POSIX_VERSION: Date of POSIX.1b-1993 */
> > ./sys/unistd.h:#  define _POSIX2_VERSION   199209L  /* IEEE POSIX.2-1992 base standard */
> > ./sys/unistd.h:#  define _POSIX2_C_VERSION 199209L  /* IEEE POSIX.2-1992 C language binding */
> > ./limits.h:#  define _POSIX_CLOCKRES_MIN        20000000 /* The CLOCK_REALTIME clock
> > ./X11/Xosdefs.h:#define X_POSIX_C_SOURCE 199300L
> > ./dce/cdsclerk.h:#if _POSIX_C_SOURCE >= 199506L
> > ./dce/rpcexc.h:#if _POSIX_C_SOURCE >= 199506L
> > ./dce/stubbase.h:#if _POSIX_C_SOURCE >= 199506L
-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x  on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin.       http://qa.perl.org
http://mirrors.develooper.com/hpux/            http://www.test-smoke.org
                        http://www.goldmark.org/jeff/stupid-disclaimers/

← back to recent threads