This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/4939] New: setpgid fails from a thread other than main
- From: "qrczak at knm dot org dot pl" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 19 Aug 2007 15:01:10 -0000
- Subject: [Bug nptl/4939] New: setpgid fails from a thread other than main
- Reply-to: sourceware-bugzilla at sourceware dot org
I see no reason why the following call to setpgid would fail:
#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
--
Summary: setpgid fails from a thread other than main
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: nptl
AssignedTo: drepper at redhat dot com
ReportedBy: qrczak at knm dot org dot pl
CC: glibc-bugs at sources dot redhat dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=4939
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.