File:  [Research Unix] / researchv9 / ipc / src / mgrs / common / detach.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:59 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv9-SUN3_old, researchv9-SUN3, HEAD
researchv9-SUN3(old)

#include <sys/types.h>
#include <stdio.h>
#include <ipc.h>
#include <libc.h>
#include "defs.h"

/* detach from the terminal */
detach(mtpt)
	char *mtpt;
{
	int i;

	/* equivalent to sh's & */
	switch(fork()) {
	case 0:
	case -1:
		break;
	default:
		exit(0);
	}
	openlog(mtpt);

	/* disassociate from ttys and other process groups */
	setpgrp(getpid(), getpid());
	close(0);
	close(1);
	for (i=4; i<NSYSFILE; i++)
		close(i);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.