[Bugme-new] [Bug 8921] New: setpgid fails from a thread other than
main
bugme-daemon at bugzilla.kernel.org
bugme-daemon at bugzilla.kernel.org
Wed Aug 22 02:56:06 PDT 2007
http://bugzilla.kernel.org/show_bug.cgi?id=8921
Summary: setpgid fails from a thread other than main
Product: Process Management
Version: 2.5
KernelVersion: 2.6.21.5
Platform: All
OS/Version: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: Other
AssignedTo: process_other at kernel-bugs.osdl.org
ReportedBy: qrczak at knm.org.pl
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
--
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the Bugme-new
mailing list