[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#639658: kfreebsd-image-8.1-1-amd64: calling waitpid from a thread raises 'no child processes'



Package: kfreebsd-image-8.1-1-amd64
Version: 8.1+dfsg-8
Severity: serious

Hi,

Test case:
<---------
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int retval;
int pid;

void * thread_get_retval(void *arg) {
        if (waitpid(pid, &retval, 0) == -1) {
                perror("waitpid");
                exit(1);
        }
        printf("hello\n");
        return(0);
}

int main() {
        pthread_t tid;
        if ((pid = fork()) == 0) {
                return 42;
        }
        printf("PID: %d\n", pid);

        if (pthread_create(&tid, NULL, thread_get_retval, NULL)) {
                perror("pthread_create");
                exit(1);
        }
        printf("Retval: %d\n", WEXITSTATUS(retval));
        return 0;
}
--------->

As you can see, the main thread delegates the waitpid call to a sub-thread. But both
threads are still part of the same process, so waitpid should not fail.

However:
Debian GNU/Linux:
PID: 27610
hello
Retval: 42

FreeBSD:
PID: 1172
hello
Retval: 42

Debian GNU/kFreeBSD:
./debian-kfreebsd-amd64:~# ./forkthread
PID: 719
waitpid: No child processes

This breaks the ruby1.9.1 test suite.

- Lucas

-- System Information:
Debian Release: 6.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 8.1-1-amd64
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages kfreebsd-image-8.1-1-amd64 depends on:
ii  freebsd-utils                 8.1-4+b1   FreeBSD utilities needed for GNU/k
ii  kldutils                      8.1-4+b1   tools for managing kFreeBSD module

kfreebsd-image-8.1-1-amd64 recommends no packages.

kfreebsd-image-8.1-1-amd64 suggests no packages.

-- no debconf information



Reply to: