On Apr 29, 2004, at 8:04 AM, Nicholas Clark wrote:

../lib/warnings.t 503 1 0.20% 224

This is this test:
...
exec $^X, "-e0" ;

and it is failing with ENOTSUP. Really. I checked with ktrace:
...
Of course, this can't be happening, as the OS X man page doesn't list ENOTSUP as a possible return from execve. Hence I don't know where to look next.
(Darwin source code....?)

It turns out that you can't execve with more than one running thread (apparently). The code below demonstrates. I don't know why this is the case (or why the test code is hitting this), but I figured this out by looking at the kernel source code (xnu project, in Darwin).


JEff

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

#include <stdio.h>
#include <unistd.h>
#include <errno.h>

extern char **environ;

void* doNothing(void *data)
{
    while(1) {}
    return NULL;
}

int main (int argc, const char * argv[])
{
    pthread_t thread;
    int retVal;

printf("Starting!\n");

pthread_create(&thread, NULL, doNothing, NULL);

retVal = execve("/usr/bin/true", argv, environ);

    printf("retVal = %d, errno = %d\n", retVal, errno);
    perror(NULL);

    return 0;
}
/*
output:

Starting!
retVal = -1, errno = 45
Operation not supported
*/



Reply via email to