[parted-devel] porting to FreeBSD

Debarshi 'Rishi' Ray debarshi.ray at gmail.com
Fri Mar 2 15:28:10 CET 2007


> I was saying that  writing two signal handlers is not very good.
> Because the code for the one parameter one is a subset of the other.
> Any change to that shared code should be applied at two places which
> might introduce errors. Any way I understand that as the shared code
> is a few lines this is not a big deal.

Since in both cases the signal handler must have different parameter
lists, do we have much option? Typecasting is not favourable.

> > If there is no uniform pattern in which these macros are present or absent,
> > we can do something like:
> > #ifdef SA_SIGINFO
> > #ifdef SEGV_MAPPERR
> > #ifdef <any missing sigaction macro>
> > ...
> > #define USE_SIGACTION
> > ...
> > #endif
> > #endif
> > #endif
> > ...and then depending upon whether USE_SIGACTION is defined or undefined,
> > we use 'sigaction' or 'signal'.

> This sounds good. Another possibility is to just disable sigaction for
> FreeBSD and document this behaviour. The FreeBSD kernel guys already
> know this and it is fixed in their latest CVS branch.

I do not want to disable sigaction completely. It does provide some
verbosity, which is desirable.

If the other BSDs also have the same issue, then enclosing the 'case's
with #ifdef..#endif blocks can be helpful while porting Parted to
them.

Happy hacking,
Debarshi
-- 
GPG key ID: 63D4A5A7
Key server: pgp.mit.edu



More information about the parted-devel mailing list