setpgid(0,0)是将目前进程的进程组号修改为目前进程的进程号，因此问题即出在了进程组号上，后来我在LINUX KERNEL找到了Foreground Process Group和Background Process Group的定义，才发现了原因的所在。
Among the process groups in a session at most one can be the foreground process group of that session. The tty input and tty signals (signals generated by ^C, ^Z, etc.) go to processes in this foreground process group.
一个session里面最多只能有一个进程组， The tty input and tty signals (signals generated by ^C, ^Z, etc.) 会进入到该前台进程组的进程。
A process can set the foreground process group in its session using tcsetpgrp(fd,pgrp), where fd refers to its controlling tty, and pgrp is a process group in the its session, and this session still is associated to the controlling tty of the calling process.