public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/4939] New: setpgid fails from a thread other than main
@ 2007-08-19 15:01 qrczak at knm dot org dot pl
  2007-08-22  7:38 ` [Bug nptl/4939] " drepper at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: qrczak at knm dot org dot pl @ 2007-08-19 15:01 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug nptl/4939] setpgid fails from a thread other than main
  2007-08-19 15:01 [Bug nptl/4939] New: setpgid fails from a thread other than main qrczak at knm dot org dot pl
@ 2007-08-22  7:38 ` drepper at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: drepper at redhat dot com @ 2007-08-22  7:38 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2007-08-22 07:38 -------
That's a kernel issue.  setpgid in libc is nothing but a wrapper around the syscall.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-22  7:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-19 15:01 [Bug nptl/4939] New: setpgid fails from a thread other than main qrczak at knm dot org dot pl
2007-08-22  7:38 ` [Bug nptl/4939] " drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).