{"thread":{"id":"31348","subject":"[RFC] Support for HP NonStop","startedAt":"2012-08-24T19:22:04Z","lastAt":"2012-09-19T08:16:15Z","messageCount":7,"participants":["Joachim Schmitz","Junio C Hamano","Jan Engelhardt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"197790","messageId":"005501cd822d$bf844bb0$3e8ce310$@schmitz-digital.de","threadId":"31348","inReplyTo":null,"subject":"[RFC] Support for HP NonStop","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-08-24T19:22:04Z","receivedAt":"2012-08-24T19:22:04Z","isPatch":false,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"Hi folks\n\nOn top of the patches Ive submitted so far, which were needed for HP NonStop, \nbut possibly useful for other platforms too, here is one that is at least in parts NonStop specific\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex a047221..d6a142a 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -74,7 +74,8 @@\n# define _XOPEN_SOURCE 500\n# endif\n#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \\\n-      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__)\n+      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \\\n+      !defined(__TANDEM)\n#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 fo\n#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */\n#endif\n+#ifdef __TANDEM /* or HAVE_STRINGS_H ? */\n+#include <strings.h> /* for strcasecmp() */\n+#endif\n#include <errno.h>\n#include <limits.h>\n#include <sys/param.h>\n@@ -141,6 +145,10 @@\n#else\n#include <stdint.h>\n#endif\n+#ifdef __TANDEM /* or NO_INTPTR_T resp. NO_UINTPTR_T? */\n+typedef int intptr_t;\n+typedef unsigned int uintptr_t;\n+#endif\n#if defined(__CYGWIN__)\n#undef _XOPEN_SOURCE\n#include <grp.h>\n\nThe 1st hunk avoids a is already defined with a different value warning, and I\nbelieve this is the only and right way to fix this, but on the 2nd and 3rd hunk \nId need advice on how to properly add those. The #ifdef __TANDEM#endif \nworks fine for me, but doesnt seem 100% clean to me.\nIn the comment I mention alternatives.\n\nstrcasecamp() is declared in <strings.h> as per C99/POSIX, and in C99 mode a prototype has \nto be seen by the compiler.\n\nintptr_t and uintprt_t seem to be optional in C99 and are not provided for NonStop\n\nWhat do you think?\n\nBye, Jojo\n"},{"id":"197792","messageId":"7v4nnsyrp7.fsf@alter.siamese.dyndns.org","threadId":"31348","inReplyTo":"005501cd822d$bf844bb0$3e8ce310$@schmitz-digital.de","subject":"Re: [RFC] Support for HP NonStop","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-24T20:12:52Z","receivedAt":"2012-08-24T20:12:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Joachim Schmitz\" <jojo@schmitz-digital.de> writes:\n\n> Hi folks\n>\n> On top of the patches I’ve submitted so far, which were needed for HP NonStop, \n> but possibly useful for other platforms too, here is one that is at least in parts NonStop specific\n>\n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index a047221..d6a142a 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -74,7 +74,8 @@\n> # define _XOPEN_SOURCE 500\n> # endif\n> #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \\\n> -      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__)\n> +      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \\\n> +      !defined(__TANDEM)\n> #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 fo\n> #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */\n> #endif\n> +#ifdef __TANDEM /* or HAVE_STRINGS_H ? */\n> +#include <strings.h> /* for strcasecmp() */\n> +#endif\n> #include <errno.h>\n> #include <limits.h>\n> #include <sys/param.h>\n\nYeah, it appears that glibc headers have strcasecmp() and friends in\nthe <string.h> and that was why majority of us were fine without\nincluding <strings.h>.  A cursory look of /usr/include/strings.h on\na GNU system suggests that it is safe to include <strings.h> after\nwe incude <string.h> on that platform.\n\nI think it is OK to leave it \"__TANDEM /* or HAVE_STRINGS_H? */\" for\nnow and let the next person who wants to port us to a platform that\nneeds this inclusion turn it to HAVE_STRINGS_H.  Alternatively, we\nbite the bullet now and include <strings.h> on any platform that has\nthe header file and see if anybody complains (that reminds me; I at\nleast should get one flavor of BSD build environment for this kind\nof thing myself).\n\n> @@ -141,6 +145,10 @@\n> #else\n> #include <stdint.h>\n> #endif\n> +#ifdef __TANDEM /* or NO_INTPTR_T resp. NO_UINTPTR_T? */\n> +typedef int intptr_t;\n> +typedef unsigned int uintptr_t;\n> +#endif\n\nA bit wider context for this hunk is\n\n\t#ifndef NO_INTTYPES_H\n        #include <inttypes.h>\n        #else\n        #include <stdint.h>\n\t#endif\n\nSo we have been assuming that <stdint.h> has intptr_t but __TANDEM\napparently doesn't.  POSIX requires intptr_t and uintptr_t to be\ndeclared for systems conforming to XSI, but otherwise these are\noptional (in other words, some XSI non-conforming platforms may have\nthem in <stdint.h>), so it would not help to check _XOPEN_UNIX to\nsee if the system is XSI X-<.  We would need NO_INTPTR_T as you\nhinted above, perhaps like this.\n\n\t#ifndef NO_INTTYPES_H\n        #include <inttypes.h>\n        #else\n        #include <stdint.h>\n\t#endif\n\t#ifdef NO_INTPTR_T\n        typedef int intptr_t;\n        typedef unsigned int uintptr_t;\n\t#endif\n\nBy the way, is \"int\" wide enough, or should they be \"long\"?\n"},{"id":"197794","messageId":"005701cd8239$1a828300$4f878900$@schmitz-digital.de","threadId":"31348","inReplyTo":"7v4nnsyrp7.fsf@alter.siamese.dyndns.org","subject":"RE: [RFC] Support for HP NonStop","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-08-24T20:43:22Z","receivedAt":"2012-08-24T20:43:22Z","isPatch":false,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"> From: Junio C Hamano [mailto:gitster@pobox.com]\n> Sent: Friday, August 24, 2012 10:13 PM\n> To: Joachim Schmitz\n> Cc: git@vger.kernel.org\n> Subject: Re: [RFC] Support for HP NonStop\n> \n> \"Joachim Schmitz\" <jojo@schmitz-digital.de> writes:\n> \n> > Hi folks\n> >\n> > On top of the patches I’ve submitted so far, which were needed for HP NonStop,\n> > but possibly useful for other platforms too, here is one that is at least in parts NonStop specific\n> >\n> > diff --git a/git-compat-util.h b/git-compat-util.h\n> > index a047221..d6a142a 100644\n> > --- a/git-compat-util.h\n> > +++ b/git-compat-util.h\n> > @@ -74,7 +74,8 @@\n> > # define _XOPEN_SOURCE 500\n> > # endif\n> > #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \\\n> > -      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__)\n> > +      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \\\n> > +      !defined(__TANDEM)\n> > #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 fo\n> > #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */\n> > #endif\n> > +#ifdef __TANDEM /* or HAVE_STRINGS_H ? */\n> > +#include <strings.h> /* for strcasecmp() */\n> > +#endif\n> > #include <errno.h>\n> > #include <limits.h>\n> > #include <sys/param.h>\n> \n> Yeah, it appears that glibc headers have strcasecmp() and friends in\n> the <string.h> and that was why majority of us were fine without\n> including <strings.h>.  A cursory look of /usr/include/strings.h on\n> a GNU system suggests that it is safe to include <strings.h> after\n> we incude <string.h> on that platform.\n> \n> I think it is OK to leave it \"__TANDEM /* or HAVE_STRINGS_H? */\" for\n> now and let the next person who wants to port us to a platform that\n> needs this inclusion turn it to HAVE_STRINGS_H.  Alternatively, we\n> bite the bullet now and include <strings.h> on any platform that has\n> the header file and see if anybody complains\n\nThat's exaclty why I'm asking here ;-), seems a decision needs to be made.\nHow would one differentiate platrots that have strings.h from those that don't?\nGuess it wont'f work without some ifdef. But it could be NO_STRINGS_H and \nforce the platforms that don't have to update this in Makefile?\n\nReminds me of a related issue: in compat/fnmatch/fnmatch.c there is this:\n#if HAVE_STRING_H || defined _LIBC\n# include <string.h>\n#else\n# include <strings.h>\n#endif\n\nThere's no place where HAVE_STRING_H get set\nThis looks wrong to me, as here, at least for NonStop, I have to takes measure in Makefile, \nbecause there's no other place where HAVE_STRING_H ever gets set:\n       COMPAT_CFLAGS += -DHAVE_STRING_H=1 # needed in compat/fnmatch/fnmatch.c\n\nDo platforms exist without string.h?\nMaybe fnmatch.c should look like this instead?\n#if HAVE_STRING_H || defined _LIBC\n# include <string.h>\n#endif\n# ifndef NO_STRINGS_H\n# include <strings.h>\n#endif\n\n> (that reminds me; I at\n> least should get one flavor of BSD build environment for this kind\n> of thing myself).\n> \n> > @@ -141,6 +145,10 @@\n> > #else\n> > #include <stdint.h>\n> > #endif\n> > +#ifdef __TANDEM /* or NO_INTPTR_T resp. NO_UINTPTR_T? */\n> > +typedef int intptr_t;\n> > +typedef unsigned int uintptr_t;\n> > +#endif\n> \n> A bit wider context for this hunk is\n> \n> \t#ifndef NO_INTTYPES_H\n>         #include <inttypes.h>\n>         #else\n>         #include <stdint.h>\n> \t#endif\n> \n> So we have been assuming that <stdint.h> has intptr_t but __TANDEM\n> apparently doesn't. \n\nExactly. Our stdint.h says:\n/*\n *  Special integer types (optional types intptr_t/uintptr_t not defined)\n */\n\nThis may change in the future though. One reason why __TANDEM might not be the best check :-)\n\n> POSIX requires intptr_t and uintptr_t to be\n> declared for systems conforming to XSI, but otherwise these are\n> optional (in other words, some XSI non-conforming platforms may have\n> them in <stdint.h>), so it would not help to check _XOPEN_UNIX to\n> see if the system is XSI X-<.  We would need NO_INTPTR_T as you\n> hinted above, perhaps like this.\n> \n> \t#ifndef NO_INTTYPES_H\n>         #include <inttypes.h>\n>         #else\n>         #include <stdint.h>\n> \t#endif\n> \t#ifdef NO_INTPTR_T\n>         typedef int intptr_t;\n>         typedef unsigned int uintptr_t;\n> \t#endif\n\nNO_INTPTR_T for both types?\nOK by me.\nIf need be an NOUINTPTR could get added later, I guess\n\n> By the way, is \"int\" wide enough, or should they be \"long\"?\n\nint and long have the same size, 32-bit, here on NonStop.\nBut we do have 64-bit types too. Not sure which to take though.\n\nBye, Jojo\n"},{"id":"197798","messageId":"7vvcg8x8lo.fsf@alter.siamese.dyndns.org","threadId":"31348","inReplyTo":"005701cd8239$1a828300$4f878900$@schmitz-digital.de","subject":"Re: [RFC] Support for HP NonStop","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-24T21:50:43Z","receivedAt":"2012-08-24T21:50:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Joachim Schmitz\" <jojo@schmitz-digital.de> writes:\n\n> Reminds me of a related issue: in compat/fnmatch/fnmatch.c there is this:\n> #if HAVE_STRING_H || defined _LIBC\n> # include <string.h>\n> #else\n> # include <strings.h>\n> #endif\n>\n> There's no place where HAVE_STRING_H get set\n> This looks wrong to me,...\n\nThis is because it is a borrowed file from glibc, and we try to\nminimize changes to such a file.\n\nIf you need HAVE_STRING_H to force inclusion of <string.h> on your\nplatform, doing this:\n\n>        COMPAT_CFLAGS += -DHAVE_STRING_H=1 # needed in compat/fnmatch/fnmatch.c\n\nis perfectly the right thing to do.\n\n> Do platforms exist without string.h?\n> Maybe fnmatch.c should look like this instead?\n\nWe try to minimize changes to such a file we borrow from upstream;\nespecially we do not do so lightly when we have to ask \"do platforms\nexist?\"  Of course, they do---otherwise glibc folks wouldn't have\nwritten such a conditional.\n"},{"id":"197831","messageId":"000f01cd8298$19988c00$4cc9a400$@schmitz-digital.de","threadId":"31348","inReplyTo":"7vvcg8x8lo.fsf@alter.siamese.dyndns.org","subject":"RE: [RFC] Support for HP NonStop","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-08-25T08:03:23Z","receivedAt":"2012-08-25T08:03:23Z","isPatch":false,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"> From: Junio C Hamano [mailto:gitster@pobox.com]\n> Sent: Friday, August 24, 2012 11:51 PM\n> To: Joachim Schmitz\n> Cc: git@vger.kernel.org\n> Subject: Re: [RFC] Support for HP NonStop\n> \n> \"Joachim Schmitz\" <jojo@schmitz-digital.de> writes:\n> \n> > Reminds me of a related issue: in compat/fnmatch/fnmatch.c there is this:\n> > #if HAVE_STRING_H || defined _LIBC\n> > # include <string.h>\n> > #else\n> > # include <strings.h>\n> > #endif\n> >\n> > There's no place where HAVE_STRING_H get set\n> > This looks wrong to me,...\n> \n> This is because it is a borrowed file from glibc, and we try to\n> minimize changes to such a file.\n> \n> If you need HAVE_STRING_H to force inclusion of <string.h> on your\n> platform, doing this:\n> \n> >        COMPAT_CFLAGS += -DHAVE_STRING_H=1 # needed in compat/fnmatch/fnmatch.c\n> \n> is perfectly the right thing to do.\n\nIt should be set by default and those that don't have it, should (have to) disable it.\nIn Makefile:\n\nifndef NO_STRING_H\n        COMPAT_CFLAGS += -DHAVE_STRING_H=1 # needed in compat/fnmatch/fnmatch.c \nendif\n\n> > Do platforms exist without string.h?\n> > Maybe fnmatch.c should look like this instead?\n> \n> We try to minimize changes to such a file we borrow from upstream;\n\nValid point, but...\n\n> especially we do not do so lightly when we have to ask \"do platforms\n> exist?\"  Of course, they do---otherwise glibc folks wouldn't have\n> written such a conditional.\n\nHmm, well, why then doesn't git-compat.util.h use the same mechanism? (and no ,it should not!)\nI guess because as of now nobody ever tried to port git to a platform that doesn't have string.h.\n\nstring.h is C89 ANSI/ISO standard (and was part of even the earliest K&C C), in place since more than 22 years now! It may not be\navailable on embedded platforms, but those won't be able to run git anyway I'd guess.\n\nNewer version of gnulib's fnmatch.c don't use this anymore, git's is from 99, according to the Copyright:\nCopyright (C) 1991, 92, 93, 96, 97, 98, 99\n\nThe current gnulib one shows:\nCopyright (C) 1991-1993, 1996-2007, 2009-2012\n\nTime to upgrade, if you'd ask me...\n\nSame may go for poll.c BTW\n\nBye, Jojo\n"},{"id":"199449","messageId":"alpine.LNX.2.01.1209190923020.32503@nerf07.vanv.qr","threadId":"31348","inReplyTo":"005701cd8239$1a828300$4f878900$@schmitz-digital.de","subject":"RE: [RFC] Support for HP NonStop","fromName":"Jan Engelhardt","fromEmail":"jengelh@inai.de","sentAt":"2012-09-19T07:24:10Z","receivedAt":"2012-09-19T07:24:10Z","isPatch":false,"sender":{"key":"jengelh@inai.de","avatar":"https://avatars.githubusercontent.com/u/8861948?v=4"},"body":"\nOn Friday 2012-08-24 22:43, Joachim Schmitz wrote:\n>\n>> By the way, is \"int\" wide enough [for intptr_t/uintptr_t],\n>> or should they be \"long\"?\n>\n>int and long have the same size, 32-bit, here on NonStop.\n>But we do have 64-bit types too. Not sure which to take though.\n\nintptr_t is supposed to hold a void * pointer, so should be\nat least as big.\n"},{"id":"199453","messageId":"000001cd963f$0a8421b0$1f8c6510$@schmitz-digital.de","threadId":"31348","inReplyTo":"alpine.LNX.2.01.1209190923020.32503@nerf07.vanv.qr","subject":"RE: [RFC] Support for HP NonStop","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-09-19T08:16:15Z","receivedAt":"2012-09-19T08:16:15Z","isPatch":false,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"> From: Jan Engelhardt [mailto:jengelh@inai.de]\n> Sent: Wednesday, September 19, 2012 9:24 AM\n> To: Joachim Schmitz\n> Cc: 'Junio C Hamano'; git@vger.kernel.org\n> Subject: RE: [RFC] Support for HP NonStop\n> \n> \n> On Friday 2012-08-24 22:43, Joachim Schmitz wrote:\n> >\n> >> By the way, is \"int\" wide enough [for intptr_t/uintptr_t],\n> >> or should they be \"long\"?\n> >\n> >int and long have the same size, 32-bit, here on NonStop.\n> >But we do have 64-bit types too. Not sure which to take though.\n> \n> intptr_t is supposed to hold a void * pointer, so should be\n> at least as big.\n\nOK, thanks. We are on IA64 but still use the ILP32 model (so 32bit pointers. Support for LP64 has been added recently, but isn't the\ndefault.\nHowever, long changes from 32bit to 64 bit when changing from ILP32 to LP64, so is the save bet here, right?\n"}]}