On 4/5/07, Matty <matty91 at gmail.com> wrote:
> On 4/5/07, James Carlson <james.d.carlson at sun.com> wrote:
> > Darren J Moffat writes:
> > > Matty wrote:
> > > > Howdy,
> > > >
> > > > Most Linux and BSD distributions ship with a version of dd that
> > > > displays the status of a copy operation when a SIGUSR1 signal is
> > > > received. For some reason /usr/bin/dd on Solaris hosts doesn't contain
> > > > this capability, and I would like to add it. After reading through the
> > > > source code for dd.c, it looks like adding this support would be as
> > > > simple as installing a signal handler for SIGUSR1, and having it call
> > > > the function stats. I am attaching code (which I copied from the dd
> > > > that ships with Fedora Core Linux)
> > >
> > > What license is that dd code you copied under ?
> > >
> > > You can't just copy code like that without considering the licenses.
> >
> > Indeed.  That's GPLv2 code, which would require OpenSolaris dd to
> > become GPLv2 as well.
> >
> > That can't be done.  Either start provably from scratch or use
> > software under a compatible license.
>
> Your absolutely right, and Stephen Hahn was nice enough to point this
> out in an email last night. Since the existing code uses signal to
> register the SIGINT signal handler (I reckon the issues Bart mentioned
> are minimized since it exit()'s after printing the statistics):
>
> if (signal(SIGINT, SIG_IGN) != SIG_IGN)
> {
>        (void) signal(SIGINT, term);
> }
>
> Do folks see any issue with using similar code to add a SIGUSR1 signal 
> handler?:
>
> if (signal(SIGUSR1, SIG_IGN) != SIG_IGN)
> {
>         (void) signal(SIGUSR1, stats);
> }
>
> This would minmize the amount of code that would need to be added to
> get stats functionality, and would address the license issues. If this
> solution isn't acceptable, could I get a sponsor assigned to help me
> work through a community approved solution?

Ooops -- I pasted the wrong code in the second snippet. The signal()
call would actually register a function that reregisters the signal
handler, and then calls stats. Of the two signal solutions proposed in
this thread (sigaction and signal), which would folks recommend using?

Sorry for the typo,
- Ryan
-- 
UNIX Administrator
http://prefetch.net

Reply via email to