Hi people: We are developing SqueakDBX, an openDBX (<a href="http://www.linuxnetworks.de/doc/index.php/OpenDBX" target="_blank">http://www.linuxnetworks.de/doc/index.php/OpenDBX</a>) wrapper, that let us communicate with major relational databases through a common API. OpenDBX is a C library. SqueakDBX uses FFI to call those functions. Now, I am getting an error with a select() invocation in that code.<br>
<br>This is a piece of the openDBX function with the problem:<br><br>static int pgsql_odbx_result( odbx_t* handle, odbx_result_t** result, struct timeval* timeout, unsigned long chunk )<br>{<br><br> struct pgconn* conn = (struct pgconn* ) handle->aux;<br>
<br> if( timeout != NULL ) {<br> fprintf( stdout, "timeval tv_sec value: %d\n", timeout->tv_sec );<br> fprintf( stdout, "timeval tv_usec value: %d\n", timeout->tv_usec );<br> } else {<br>
puts("El timeval is null");<br> }<br><br>......<br><br>#ifdef HAVE_SELECT<br> if( timeout != NULL && PQisBusy( (PGconn*) handle->generic ) == 1 )<br>
{<br> int fd;<br> fd_set fds;<br><br> if( ( fd = PQsocket( (PGconn*) handle->generic ) ) == -1 )<br> {<br> conn->errtype = -1;<br> return -ODBX_ERR_BACKEND;<br>
}<br>
<br> FD_ZERO( &fds );<br> FD_SET( fd, &fds );<br><br> switch( select( fd + 1, &fds, NULL, NULL, timeout ) )<br> {<br> case -1:<br> printf( "Error with select function: %s\n", strerror( errno ) );<br>
return -ODBX_ERR_RESULT;<br> case 0:<br> return ODBX_RES_TIMEOUT; /* timeout while waiting for a result */<br> }<br> }<br>#endif<br><br><br>Now, I have a problem with select() invocation. This function returns -1. And the printf of the errno (where select() stores the errors), says: "Error with select function: Interrupted system call" which means I am getting a EINTR error. If you see console, you can see something like this:<br>
<br>timeval tv_usec value: 0<br>timeval tv_sec value: 3<br>timeval tv_usec value: 0<br>timeval tv_sec value: 2<br>timeval tv_usec value: 996000<br>timeval tv_sec value: 3<br>timeval tv_usec value: 0<br>Error with select function: Interrupted system call<br>
<br>
<br>I asked Norbert (openDBX author) and he tell me exactly this: <br><br>"An interrupted system call is something very normal because signals can be sent<br>at every time to the application, either by the system or by the user. I<br>
guess, in the Squeak code there is some signal handler installed, which does<br>something if one of the defined signals arrive.<br><br>What I will do is to hide the consequences (returning an error) by looking at<br>the error value and reenter the select call if the system call is interrupted."<br>
<br>All I know is squeakVM is written it SLANG and then that's transformed to C. So, squeakVM runs in C. So, there is where it can be a signal handler ? Is there some way to change that from squeak (image) ? <br><br>
I am still newbie so I really need help with this.<br><br>Thanks for the help in advance.<br><br>Mariano<br><br>