[PATCH 4/4] gnulib: import select

Pedro Alves pedro@palves.net
Wed Jun 9 12:27:25 GMT 2021


On 2021-06-08 5:52 a.m., Mike Frysinger via Gdb-patches wrote:
> On 07 Jun 2021 08:29, Tom Tromey wrote:
>>>>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
>> Mike> A few sims use this to emulate the syscall & provide network
>> Mike> functionality.
>>
>> Thank you, I think this is ok.
>>
>> There are some gnulib modules that don't work well for gdb.
>> The only one I can really remember is 'stat'.  Hopefully select isn't
>> one of them :)
> 
> that would be unfortunate, but i guess we'll find out.  i'm not sure how we
> can balance these tensions short of each project starting to carve out their
> own gnulib ports.

I think that on Windows, gnulib's select module does something very similar to 
what we do with ser-mingw.c's gdb_select:

~~~
/* On Windows, gdb_select is implemented using WaitForMulpleObjects.
   A "select thread" is created for each file descriptor.  These
   threads looks for activity on the corresponding descriptor, using
   whatever techniques are appropriate for the descriptor type.  When
   that activity occurs, the thread signals an appropriate event,
   which wakes up WaitForMultipleObjects.
~~~

I've always feared that gnulib's select module would conflict with that,
but I don't know for sure.  In theory, we should be able to replace all
that code by using gnulib's select instead, though I'm not sure gnulib
handles some particulars like Ctrl-C interruption.

I think we can avoid some pain of someone tests the import on Windows before
merging to master.

Thanks,
Pedro Alves


More information about the Gdb-patches mailing list