view sources/toys/mysetsid.c @ 812:4e1e6aa7f445

Convince gcc to build/install libgcc_eh.a even for --disable-shared compilers, and tell the wrapper to expect it.
author Rob Landley <rob@landley.net>
date Sat, 22 Aug 2009 04:07:00 -0500
parents 428df726cf7f
children
line wrap: on
line source

#include <unistd.h>

// This is a more thorough version of setsid, which sets up both a session
// ID and a process group, and points the stdin signal handling to the new
// process group.

int main(int argc, char *argv[])
{
  setsid();
  setpgid(0,0);
  tcsetpgrp(0, getpid());
  if (argc>1) execvp(argv[1], argv+1);
  return 127;
}