view sources/toys/mysetsid.c @ 772:7cb6ef2cdf10

Busybox unstable currently needs this patch too.
author Rob Landley <rob@landley.net>
date Wed, 01 Jul 2009 18:02:44 -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;
}