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>&nbsp;&nbsp;&nbsp; struct pgconn* conn = (struct pgconn* ) handle-&gt;aux;<br>


<br>&nbsp;&nbsp;&nbsp; if( timeout != NULL ) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf( stdout, &quot;timeval tv_sec value: %d\n&quot;, timeout-&gt;tv_sec );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf( stdout, &quot;timeval tv_usec value: %d\n&quot;, timeout-&gt;tv_usec );<br>&nbsp;&nbsp;&nbsp; } else {<br>


&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; puts(&quot;El timeval is null&quot;);<br>&nbsp;&nbsp;&nbsp; }<br><br>......<br><br>#ifdef HAVE_SELECT<br>&nbsp;&nbsp;&nbsp; if( timeout != NULL &amp;&amp; PQisBusy( (PGconn*) handle-&gt;generic ) == 1 )<br>

&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int fd;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fd_set fds;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if( ( fd = PQsocket( (PGconn*) handle-&gt;generic ) ) == -1 )<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; conn-&gt;errtype = -1;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return -ODBX_ERR_BACKEND;<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FD_ZERO( &amp;fds );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FD_SET( fd, &amp;fds );<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; switch( select( fd + 1, &amp;fds, NULL, NULL, timeout ) )<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case -1:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; printf( &quot;Error with select function: %s\n&quot;, strerror( errno ) );<br>


&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return -ODBX_ERR_RESULT;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 0:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return ODBX_RES_TIMEOUT;&nbsp;&nbsp; /* timeout while waiting for a result */<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<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: &quot;Error with select function: Interrupted system call&quot; 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>&quot;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.&quot;<br>

<br>All I know is squeakVM is written it SLANG and then that&#39;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>