* [Qemu-devel] [PATCH] target-xtensa: fix missing errno codes for mingw32
@ 2012-09-06 0:36 Max Filippov
2012-09-06 4:45 ` Stefan Weil
2012-09-08 9:07 ` Blue Swirl
0 siblings, 2 replies; 6+ messages in thread
From: Max Filippov @ 2012-09-06 0:36 UTC (permalink / raw)
To: qemu-devel; +Cc: Blue Swirl, Stefan Weil, Max Filippov
Put the following errno value mappings under #ifdef:
xtensa-semi.c: In function 'errno_h2g':
xtensa-semi.c:113: error: 'ENOTBLK' undeclared (first use in this function)
xtensa-semi.c:113: error: (Each undeclared identifier is reported only once
xtensa-semi.c:113: error: for each function it appears in.)
xtensa-semi.c:113: error: array index in initializer not of integer type
xtensa-semi.c:113: error: (near initialization for 'guest_errno')
xtensa-semi.c:124: error: 'ETXTBSY' undeclared (first use in this function)
xtensa-semi.c:124: error: array index in initializer not of integer type
xtensa-semi.c:124: error: (near initialization for 'guest_errno')
xtensa-semi.c:134: error: 'ELOOP' undeclared (first use in this function)
xtensa-semi.c:134: error: array index in initializer not of integer type
xtensa-semi.c:134: error: (near initialization for 'guest_errno')
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
target-xtensa/xtensa-semi.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/target-xtensa/xtensa-semi.c b/target-xtensa/xtensa-semi.c
index e745bef..52be07a 100644
--- a/target-xtensa/xtensa-semi.c
+++ b/target-xtensa/xtensa-semi.c
@@ -110,7 +110,9 @@ static uint32_t errno_h2g(int host_errno)
[ENOMEM] = TARGET_ENOMEM,
[EACCES] = TARGET_EACCES,
[EFAULT] = TARGET_EFAULT,
+#ifdef ENOTBLK
[ENOTBLK] = TARGET_ENOTBLK,
+#endif
[EBUSY] = TARGET_EBUSY,
[EEXIST] = TARGET_EEXIST,
[EXDEV] = TARGET_EXDEV,
@@ -121,7 +123,9 @@ static uint32_t errno_h2g(int host_errno)
[ENFILE] = TARGET_ENFILE,
[EMFILE] = TARGET_EMFILE,
[ENOTTY] = TARGET_ENOTTY,
+#ifdef ETXTBSY
[ETXTBSY] = TARGET_ETXTBSY,
+#endif
[EFBIG] = TARGET_EFBIG,
[ENOSPC] = TARGET_ENOSPC,
[ESPIPE] = TARGET_ESPIPE,
@@ -131,7 +135,9 @@ static uint32_t errno_h2g(int host_errno)
[EDOM] = TARGET_EDOM,
[ERANGE] = TARGET_ERANGE,
[ENOSYS] = TARGET_ENOSYS,
+#ifdef ELOOP
[ELOOP] = TARGET_ELOOP,
+#endif
};
if (host_errno == 0) {
--
1.7.7.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] target-xtensa: fix missing errno codes for mingw32
2012-09-06 0:36 [Qemu-devel] [PATCH] target-xtensa: fix missing errno codes for mingw32 Max Filippov
@ 2012-09-06 4:45 ` Stefan Weil
2012-09-06 12:48 ` Max Filippov
2012-09-08 9:07 ` Blue Swirl
1 sibling, 1 reply; 6+ messages in thread
From: Stefan Weil @ 2012-09-06 4:45 UTC (permalink / raw)
To: Max Filippov; +Cc: Blue Swirl, qemu-devel
Am 06.09.2012 02:36, schrieb Max Filippov:
> Put the following errno value mappings under #ifdef:
>
> xtensa-semi.c: In function 'errno_h2g':
> xtensa-semi.c:113: error: 'ENOTBLK' undeclared (first use in this function)
> xtensa-semi.c:113: error: (Each undeclared identifier is reported only once
> xtensa-semi.c:113: error: for each function it appears in.)
> xtensa-semi.c:113: error: array index in initializer not of integer type
> xtensa-semi.c:113: error: (near initialization for 'guest_errno')
> xtensa-semi.c:124: error: 'ETXTBSY' undeclared (first use in this function)
> xtensa-semi.c:124: error: array index in initializer not of integer type
> xtensa-semi.c:124: error: (near initialization for 'guest_errno')
> xtensa-semi.c:134: error: 'ELOOP' undeclared (first use in this function)
> xtensa-semi.c:134: error: array index in initializer not of integer type
> xtensa-semi.c:134: error: (near initialization for 'guest_errno')
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
>
Is semi hosting a useful feature when QEMU runs on a Windows host?
If not, you could conditionally compile the whole semi hosting code
for non Windows only.
If yes, what about the differences in system calls between UNIX like
operating systems and Windows? Should the code for 'open' add O_BINARY?
Regards,
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] target-xtensa: fix missing errno codes for mingw32
2012-09-06 4:45 ` Stefan Weil
@ 2012-09-06 12:48 ` Max Filippov
2012-09-07 20:22 ` Stefan Weil
0 siblings, 1 reply; 6+ messages in thread
From: Max Filippov @ 2012-09-06 12:48 UTC (permalink / raw)
To: Stefan Weil; +Cc: Blue Swirl, qemu-devel
On Thu, Sep 6, 2012 at 8:45 AM, Stefan Weil <sw@weilnetz.de> wrote:
> Am 06.09.2012 02:36, schrieb Max Filippov:
>
>> Put the following errno value mappings under #ifdef:
>>
>> xtensa-semi.c: In function 'errno_h2g':
>> xtensa-semi.c:113: error: 'ENOTBLK' undeclared (first use in this
>> function)
>> xtensa-semi.c:113: error: (Each undeclared identifier is reported only
>> once
>> xtensa-semi.c:113: error: for each function it appears in.)
>> xtensa-semi.c:113: error: array index in initializer not of integer type
>> xtensa-semi.c:113: error: (near initialization for 'guest_errno')
>> xtensa-semi.c:124: error: 'ETXTBSY' undeclared (first use in this
>> function)
>> xtensa-semi.c:124: error: array index in initializer not of integer type
>> xtensa-semi.c:124: error: (near initialization for 'guest_errno')
>> xtensa-semi.c:134: error: 'ELOOP' undeclared (first use in this function)
>> xtensa-semi.c:134: error: array index in initializer not of integer type
>> xtensa-semi.c:134: error: (near initialization for 'guest_errno')
>>
>> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
>> ---
>>
>
> Is semi hosting a useful feature when QEMU runs on a Windows host?
It should be if windows is POSIX enough.
> If not, you could conditionally compile the whole semi hosting code
> for non Windows only.
>
> If yes, what about the differences in system calls between UNIX like
> operating systems and Windows? Should the code for 'open' add O_BINARY?
...otherwise \n will turn to \r\n? IIRC this behaviour was tunable at the system
level under cygwin. Not under mingw?
Is there a list of such differences?
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] target-xtensa: fix missing errno codes for mingw32
2012-09-06 12:48 ` Max Filippov
@ 2012-09-07 20:22 ` Stefan Weil
2012-09-07 21:20 ` Max Filippov
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Weil @ 2012-09-07 20:22 UTC (permalink / raw)
To: Max Filippov, Blue Swirl; +Cc: qemu-devel
Am 06.09.2012 14:48, schrieb Max Filippov:
> On Thu, Sep 6, 2012 at 8:45 AM, Stefan Weil<sw@weilnetz.de> wrote:
>> Am 06.09.2012 02:36, schrieb Max Filippov:
>>
>>> Put the following errno value mappings under #ifdef:
>>>
>>> xtensa-semi.c: In function 'errno_h2g':
>>> xtensa-semi.c:113: error: 'ENOTBLK' undeclared (first use in this
>>> function)
>>> xtensa-semi.c:113: error: (Each undeclared identifier is reported only
>>> once
>>> xtensa-semi.c:113: error: for each function it appears in.)
>>> xtensa-semi.c:113: error: array index in initializer not of integer type
>>> xtensa-semi.c:113: error: (near initialization for 'guest_errno')
>>> xtensa-semi.c:124: error: 'ETXTBSY' undeclared (first use in this
>>> function)
>>> xtensa-semi.c:124: error: array index in initializer not of integer type
>>> xtensa-semi.c:124: error: (near initialization for 'guest_errno')
>>> xtensa-semi.c:134: error: 'ELOOP' undeclared (first use in this function)
>>> xtensa-semi.c:134: error: array index in initializer not of integer type
>>> xtensa-semi.c:134: error: (near initialization for 'guest_errno')
>>>
>>> Signed-off-by: Max Filippov<jcmvbkbc@gmail.com>
>>> ---
>>>
>>
>> Is semi hosting a useful feature when QEMU runs on a Windows host?
>
> It should be if windows is POSIX enough.
>
>> If not, you could conditionally compile the whole semi hosting code
>> for non Windows only.
>>
>> If yes, what about the differences in system calls between UNIX like
>> operating systems and Windows? Should the code for 'open' add O_BINARY?
>
> ...otherwise \n will turn to \r\n? IIRC this behaviour was tunable at the system
> level under cygwin. Not under mingw?
>
> Is there a list of such differences?
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Blue, please take the patch as it is and commit it:
compilation for MinGW is currently broken, and the patch fixes that.
The system calls should be handled by a separate patch.
Yes, 'open' with MinGW opens files in text mode by default.
That implies automatic translation from \n to \r\n on writes
and vice versa on read. It also implies that seeking can give
unexpected results.
Or-ing the flags for open with O_BINARY would fix the problem
and works also for other OS were we define O_BINARY = 0.
Like Cygwin, MinGW also supports linking with binmode.o.
That file changes the default for open to binary mode,
so all open calls in QEMU would automatically be binary.
Maybe that second alternative is the better one.
I noticed that lseek takes an int32_t offset. Is this
intentional? It limits file size to 2 GiB.
I did not see other potential problems with the system calls.
Thanks,
Stefan W.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] target-xtensa: fix missing errno codes for mingw32
2012-09-07 20:22 ` Stefan Weil
@ 2012-09-07 21:20 ` Max Filippov
0 siblings, 0 replies; 6+ messages in thread
From: Max Filippov @ 2012-09-07 21:20 UTC (permalink / raw)
To: Stefan Weil; +Cc: Blue Swirl, qemu-devel
On Sat, Sep 8, 2012 at 12:22 AM, Stefan Weil <sw@weilnetz.de> wrote:
> Am 06.09.2012 14:48, schrieb Max Filippov:
>
>> On Thu, Sep 6, 2012 at 8:45 AM, Stefan Weil<sw@weilnetz.de> wrote:
>>>
>>> Am 06.09.2012 02:36, schrieb Max Filippov:
>>>
>>>> Put the following errno value mappings under #ifdef:
>>>>
>>>> xtensa-semi.c: In function 'errno_h2g':
>>>> xtensa-semi.c:113: error: 'ENOTBLK' undeclared (first use in this
>>>> function)
>>>> xtensa-semi.c:113: error: (Each undeclared identifier is reported only
>>>> once
>>>> xtensa-semi.c:113: error: for each function it appears in.)
>>>> xtensa-semi.c:113: error: array index in initializer not of integer type
>>>> xtensa-semi.c:113: error: (near initialization for 'guest_errno')
>>>> xtensa-semi.c:124: error: 'ETXTBSY' undeclared (first use in this
>>>> function)
>>>> xtensa-semi.c:124: error: array index in initializer not of integer type
>>>> xtensa-semi.c:124: error: (near initialization for 'guest_errno')
>>>> xtensa-semi.c:134: error: 'ELOOP' undeclared (first use in this
>>>> function)
>>>> xtensa-semi.c:134: error: array index in initializer not of integer type
>>>> xtensa-semi.c:134: error: (near initialization for 'guest_errno')
>>>>
>>>> Signed-off-by: Max Filippov<jcmvbkbc@gmail.com>
>>>> ---
>>>>
>>>
>>> Is semi hosting a useful feature when QEMU runs on a Windows host?
>>
>>
>> It should be if windows is POSIX enough.
>>
>>> If not, you could conditionally compile the whole semi hosting code
>>> for non Windows only.
>>>
>>> If yes, what about the differences in system calls between UNIX like
>>> operating systems and Windows? Should the code for 'open' add O_BINARY?
>>
>>
>> ...otherwise \n will turn to \r\n? IIRC this behaviour was tunable at the
>> system
>> level under cygwin. Not under mingw?
>>
>> Is there a list of such differences?
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>
> Blue, please take the patch as it is and commit it:
> compilation for MinGW is currently broken, and the patch fixes that.
>
> The system calls should be handled by a separate patch.
>
> Yes, 'open' with MinGW opens files in text mode by default.
> That implies automatic translation from \n to \r\n on writes
> and vice versa on read. It also implies that seeking can give
> unexpected results.
Looks like open flags need mapping for bits other than
O_RD/WR/RDWR, I'll post a patch.
> Or-ing the flags for open with O_BINARY would fix the problem
> and works also for other OS were we define O_BINARY = 0.
>
> Like Cygwin, MinGW also supports linking with binmode.o.
> That file changes the default for open to binary mode,
> so all open calls in QEMU would automatically be binary.
>
> Maybe that second alternative is the better one.
>
> I noticed that lseek takes an int32_t offset. Is this
> intentional? It limits file size to 2 GiB.
Yes, unfortunately offset is passed in single 32-bit register.
> I did not see other potential problems with the system calls.
Thanks for the review, Stefan.
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] target-xtensa: fix missing errno codes for mingw32
2012-09-06 0:36 [Qemu-devel] [PATCH] target-xtensa: fix missing errno codes for mingw32 Max Filippov
2012-09-06 4:45 ` Stefan Weil
@ 2012-09-08 9:07 ` Blue Swirl
1 sibling, 0 replies; 6+ messages in thread
From: Blue Swirl @ 2012-09-08 9:07 UTC (permalink / raw)
To: Max Filippov; +Cc: Stefan Weil, qemu-devel
Thanks, applied.
On Thu, Sep 6, 2012 at 12:36 AM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> Put the following errno value mappings under #ifdef:
>
> xtensa-semi.c: In function 'errno_h2g':
> xtensa-semi.c:113: error: 'ENOTBLK' undeclared (first use in this function)
> xtensa-semi.c:113: error: (Each undeclared identifier is reported only once
> xtensa-semi.c:113: error: for each function it appears in.)
> xtensa-semi.c:113: error: array index in initializer not of integer type
> xtensa-semi.c:113: error: (near initialization for 'guest_errno')
> xtensa-semi.c:124: error: 'ETXTBSY' undeclared (first use in this function)
> xtensa-semi.c:124: error: array index in initializer not of integer type
> xtensa-semi.c:124: error: (near initialization for 'guest_errno')
> xtensa-semi.c:134: error: 'ELOOP' undeclared (first use in this function)
> xtensa-semi.c:134: error: array index in initializer not of integer type
> xtensa-semi.c:134: error: (near initialization for 'guest_errno')
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
> target-xtensa/xtensa-semi.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/target-xtensa/xtensa-semi.c b/target-xtensa/xtensa-semi.c
> index e745bef..52be07a 100644
> --- a/target-xtensa/xtensa-semi.c
> +++ b/target-xtensa/xtensa-semi.c
> @@ -110,7 +110,9 @@ static uint32_t errno_h2g(int host_errno)
> [ENOMEM] = TARGET_ENOMEM,
> [EACCES] = TARGET_EACCES,
> [EFAULT] = TARGET_EFAULT,
> +#ifdef ENOTBLK
> [ENOTBLK] = TARGET_ENOTBLK,
> +#endif
> [EBUSY] = TARGET_EBUSY,
> [EEXIST] = TARGET_EEXIST,
> [EXDEV] = TARGET_EXDEV,
> @@ -121,7 +123,9 @@ static uint32_t errno_h2g(int host_errno)
> [ENFILE] = TARGET_ENFILE,
> [EMFILE] = TARGET_EMFILE,
> [ENOTTY] = TARGET_ENOTTY,
> +#ifdef ETXTBSY
> [ETXTBSY] = TARGET_ETXTBSY,
> +#endif
> [EFBIG] = TARGET_EFBIG,
> [ENOSPC] = TARGET_ENOSPC,
> [ESPIPE] = TARGET_ESPIPE,
> @@ -131,7 +135,9 @@ static uint32_t errno_h2g(int host_errno)
> [EDOM] = TARGET_EDOM,
> [ERANGE] = TARGET_ERANGE,
> [ENOSYS] = TARGET_ENOSYS,
> +#ifdef ELOOP
> [ELOOP] = TARGET_ELOOP,
> +#endif
> };
>
> if (host_errno == 0) {
> --
> 1.7.7.6
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-09-08 9:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-06 0:36 [Qemu-devel] [PATCH] target-xtensa: fix missing errno codes for mingw32 Max Filippov
2012-09-06 4:45 ` Stefan Weil
2012-09-06 12:48 ` Max Filippov
2012-09-07 20:22 ` Stefan Weil
2012-09-07 21:20 ` Max Filippov
2012-09-08 9:07 ` Blue Swirl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).