Date: Mon, 11 May 1998 04:23:36 +0100 From: Brian Somers <brian@Awfulhak.org> To: freebsd-hackers@FreeBSD.ORG Subject: SCM_RIGHTS & session ids Message-ID: <199805110323.EAA28416@awfulhak.org>
next in thread | raw e-mail | index | archive | help
Hi, I've bumped into a bit of a problem implementing multilink ppp. Maybe someone can suggest a way out of my dilemma.... I have two processes, each of which has its own session id and is the only process in the sessions only process group. I've closed STDOUT and STDERR, and STDIN_FILENO is the only thing keeping the controlling terminal attached. Both the process group and the session id of each process is owned by its respective terminal. .-------------. .-------------. | Session 123 | | Session 456 | `-------------' `-------------' | | .------------. .------------. | /dev/cuaa0 | | /dev/cuaa1 | `------------' `------------' | | .-------------. .-------------. | Process 123 | | Process 456 | `-------------' `-------------' I wish to pass descriptor 0 from p123 to p456 using SCM_RIGHTS over a unix domain socket, and then for p123 to exit. When I do this, as soon as p456 selects on the passed descriptor (say descriptor 10), and *after* p123 has exited, I get an exception from select() (exception fdset) and the descriptor is useless. If I have p123 close() STDIN_FILENO after the transfer, then execl("/bin/sleep", "sleep", 100", NULL) p456 can read descriptor 10 for 100 seconds - once (I assume) the process group of /dev/cuaa0 is gone, all descriptors are invalidated. What I've tried (nothing's helped): o p123 does an fd = open(ttyname(STDIN_FILENO), O_RDWR), then close(STDIN_FILENO) and pass fd to p456. o p123 calls tcsetpgrp(STDIN_FILENO, 456) - doesn't work 'cos p456 isn't part of p123s session. This all works when there are no controlling terminals involved (ppp over tcp). I guess that the problem is that a process group has only one session and a session has only one controlling terminal... Is the only way to simply exec() a keepalive process() (yeuch) ? TIA. -- Brian <brian@Awfulhak.org>, <brian@FreeBSD.org>, <brian@OpenBSD.org> <http://www.Awfulhak.org> Don't _EVER_ lose your sense of humour.... To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199805110323.EAA28416>