why printf() don't work?

Patrick Lamaizière patfbsd at davenulle.org
Mon Jan 5 12:47:04 PST 2009


Le Mon, 05 Jan 2009 15:29:23 +0800,
Edward King <zhangsc at neusoft.com> 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.


More information about the freebsd-questions mailing list