Return-Path: To: bluez-devel@lists.sourceforge.net From: Frank Mandarino Date: Thu, 05 Oct 2006 16:43:48 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060603000704050406030104" Subject: [Bluez-devel] [Patch] Stop ctrl-c from aborting detached hciattach Reply-To: BlueZ development List-Id: BlueZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: bluez-devel-bounces@lists.sourceforge.net Errors-To: bluez-devel-bounces@lists.sourceforge.net This is a multi-part message in MIME format. --------------060603000704050406030104 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, I was running some test programs on my embedded system, and noticed that my detached hciattach process, which I started from the command line, was being killed when I entered ctrl-c to abort my test program. The attached patch prevents signals generated by keyboard sequences, such as ctrl-c, from being delivered to the detached hciattach process by changing its process group id. I'm not sure why daemon() wasn't called to create the detached process like hcid does it, but calling setpgrp() seems to be sufficient. Signed-off-by: Frank Mandarino Regards, ../fam -- Frank Mandarino fmandarino(a)endrelia.com Endrelia Technologies Inc. Toronto, Ontario, Canada --------------060603000704050406030104 Content-Type: text/x-patch; name="hciattach-setpgrp.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="hciattach-setpgrp.patch" Index: hciattach.c =================================================================== RCS file: /cvsroot/bluez/utils/tools/hciattach.c,v retrieving revision 1.41 diff -u -r1.41 hciattach.c --- hciattach.c 10 Aug 2006 10:21:01 -0000 1.41 +++ hciattach.c 5 Oct 2006 20:19:50 -0000 @@ -1255,6 +1255,10 @@ return 0; } + /* set a new process group so that ctrl-c + won't abort the detached process */ + setpgrp(); + for (i = 0; i < 20; i++) if (i != n) close(i); --------------060603000704050406030104 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV --------------060603000704050406030104 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel --------------060603000704050406030104--