threads / patch / 32338

patch, 2 partsMake lock local to fetch_pack

Subject: [PATCH 1/2] Make lock local to fetch_pack

## tl;dr

8 messages between Dec 14, 2012 and Dec 16, 2012. Diffs are folded; open one to read it.

replies: 7people: 3as markdown or json

Matt Kraai· Dec 14, 2012, 18:38 UTC · lore

[PATCH 0/2] Port to QNX

This series ports Git to QNX. It builds on both QNX 6.3.2 and QNX 6.5.0. The test suite does not pass. Unless the corresponding software is installed, the following arguments must be passed to Make:

 NO_CURL=1 NO_GETTEXT=1 NO_OPENSSL=1 NO_PERL=1 NO_PYTHON=1 NO_TCLTK=1
  [1/2]: Make lock local to fetch_pack

QNX 6.3.2's unistd.h declares a function named lock, which causes fetch-pack.c to fail to compile if lock has file-scope. Since it's only used in a single function, move it therein.

  [2/2]: Port to QNX
Matt Kraai· Dec 14, 2012, 18:38 UTC · re: Matt Kraai · lore
From: Matt Kraai <matt.kraai@amo.abbott.com>
lock is only used by fetch_pack, so move it into that function.
Signed-off-by: Matt Kraai <matt.kraai@amo.abbott.com>
---
 fetch-pack.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Show changes to fetch-pack.c +1 −2
diff --git a/fetch-pack.c b/fetch-pack.c
index 099ff4d..9d9762d 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -874,8 +874,6 @@ static int fetch_pack_config(const char *var, const char *value, void *cb)
 	return git_default_config(var, value, cb);
 }
 
-static struct lock_file lock;
-
 static void fetch_pack_setup(void)
 {
 	static int did_setup;
@@ -896,6 +894,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
 		       struct string_list *sought,
 		       char **pack_lockfile)
 {
+	static struct lock_file lock;
 	struct stat st;
 	struct ref *ref_cpy;
 
-- 
1.8.1-rc1
Junio C Hamano· Dec 15, 2012, 18:40 UTC · re: Matt Kraai · lore

Re: [PATCH 1/2] Make lock local to fetch_pack

Matt Kraai <kraai@ftbfs.org> writes:
Show 8 quoted lines
> From: Matt Kraai <matt.kraai@amo.abbott.com>
>
> lock is only used by fetch_pack, so move it into that function.
>
> Signed-off-by: Matt Kraai <matt.kraai@amo.abbott.com>
> ---
>  fetch-pack.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Eh, did you base your patch on something older than 2d4177c (Make fetch-pack a builtin with an internal API, 2007-09-10)???

Junio C Hamano· Dec 15, 2012, 19:31 UTC · re: Junio C Hamano · lore

Re: [PATCH 1/2] Make lock local to fetch_pack

Junio C Hamano <gitster@pobox.com> writes:
Show 13 quoted lines
> Matt Kraai <kraai@ftbfs.org> writes:
>
>> From: Matt Kraai <matt.kraai@amo.abbott.com>
>>
>> lock is only used by fetch_pack, so move it into that function.
>>
>> Signed-off-by: Matt Kraai <matt.kraai@amo.abbott.com>
>> ---
>>  fetch-pack.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> Eh, did you base your patch on something older than 2d4177c (Make
> fetch-pack a builtin with an internal API, 2007-09-10)???

Ah, nevermind. I see we refactored this out recently but that is still in flight.

Matt Kraai· Dec 14, 2012, 18:38 UTC · re: Matt Kraai · lore

[PATCH 2/2] Port to QNX

From: Matt Kraai <matt.kraai@amo.abbott.com>
Signed-off-by: Matt Kraai <matt.kraai@amo.abbott.com>
---
 Makefile          | 19 +++++++++++++++++++
 git-compat-util.h |  8 ++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)
Show changes to 2 files +25 −2

Makefile, git-compat-util.h

diff --git a/Makefile b/Makefile
index 736ecd4..ed2539d 100644
--- a/Makefile
+++ b/Makefile
@@ -78,6 +78,8 @@ all::
 #
 # Define NO_MEMMEM if you don't have memmem.
 #
+# Define NO_GETPAGESIZE if you don't have getpagesize.
+#
 # Define NO_STRLCPY if you don't have strlcpy.
 #
 # Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the
@@ -1448,6 +1450,20 @@ else
 	NO_CURL = YesPlease
 endif
 endif
+ifeq ($(uname_S),QNX)
+	COMPAT_CFLAGS += -DSA_RESTART=0
+	NEEDS_SOCKET = YesPlease
+	NO_MKDTEMP = YesPlease
+	NO_MKSTEMPS = YesPlease
+	NO_FNMATCH_CASEFOLD = YesPlease
+	NO_GETPAGESIZE = YesPlease
+	NO_ICONV = YesPlease
+	NO_MEMMEM = YesPlease
+	NO_NSEC = YesPlease
+	NO_STRCASESTR = YesPlease
+	NO_STRLCPY = YesPlease
+	PTHREAD_LIBS =
+endif
 
 -include config.mak.autogen
 -include config.mak
