sigaction

Roger Oberholtzer roger at opq.se
Wed Mar 25 02:54:39 PDT 2009


On Wed, 2009-03-25 at 08:44 +0100, Roger Oberholtzer wrote:
> On Tue, 2009-03-24 at 20:20 +0000, Jorge Almeida wrote:
> > In case someone is used to sigaction(2) in linux, on a PIV:
> > 
> >  	$ make
> >  	diet gcc -Os -march=pentium4 -pipe -fomit-frame-pointer -Wall -o rdfromfile -I /opt/libowfat/include rdfromfile.c /opt/libowfat/lib/libowfat.a
> >  	rdfromfile.c:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
> >  	rdfromfile.c:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
> >  	rdfromfile.c:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
> >  	make: *** [rdfromfile] Error 1
> > 
> > (Never mind the "diet" stuff, I tried with glibc and it's the same.)
> > 
> >       1		#include <unistd.h>
> >       2		#include <signal.h>
> >       3		#include <sys/types.h>
> >       4		#include <sys/wait.h>
> >       5		#include <stdlib.h>
> >       6		#include <errno.h>
> >       7		#include <buffer.h>
> >       8		#include <open.h>
> >       9		#define STDERR buffer_2
> >      10		void err3msg(char *msg1, char *msg2, char *msg3);
> >      11		void errmsg(char *msg);
> >      12		pid_t cpid;
> >      13		void forwardsignal(int signum);
> >      14		struct sigaction frwdsigs;
> >      15		frwdsigs.sa_handler=forwardsignal;
> >      16		frwdsigs.sa_mask=0;
> >      17		frwdsigs.sa_flags=0;
> 

Here is the mistake: I was too quick before and did not look at the
obvious. You cannot put lines 15, 16 and 17 where you have them. They
must be in a procedure, or main. It is a general C thing.


-- 
Roger Oberholtzer

OPQ Systems / Ramböll RST

Ramböll Sverige AB
Krukmakargatan 21
P.O. Box 17009
SE-104 62 Stockholm, Sweden

Office: Int +46 8-615 60 20
Mobile: Int +46 70-815 1696




More information about the Linux-users mailing list