# Re: [PATCH] Improve QNX support in GIT

4 messages from 2013-02-26 to 2013-02-26. Participants: Matt Kraai, Mike Gorchak, Johannes Sixt.
Thread: https://gitlist.dev/t/33024

## Matt Kraai, 2013-02-26 20:13

Subject: Re: [PATCH] Improve QNX support in GIT
Message-ID: <20130226201305.GA3502@ftbfs.org>
URL: https://gitlist.dev/e/20130226201305.GA3502%40ftbfs.org

```
Hi,

Please include me in the Cc field, since I'm not subscribed to the
list.

Mike Gorchak wrote:
> Do you have a testcase for this (without using git codebase)? I wrote
> numerous resource managers since QNX 6.0 using threads and fork()s for
> daemonization in different order and never experienced a problems.
> There can be issues with pipes in case of external command run.

I just created the following one:


#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <process.h>

static void *
start_routine (void *arg)
{
  return NULL;
}

int
main (int argc, char **argv)
{
  int err;

  if ((err = pthread_create (NULL, NULL, start_routine, NULL)))
    {
      fprintf (stderr, "foo: pthread_create failed: %s\n", strerror (errno));
      return 1;
    }

  if (fork () == -1)
    {
      fprintf (stderr, "foo: fork failed: %s\n", strerror (errno));
      return 1;
    }

  return 0;
}


When I compile and run it on either QNX 6.3.2 or QNX 6.5.0, it
produces the following output:

 foo: fork failed: Function not implemented

If I remove the call to pthread_create, it doesn't output anything and
exits successfully.

```

## Mike Gorchak, 2013-02-26 20:32

Subject: Re: [PATCH] Improve QNX support in GIT
Message-ID: <CAHXAxrOcC7GX-rhT793t4vcF68TvrE9w9OW856+7cGDBGMx0VA@mail.gmail.com>
URL: https://gitlist.dev/e/CAHXAxrOcC7GX-rhT793t4vcF68TvrE9w9OW856%2B7cGDBGMx0VA%40mail.gmail.com
In-Reply-To: <20130226201305.GA3502@ftbfs.org>

```
> If I remove the call to pthread_create, it doesn't output anything and
> exits successfully.

I see. Most resource managers use procmgr_daemon(), which has no such
limitation. Anyway, as far as I can see current git sources do not use
fork together with pthread, except for daemonize() function.

```

## Johannes Sixt, 2013-02-26 20:53

Subject: Re: [PATCH] Improve QNX support in GIT
Message-ID: <512D20C5.7050305@kdbg.org>
URL: https://gitlist.dev/e/512D20C5.7050305%40kdbg.org
In-Reply-To: <CAHXAxrOcC7GX-rhT793t4vcF68TvrE9w9OW856+7cGDBGMx0VA@mail.gmail.com>

```
Am 26.02.2013 21:32, schrieb Mike Gorchak:
>> If I remove the call to pthread_create, it doesn't output anything and
>> exits successfully.
> 
> I see. Most resource managers use procmgr_daemon(), which has no such
> limitation. Anyway, as far as I can see current git sources do not use
> fork together with pthread, except for daemonize() function.

Not true: When a clean or smudge filter is configured, a thread is
created, and the thread runs the external program via fork().

-- Hannes

```

## Matt Kraai, 2013-02-26 21:02

Subject: Re: [PATCH] Improve QNX support in GIT
Message-ID: <20130226210246.GB3502@ftbfs.org>
URL: https://gitlist.dev/e/20130226210246.GB3502%40ftbfs.org
In-Reply-To: <CAHXAxrOcC7GX-rhT793t4vcF68TvrE9w9OW856+7cGDBGMx0VA@mail.gmail.com>

```
On Tue, Feb 26, 2013 at 10:32:16PM +0200, Mike Gorchak wrote:
> I see. Most resource managers use procmgr_daemon(), which has no such
> limitation. Anyway, as far as I can see current git sources do not use
> fork together with pthread, except for daemonize() function.

If threads are enabled, git does use fork after calling pthread_create:

 * When I run "git grep foo".
 * When I run "git fetch" to update my git working copy, which is
   using an HTTPS remote.

Both of these commands fail as a result.

```
