Closed
Description
This program hangs on GNU/Linux. package main /* #include <sys/types.h> #include <unistd.h> */ import "C" import "fmt" func main() { i, errno := C.setgid(1) fmt.Println(i, errno) } The problem is that when a threaded program calls setgid, the pthreads library sends a SIGSETXID signal to each thread, and waits for the thread to acknowledge it. The Go runtime overrides the default signal handler with a Go-specific one. Since the os/signal package is not imported, the Go-specific signal handler simply ignores SIGSETXID. This means that the acknowledgement is never sent, and the program hangs.