From owner-freebsd-questions@FreeBSD.ORG Mon Jan 5 20:47:03 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B91221065704 for ; Mon, 5 Jan 2009 20:47:03 +0000 (UTC) (envelope-from patfbsd@davenulle.org) Received: from smtp.lamaiziere.net (net.lamaiziere.net [91.121.44.19]) by mx1.freebsd.org (Postfix) with ESMTP id 7D8EC8FC1D for ; Mon, 5 Jan 2009 20:47:03 +0000 (UTC) (envelope-from patfbsd@davenulle.org) Received: from baby-jane.lamaiziere.net (246.10.87-79.rev.gaoland.net [79.87.10.246]) by smtp.lamaiziere.net (Postfix) with ESMTPA id E0A70633692; Mon, 5 Jan 2009 21:47:01 +0100 (CET) Received: from baby-jane-lamaiziere-net.local (localhost [127.0.0.1]) by baby-jane.lamaiziere.net (Postfix) with ESMTP id CD13B697169; Mon, 5 Jan 2009 21:47:00 +0100 (CET) Date: Mon, 5 Jan 2009 21:46:59 +0100 From: Patrick =?ISO-8859-15?Q?Lamaizi=E8re?= To: freebsd-questions@freebsd.org, Edward King Message-ID: <20090105214659.125f55a2@baby-jane-lamaiziere-net.local> In-Reply-To: <022201c96f07$553b65a0$3f83a8c0@user863c0bf569> References: <022201c96f07$553b65a0$3f83a8c0@user863c0bf569> Organization: /dave/nulle X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.9; i386-apple-darwin9.3.0) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Cc: Subject: Re: why printf() don't work? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2009 20:47:04 -0000 Le Mon, 05 Jan 2009 15:29:23 +0800, Edward King a écrit : > I use FreeBSD7.0,and use signal,like follows: > signal(SIGHUP,sig_hup); > signal(SIGIO,sig_io); > > when I run call following code,it can run,but I find a puzzled > question,it should print some information,such as printf("execute > main()") will print execute main(),but in fact,printf fuction print > none!!! Why printf function do not go work? Just to be sure : You should not use printf() in a signal handler, it is not considered 'signal safe'. (See man sigaction) Regards.