Incompatible clipboard format between 32bit and 64bit cygwin

Takashi Yano takashi.yano@nifty.ne.jp
Tue Sep 28 08:13:42 GMT 2021


On Tue, 28 Sep 2021 00:46:15 -0600
Brian Inglis wrote:
> On 2021-09-28 00:19, Takashi Yano via Cygwin wrote:
> > On Mon, 27 Sep 2021 23:22:30 -0600
> > Brian Inglis wrote:
> >> Would it perhaps make sense to include struct stat with appropriate
> >> entries rather than a couple of adhoc members unrelated to much else?
> > 
> > struct stat also has different size between 32 and 64 bit environment,
> > therefore, it does not resolve the issue.
> 
> I didn't think any of those types varied by architecture, given the same 
> underlying file systems are supported, except the trailing long 
> st_spare4[2]; if it does, your proposal is better.

I have checked the size of struct stat using:
#include <stdio.h>
#include <sys/stat.h>

int main()
{
	intptr_t offset0, offset_atime, offset_mtime, offset_ctime;
	struct stat t0;

	printf("sizeof stat=%ld\n", sizeof(struct stat));
	offset0 = (intptr_t) &t0;
	offset_atime = (intptr_t) &t0.st_atime;
	offset_mtime = (intptr_t) &t0.st_mtime;
	offset_ctime = (intptr_t) &t0.st_ctime;
	printf("offset st_atime=%ld\n", offset_atime - offset0);
	printf("offset st_mtime=%ld\n", offset_mtime - offset0);
	printf("offset st_ctime=%ld\n", offset_ctime - offset0);
	return 0;
}

In 32bit environment, the output is:
sizeof stat=96
offset st_atime=48
offset st_mtime=56
offset st_ctime=64

In 64bit environment, the output is:
sizeof stat=128
offset st_atime=48
offset st_mtime=64
offset st_ctime=80

It seems that the size of struct timespec is different.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>



More information about the Cygwin mailing list