@@ -1859,6 +1875,9 @@ ifdef NO_MEMMEM
 	COMPAT_CFLAGS += -DNO_MEMMEM
 	COMPAT_OBJS += compat/memmem.o
 endif
+ifdef NO_GETPAGESIZE
+	COMPAT_CFLAGS += -DNO_GETPAGESIZE
+endif
 ifdef INTERNAL_QSORT
 	COMPAT_CFLAGS += -DINTERNAL_QSORT
 	COMPAT_OBJS += compat/qsort.o
diff --git a/git-compat-util.h b/git-compat-util.h
index 2e79b8a..6c588ca 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -75,7 +75,7 @@
 # endif
 #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \
       !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \
-      !defined(__TANDEM)
+      !defined(__TANDEM) && !defined(__QNX__)
 #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #endif
@@ -99,7 +99,7 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
-#ifdef __TANDEM /* or HAVE_STRINGS_H or !NO_STRINGS_H? */
+#if defined(__TANDEM) || defined(__QNX__) /* or HAVE_STRINGS_H or !NO_STRINGS_H? */
 #include <strings.h> /* for strcasecmp() */
 #endif
 #include <errno.h>
@@ -411,6 +411,10 @@ void *gitmemmem(const void *haystack, size_t haystacklen,
                 const void *needle, size_t needlelen);
 #endif
 
+#ifdef NO_GETPAGESIZE
+#define getpagesize() sysconf(_SC_PAGESIZE)
+#endif
+
 #ifdef FREAD_READS_DIRECTORIES
 #ifdef fopen
 #undef fopen
-- 
1.8.1-rc1
Joachim Schmitz· Dec 16, 2012, 08:27 UTC · re: Matt Kraai · lore

Re: [PATCH 2/2] Port to QNX

Matt Kraai wrote:
Show 8 quoted lines
> From: Matt Kraai <matt.kraai@amo.abbott.com>
>
> Signed-off-by: Matt Kraai <matt.kraai@amo.abbott.com>
> ---
> Makefile          | 19 +++++++++++++++++++
> git-compat-util.h |  8 ++++++--
> 2 files changed, 25 insertions(+), 2 deletions(-)
>
snip
Show 20 quoted lines
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 2e79b8a..6c588ca 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -75,7 +75,7 @@
> # endif
> #elif !defined(__APPLE__) && !defined(__FreeBSD__) &&
>       !defined(__USLC__) && \ !defined(_M_UNIX) && !defined(__sgi) &&
> !defined(__DragonFly__) && \ -      !defined(__TANDEM)
> +      !defined(__TANDEM) && !defined(__QNX__)
> #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD
> needs 600 for S_ISLNK() */ #define _XOPEN_SOURCE_EXTENDED 1 /* AIX
> 5.3L needs this */ #endif
> @@ -99,7 +99,7 @@
> #include <stdlib.h>
> #include <stdarg.h>
> #include <string.h>
> -#ifdef __TANDEM /* or HAVE_STRINGS_H or !NO_STRINGS_H? */
> +#if defined(__TANDEM) || defined(__QNX__) /* or HAVE_STRINGS_H or
> !NO_STRINGS_H? */ #include <strings.h> /* for strcasecmp() */

There's another recent thread, discussing to change this to "#ifdef HAVE_STRING_H" plus the infrastructure in Makefile and configure.ac.

Bye, Jojo 
Junio C Hamano· Dec 15, 2012, 18:38 UTC · re: Matt Kraai · lore

Re: [PATCH 0/2] Port to QNX

Matt Kraai <kraai@ftbfs.org> writes:
Show 13 quoted lines
> This series ports Git to QNX.  It builds on both QNX 6.3.2 and QNX
> 6.5.0.  The test suite does not pass.  Unless the corresponding
> software is installed, the following arguments must be passed to Make:
>
>  NO_CURL=1 NO_GETTEXT=1 NO_OPENSSL=1 NO_PERL=1 NO_PYTHON=1 NO_TCLTK=1
>
>   [1/2]: Make lock local to fetch_pack
>
> QNX 6.3.2's unistd.h declares a function named lock, which causes
> fetch-pack.c to fail to compile if lock has file-scope.  Since it's
> only used in a single function, move it therein.
>
>   [2/2]: Port to QNX

I do not mind queuing this on 'pu' but do you want to see your ftbfs.org address in the commit objects, or the other one that you are not using to interact with us?

Matt Kraai· Dec 15, 2012, 21:55 UTC · re: Junio C Hamano · lore

Re: [PATCH 0/2] Port to QNX

On Sat, Dec 15, 2012 at 10:38:30AM -0800, Junio C Hamano wrote:
> I do not mind queuing this on 'pu' but do you want to see your
> ftbfs.org address in the commit objects, or the other one that you
> are not using to interact with us?

Great! I'd prefer to use the amo.abbott.com address in the commit objects, since that's where I did the work. I'm using this email address because it doesn't require figuring out how to send proper emails via Outlook and/or Exchange.

-- 
Matt

← back to recent threads