Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Sep 1999 10:51:41 -0400 (EDT)
From:      Peter Dufault <dufault@hda.com>
To:        marcel@scc.nl (Marcel Moolenaar)
Cc:        current@FreeBSD.ORG
Subject:   Re: (P)review: sigset_t for more than 32 signals
Message-ID:  <199909061451.KAA07461@hda.hda.com>
In-Reply-To: <37D3CB2D.10485299@scc.nl> from Marcel Moolenaar at "Sep 6, 99 04:09:49 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> Peter Dufault wrote:
> 
> > 1. Immediately do roughly what you displayed only without increasing
> > the number of signals but instead using two sixteen bit ints, and
> > commit after testing.
> [snip]
> > 2. Switch to the higher number of signals using the approach I
> > suggested making the high 16 bits of the "header"
> > word an unusual pattern of mask bits by looking at bits unlikely
> > to ever be masked.
> [snip]
> 
> You forget that you still need to be backwards compatible...

No -

What about binary compatability?   You can't change the size of the
sigset_t without changing the system call.

I assumed you had added a new system call and kept
the old one for compatability along with a compatability header.  I didn't
look closely enough at your patches.

I'll quickly type this so forgive the errors, and I hope Bruce
isn't following this.

First a compat/signal.h that sets up a few test macros and includes
for the new signal.h.  This is used for compatability, however,
initially this will be signal.h and the new signal.h will be newsignal.h
to provide the "stay 32 bits and binary compatible and find broken programs"
period:

compat/signal.h:

========================
#ifndef _COMPAT_SIGNAL_H_
#define _COMPAT_SIGNAL_H_

#include <sys/types.h>

/* Set up test macros to configure signal.h for compatability.  */

/* Old number of signals: */

#define NSIG 32

/* Don't use a "header" that specifies number of signals: */

#define _SIGNAL_HEADER 0

#ifndef _SIGNAL_PIECES_T

/* Set up the typedef for signals.  Use a pair of 16 bit integers
 * to catch programs that cheat on using sigset_t access methods:
 */
#ifdef _SIGNAL_CATCH_BROKEN
typedef u_int16_t signal_pieces_t;
#else
typedef u_int32_t signal_pieces_t;
#endif

#define _SIGNAL_PIECES_T signal_pieces_t

#endif /* _SIGNAL_PIECES_T */

#include <signal.h>
#endif	/* _COMPAT_SIGNAL_H_ */
========================

Now a real signal.h:

========================
#ifndef _SIGNAL_H_
#define _SIGNAL_H_

#include <sys/types.h>

/* Are we running in compatability mode? */

#ifndef _COMPAT_SIGNAL_H_

/* Not compat mode, set up for 64 bit signals */

#define NSIG 64
#define _SIGNAL_HEADER 1

#ifndef _SIGNAL_PIECES_T
typedef u_int32_t signal_pieces_t;
#define _SIGNAL_PIECES_T signal_pieces_t
#endif
#endif /* _COMPAT_SIGNAL_H_ */

/* Finally we can define our typedef.  How many items do
 * we need in our array, taking into account
 *
 * XXX Pretend we included the right thing to get _NBBY, the
 * number of bits in a byte, I don't know what that may be.
 */

#ifdef _SIGNAL_HEADER
#define _SIGNAL_N ((NSIG / (sizeof(signal_pieces_t) * _NBBY) + 1))
#else
#define _SIGNAL_N (NSIG / (sizeof(signal_pieces_t) * _NBBY))
#endif

typedef struct {
	signal_pieces_t s[_SIGNAL_N];
};

/* Now just insert the macros to make this work...
 */

. . .

#endif /* _SIGNAL_H_ */

========================

Peter

-- 
Peter Dufault (dufault@hda.com)   Realtime development, Machine control,
HD Associates, Inc.               Safety critical systems, Agency approval


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909061451.KAA07461>