[PATCH] Cygwin: Make native clipboard layout same for 32- and 64-bit

Jon Turney jon.turney@dronecode.org.uk
Sat Oct 9 14:29:33 GMT 2021


On 07/10/2021 06:22, Mark Geisert wrote:
 > The cygutils package has two programs, putclip and getclip, that also
 > depend on the layout of the cygcb_t.  At present they have duplicate
 > defs of struct cygcb_t defined here as no Cygwin header provides it.

This struct should maybe be in sys/cygwin.h or similar, if it's expected 
to be used in user-space as well.

On 09/10/2021 15:19, Ken Brown wrote:
> On 10/8/2021 5:52 AM, Takashi Yano wrote:
>> How about simply just:
>>
>> diff --git a/winsup/cygwin/fhandler_clipboard.cc 
>> b/winsup/cygwin/fhandler_clipboard.cc
>> index ccdb295f3..d822f4fc4 100644
>> --- a/winsup/cygwin/fhandler_clipboard.cc
>> +++ b/winsup/cygwin/fhandler_clipboard.cc
>> @@ -28,9 +28,10 @@ static const WCHAR *CYGWIN_NATIVE = 
>> L"CYGWIN_NATIVE_CLIPBOARD";
>>   typedef struct
>>   {
>> -  timestruc_t    timestamp;
>> -  size_t    len;
>> -  char        data[1];
>> +  uint64_t tv_sec;
>> +  uint64_t tv_nsec;
>> +  uint64_t len;
>> +  char data[1];
>>   } cygcb_t;
> 
> The only problem with this is that it might leave readers scratching 
> their heads unless they look at the commit that introduced this.  What 

I think the solution to that is a "comment" like "we don't use 'struct 
timespec' here as it's different size on different arches and that 
causes problem XYZ".

(I think that's preferable to conditional code which we assert (but 
don't ensure) is the same on all arches)


More information about the Cygwin-patches mailing list