Hello,
I have been doing some coding on SANE now that my Python project was mindless...
I have almost got all the MainFunction compiled there is just two files that dont work... the first is a file with SCSI support commands in it, I have just skip it as I have no SCSI to test it with.
The second is Thread support and a more serious problem. They have been so nice to make two versions one with fork() and one with PThread.. When I try to compile the file it complains about some sigaction structure/function. (see below)
static void restore_sigpipe( void ) { struct sigaction act;
if( sigaction( SIGPIPE, NULL, &act ) == 0 ) {
if( act.sa_handler == SIG_IGN ) { sigemptyset( &act.sa_mask ); act.sa_flags = 0; act.sa_handler = SIG_DFL;
DBG( 2, "restoring SIGPIPE to SIG_DFL\n" ); sigaction( SIGPIPE, &act, NULL ); } } }
In this code its first definded sigaction as a structure and then call it as a function ?! Its not the only place where they do that trick.
This is what the compiler writes to me
2.Work:CVS-Home/sane-backends> make gcc -Wall -mcrt=clib2 -Os -Iwork:cvs-home/sane-backends/include -c -o sanei/sanei_thread.o sanei/sanei_thread.c sanei/sanei_thread.c: In function `restore_sigpipe': sanei/sanei_thread.c:310: error: storage size of 'act' isn't known sanei/sanei_thread.c:312: warning: implicit declaration of function `sigaction' sanei/sanei_thread.c:312: error: `SIGPIPE' undeclared (first use in this function) sanei/sanei_thread.c:312: error: (Each undeclared identifier is reported only once sanei/sanei_thread.c:312: error: for each function it appears in.) sanei/sanei_thread.c:310: warning: unused variable `act' sanei/sanei_thread.c: In function `sanei_thread_begin': sanei/sanei_thread.c:356: error: storage size of 'act' isn't known sanei/sanei_thread.c:360: error: `SIGPIPE' undeclared (first use in this function) sanei/sanei_thread.c:356: warning: unused variable `act' sanei/sanei_thread.c: In function `sanei_thread_sendsig': sanei/sanei_thread.c:411: warning: implicit declaration of function `pthread_kill' make: *** [sanei/sanei_thread.o] Error 1
Any vice person that know what to do?
Ohh ya almost forgot they seam to use pthread_kill() is there an easy way to emulate that function?
Kind regards Rene W. Olsen
Rene W. Olsen wrote:
Hello,
I have been doing some coding on SANE now that my Python project was mindless...
I have almost got all the MainFunction compiled there is just two files that dont work... the first is a file with SCSI support commands in it, I have just skip it as I have no SCSI to test it with.
The second is Thread support and a more serious problem. They have been so nice to make two versions one with fork() and one with PThread.. When I try to compile the file it complains about some sigaction structure/function. (see below)
static void restore_sigpipe( void ) { struct sigaction act;
if( sigaction( SIGPIPE, NULL, &act ) == 0 ) { if( act.sa_handler == SIG_IGN ) { sigemptyset( &act.sa_mask ); act.sa_flags = 0; act.sa_handler = SIG_DFL; DBG( 2, "restoring SIGPIPE to SIG_DFL\n" ); sigaction( SIGPIPE, &act, NULL ); } }
}
In this code its first definded sigaction as a structure and then call it as a function ?! Its not the only place where they do that trick.
Uhm, they obviously have some code that needs to run with sigpipe ignored, and most code runs with sigpipe handled. sigaction is a function used to change or examine the settings of the signal handler for a specific signal. In this case you might get away with a global variable instead, and just do:
if(global_sigpipe_status_variable == SIG_IGN) { global_sigpipe_status_variable == SIG_DFL; signal(SIG_PIPE,global_sigpipe_status_variable); }
Or something.