grid
2005-06-08 07:35:44 UTC
Hi,
I was going through the signal sources in the kernel for the type for
sigset_t.Earlier implementations had nearly 31 signals so a int which is
32 bits could well represent all the signals with each bit corresponding
to each signal.
But the below sources form the Linux kernel (i386) uses an array as below :
#define _NSIG 64
#define _NSIG_BPW 32
#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
typedef unsigned long old_sigset_t; /* at least 32 bits */
typedef struct {
unsigned long sig[_NSIG_WORDS];
} sigset_t;
Could not we use a datatype like long long to for each of the signals.
And how does this sigfillset() function initialize the sigset_t type as
shown below:
static inline void sigfillset(sigset_t *set)
{
switch (_NSIG_WORDS) {
default:
memset(set, -1, sizeof(sigset_t));
break;
case 2: set->sig[1] = -1;
case 1: set->sig[0] = -1;
break;
}
}
TIA
I was going through the signal sources in the kernel for the type for
sigset_t.Earlier implementations had nearly 31 signals so a int which is
32 bits could well represent all the signals with each bit corresponding
to each signal.
But the below sources form the Linux kernel (i386) uses an array as below :
#define _NSIG 64
#define _NSIG_BPW 32
#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
typedef unsigned long old_sigset_t; /* at least 32 bits */
typedef struct {
unsigned long sig[_NSIG_WORDS];
} sigset_t;
Could not we use a datatype like long long to for each of the signals.
And how does this sigfillset() function initialize the sigset_t type as
shown below:
static inline void sigfillset(sigset_t *set)
{
switch (_NSIG_WORDS) {
default:
memset(set, -1, sizeof(sigset_t));
break;
case 2: set->sig[1] = -1;
case 1: set->sig[0] = -1;
break;
}
}
TIA