Re: sigset_t

2004-05-24 Thread Malcolm Kay
On Monday 24 May 2004 23:40, Arne Dirks wrote:
 Hi folks,

 I have just coded something on my Mac with signal
 funcionalities. On my machine (OS X 10.3) it compiles
 without problems, but on a FreeBSD 5.2.1 machine I get an
 error. The compiler says:

 main.c:10: error: invalid initializer
 *** Error code 1


 My Code was:

 10: sigset_t sig = SIGALRM;


 As I said, on a Mac it compiles well, but the BSD-machine
 is giving the named error. I think there must be a type
 mismatch, but I cannot find any declaration for sigset_t
 in the include dir.

On 4.9 it is defined in include/sys/signal.h

typedef struct __sigset {
unsigned int__bits[_SIG_WORDS];
} sigset_t;

Which does not muatch the integer type of SIGALRM.

Malcolm 

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: sigset_t

2004-05-24 Thread Dan Nelson
In the last episode (May 24), Arne Dirks said:
 I have just coded something on my Mac with signal funcionalities. On
 my machine (OS X 10.3) it compiles without problems, but on a FreeBSD
 5.2.1 machine I get an error. The compiler says:
 
 main.c:10: error: invalid initializer
 *** Error code 1
 
 
 My Code was:
 
 10: sigset_t sig = SIGALRM;

sigset_t is a signal set, which I believe is a bitmap internally. 
SIGALRM is just a number.  You must use the functions listed in the
sigsetops manpage to manipulate signal sets.  The correct code for your
case would be something like:

sigset_t sig;
sigemptyset(sig);
sigaddset(sig, SIGALRM);
 
-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]