[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dd hangs with SIGINT
From: |
James Youngman |
Subject: |
Re: dd hangs with SIGINT |
Date: |
Fri, 8 Apr 2005 14:21:35 +0100 |
User-agent: |
Mutt/1.3.28i |
On Fri, Apr 08, 2005 at 01:34:41PM +0200, Bruno Haible wrote:
> Jim Meyering wrote:
> > Thanks for the patch, but that `cure' seems worse than the disease.
>
> I agree. The real good way to make this work on POSIX systems (without
> assuming multithreading) is to use fork().
>
> - Let the parent process fork a child process, block the signals SIGHUP,
> SIGQUIT, SIGPIPE in the parent, and watch the child's exit status.
> If the exit status of the child is 128 + SIGHUP/SIGQUIT/SIGPIPE,
> print the statistics.
> - Let the child process to the real I/O work.
This seems a bit cumbersome, and I'm not sure how the parent knows
what the right statistics are.
I have not read the "dd" code in any great detail, but it would seem
to me that the right thing to do is set a sig_atomic_t flag in the
signal handler. The main loop in dd_copy() should check that flag and
output the statistics (and then reset the flag).
If you want a slightly higher quality of implementation than that,
then you could improve safe_read() and full_write() to call a callback
function before restarting their read or write system call.
James.
- Re: dd hangs with SIGINT, (continued)
- Re: dd hangs with SIGINT, Guillaume Chazarain, 2005/04/07
- Re: dd hangs with SIGINT, Jim Meyering, 2005/04/07
- Re: dd hangs with SIGINT, Guillaume Chazarain, 2005/04/07
- Re: dd hangs with SIGINT, Jim Meyering, 2005/04/07
- Re: dd hangs with SIGINT, Guillaume Chazarain, 2005/04/08
- Re: dd hangs with SIGINT, Paul Eggert, 2005/04/07
- Re: dd hangs with SIGINT, Andreas Schwab, 2005/04/07
- Re: dd hangs with SIGINT, Bruno Haible, 2005/04/08
- Re: dd hangs with SIGINT, Guillaume Chazarain, 2005/04/08
- Re: dd hangs with SIGINT, Andreas Schwab, 2005/04/08
- Re: dd hangs with SIGINT,
James Youngman <=