Most recent kernel where this bug did not occur: unknown Distribution: PLD Linux Hardware Environment: i686 Software Environment: glibc-2.6.1 (NPTL) Problem Description: Calling setpgid on a child process by a thread other than the main thread fails with ESRCH. Steps to reproduce: #include <stdlib.h> #include <unistd.h> #include <pthread.h> #include <stdio.h> void *thread_body(void *arg) { pid_t pid; int status; (void)arg; pid = fork(); if (pid == 0) { sleep(1); exit(0); } if (setpgid(pid, 0) == -1) perror("setpgid"); else printf("ok\n"); return NULL; } int main(void) { pthread_t th; printf("From the main thread\n"); thread_body(NULL); printf("From another thread\n"); pthread_create(&th, NULL, thread_body, NULL); pthread_join(th, NULL); return 0; } Actual result: From the main thread ok From another thread setpgid: No such process Expected result: From the main thread ok From another thread ok
What makes you believe that ok+ok is the expected result?
It's correct that setpgid should work from any thread in the group. Oleg's patch fixes it.
Dnia 22-08-2007, Śr o godzinie 10:30 -0700, Randy Dunlap napisał(a): > > > so "fixes http://bugzilla.kernel.org/show_bug.cgi?id=8921" ?? > > > > Hopefully yes... should I add some note at /bugzilla.kernel.org? > > I think that it can wait until Marcin confirms that it's fixed > (if he does so soon), then mark 8921 as fixed. Yes, it's fixed. Thank you! -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/