All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH V2 0/3] Fix compilation issues under darwin
@ 2011-05-29 22:22 Alexandre Raymond
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 1/3] Darwin: Fix incorrect check for fdatasync() in configure Alexandre Raymond
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Alexandre Raymond @ 2011-05-29 22:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexandre Raymond, andreas.faerber

I have rebased this series on top of afaerber/cocoa-for-upstream, since
Andreas will be handling it.

Changes since V1:

* reword commit message of patch 1
* add '-help' cli switch to patch 2
* remove patch 3; has already been taken into account by Andreas
* remove patch 4; will be fixed by Andreas
* use '%td' in patch 5 instead of '%d'
* remove patch 6; has already been taken into account by Stefan W.

Thanks everyone for your feedback.

Alexandre

Alexandre Raymond (3):
  Darwin: Fix incorrect check for fdatasync() in configure
  Cocoa: avoid displaying window when command-line contains '-h' or
    '-help'
  Remove warning in printf due to type mismatch

 configure               |    8 +++++++-
 target-lm32/translate.c |    2 +-
 ui/cocoa.m              |    5 +++--
 3 files changed, 11 insertions(+), 4 deletions(-)

-- 
1.7.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH V2 1/3] Darwin: Fix incorrect check for fdatasync() in configure
  2011-05-29 22:22 [Qemu-devel] [PATCH V2 0/3] Fix compilation issues under darwin Alexandre Raymond
@ 2011-05-29 22:22 ` Alexandre Raymond
  2011-05-29 23:36   ` Andreas Färber
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help' Alexandre Raymond
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 3/3] Remove warning in printf due to type mismatch Alexandre Raymond
  2 siblings, 1 reply; 15+ messages in thread
From: Alexandre Raymond @ 2011-05-29 22:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexandre Raymond, andreas.faerber

Under darwin (OS X 10.6.7), a symbol exists for the fdatasync() method
but it is not supported because _POSIX_SYNCHRONIZED_IO is set to '-1'.

Enable fdatasync() only if _POSIX_SYNCHRONIZED_IO is '>0', as per
The Open Group Base Specifications Issue 7.

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
---
 configure |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index a318d37..b21ef75 100755
--- a/configure
+++ b/configure
@@ -2477,7 +2477,13 @@ fi
 fdatasync=no
 cat > $TMPC << EOF
 #include <unistd.h>
-int main(void) { return fdatasync(0); }
+int main(void) {
+#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
+return fdatasync(0);
+#else
+#abort Not supported
+#endif
+}
 EOF
 if compile_prog "" "" ; then
     fdatasync=yes
-- 
1.7.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help'
  2011-05-29 22:22 [Qemu-devel] [PATCH V2 0/3] Fix compilation issues under darwin Alexandre Raymond
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 1/3] Darwin: Fix incorrect check for fdatasync() in configure Alexandre Raymond
@ 2011-05-29 22:22 ` Alexandre Raymond
  2011-05-29 22:32   ` Peter Maydell
  2011-06-01 22:16   ` Andreas Färber
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 3/3] Remove warning in printf due to type mismatch Alexandre Raymond
  2 siblings, 2 replies; 15+ messages in thread
From: Alexandre Raymond @ 2011-05-29 22:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexandre Raymond, andreas.faerber

There was already a check in place to avoid displaying a window
in certain modes such as vnc, nographic or curses.

Add a check for '-h' and '-help' to avoid displaying a window for a split-
second before showing the usage information.

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
---
 ui/cocoa.m |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 1ff1ac6..e1312d3 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -872,7 +872,8 @@ int main (int argc, const char * argv[]) {
             if (opt[1] == '-') {
                 opt++;
             }
-            if (!strcmp(opt, "-vnc") ||
+            if (!strcmp(opt, "-h") || !strcmp(opt, "-help") ||
+                !strcmp(opt, "-vnc") ||
                 !strcmp(opt, "-nographic") ||
                 !strcmp(opt, "-version") ||
                 !strcmp(opt, "-curses")) {
-- 
1.7.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH V2 3/3] Remove warning in printf due to type mismatch
  2011-05-29 22:22 [Qemu-devel] [PATCH V2 0/3] Fix compilation issues under darwin Alexandre Raymond
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 1/3] Darwin: Fix incorrect check for fdatasync() in configure Alexandre Raymond
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help' Alexandre Raymond
@ 2011-05-29 22:22 ` Alexandre Raymond
  2011-06-01 21:13   ` Andreas Färber
  2011-06-02  7:18   ` Stefan Weil
  2 siblings, 2 replies; 15+ messages in thread
From: Alexandre Raymond @ 2011-05-29 22:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexandre Raymond, andreas.faerber

----8<----
qemu/target-lm32/translate.c: In function ‘gen_intermediate_code_internal’:
qemu/target-lm32/translate.c:1135: warning: format ‘%zd’ expects type ‘signed size_t’, but argument 4 has type ‘int’
----8<----

Both gen_opc_ptr and gen_opc_buf are "uint16_t *". The difference between
pointers is a ptrdiff_t so printf needs '%td'.

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
---
 target-lm32/translate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/target-lm32/translate.c b/target-lm32/translate.c
index eb21158..5e19725 100644
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -1132,7 +1132,7 @@ static void gen_intermediate_code_internal(CPUState *env,
     if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
         qemu_log("\n");
         log_target_disas(pc_start, dc->pc - pc_start, 0);
-        qemu_log("\nisize=%d osize=%zd\n",
+        qemu_log("\nisize=%d osize=%td\n",
             dc->pc - pc_start, gen_opc_ptr - gen_opc_buf);
     }
 #endif
-- 
1.7.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help'
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help' Alexandre Raymond
@ 2011-05-29 22:32   ` Peter Maydell
  2011-05-29 22:40     ` Alexandre Raymond
  2011-06-01 23:05     ` Andreas Färber
  2011-06-01 22:16   ` Andreas Färber
  1 sibling, 2 replies; 15+ messages in thread
From: Peter Maydell @ 2011-05-29 22:32 UTC (permalink / raw)
  To: Alexandre Raymond; +Cc: andreas.faerber, qemu-devel

On 29 May 2011 23:22, Alexandre Raymond <cerbere@gmail.com> wrote:
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 1ff1ac6..e1312d3 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -872,7 +872,8 @@ int main (int argc, const char * argv[]) {
>             if (opt[1] == '-') {
>                 opt++;
>             }
> -            if (!strcmp(opt, "-vnc") ||
> +            if (!strcmp(opt, "-h") || !strcmp(opt, "-help") ||
> +                !strcmp(opt, "-vnc") ||
>                 !strcmp(opt, "-nographic") ||
>                 !strcmp(opt, "-version") ||
>                 !strcmp(opt, "-curses")) {

(1) presumably this doesn't work if you disable the display
with "-display none" ?
(2) it's pretty ugly and not very maintainable -- is there
some restructuring possible to avoid having to hardcode
information about qemu options into the ui code here?

(It also doesn't catch other cases where qemu prints some
information and exits immediately, like "-cpu ?".)

-- PMM

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help'
  2011-05-29 22:32   ` Peter Maydell
@ 2011-05-29 22:40     ` Alexandre Raymond
  2011-06-01 23:05     ` Andreas Färber
  1 sibling, 0 replies; 15+ messages in thread
From: Alexandre Raymond @ 2011-05-29 22:40 UTC (permalink / raw)
  To: Peter Maydell; +Cc: andreas.faerber, qemu-devel

I agree that this is not the best way to handle all cases not requiring a GUI.

However, due to the current structure of the code, it was a simple way
to cover a very common case without having to refactor the whole cocoa
code.

Alexandre

On Sun, May 29, 2011 at 6:32 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 29 May 2011 23:22, Alexandre Raymond <cerbere@gmail.com> wrote:
>> diff --git a/ui/cocoa.m b/ui/cocoa.m
>> index 1ff1ac6..e1312d3 100644
>> --- a/ui/cocoa.m
>> +++ b/ui/cocoa.m
>> @@ -872,7 +872,8 @@ int main (int argc, const char * argv[]) {
>>             if (opt[1] == '-') {
>>                 opt++;
>>             }
>> -            if (!strcmp(opt, "-vnc") ||
>> +            if (!strcmp(opt, "-h") || !strcmp(opt, "-help") ||
>> +                !strcmp(opt, "-vnc") ||
>>                 !strcmp(opt, "-nographic") ||
>>                 !strcmp(opt, "-version") ||
>>                 !strcmp(opt, "-curses")) {
>
> (1) presumably this doesn't work if you disable the display
> with "-display none" ?
> (2) it's pretty ugly and not very maintainable -- is there
> some restructuring possible to avoid having to hardcode
> information about qemu options into the ui code here?
>
> (It also doesn't catch other cases where qemu prints some
> information and exits immediately, like "-cpu ?".)
>
> -- PMM
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH V2 1/3] Darwin: Fix incorrect check for fdatasync() in configure
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 1/3] Darwin: Fix incorrect check for fdatasync() in configure Alexandre Raymond
@ 2011-05-29 23:36   ` Andreas Färber
  2011-05-30  0:09     ` Alexandre Raymond
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2011-05-29 23:36 UTC (permalink / raw)
  To: Alexandre Raymond; +Cc: qemu-devel

Am 30.05.2011 um 00:22 schrieb Alexandre Raymond:

> Under darwin (OS X 10.6.7), a symbol exists for the fdatasync() method
> but it is not supported because _POSIX_SYNCHRONIZED_IO is set to '-1'.

Question: How did you notice? Did anything break that we could  
mention, or did you just review the code?

> Enable fdatasync() only if _POSIX_SYNCHRONIZED_IO is '>0', as per
> The Open Group Base Specifications Issue 7.

Not quite what I meant. ;) Would you be okay with the following:

configure: Fix check for fdatasync()

Under Darwin, a symbol exists for the fdatasync() function, but it is
not supported. Yada yada. _POSIX_SYNCHRONIZED_IO is set to '-1'.

According to POSIX:2008, a value of -1 means the feature is not  
supported.
A value of 0 means supported at compilation time, and a value greater 0
means supported at both compilation and run time.

Enable fdatasync() only if _POSIX_SYNCHRONIZED_IO is '>0'.

Andreas

> Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
> ---
> configure |    8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/configure b/configure
> index a318d37..b21ef75 100755
> --- a/configure
> +++ b/configure
> @@ -2477,7 +2477,13 @@ fi
> fdatasync=no
> cat > $TMPC << EOF
> #include <unistd.h>
> -int main(void) { return fdatasync(0); }
> +int main(void) {
> +#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
> +return fdatasync(0);
> +#else
> +#abort Not supported
> +#endif
> +}
> EOF
> if compile_prog "" "" ; then
>     fdatasync=yes
> -- 
> 1.7.5
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH V2 1/3] Darwin: Fix incorrect check for fdatasync() in configure
  2011-05-29 23:36   ` Andreas Färber
@ 2011-05-30  0:09     ` Alexandre Raymond
  2011-05-30  2:32       ` Alexandre Raymond
  0 siblings, 1 reply; 15+ messages in thread
From: Alexandre Raymond @ 2011-05-30  0:09 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel

Sure, I'm fine with that. I wasn't sure how much detail you actually
wanted in this commit message :)

Alexandre

On Sun, May 29, 2011 at 7:36 PM, Andreas Färber <andreas.faerber@web.de> wrote:
> Am 30.05.2011 um 00:22 schrieb Alexandre Raymond:
>
>> Under darwin (OS X 10.6.7), a symbol exists for the fdatasync() method
>> but it is not supported because _POSIX_SYNCHRONIZED_IO is set to '-1'.
>
> Question: How did you notice? Did anything break that we could mention, or
> did you just review the code?
>
>> Enable fdatasync() only if _POSIX_SYNCHRONIZED_IO is '>0', as per
>> The Open Group Base Specifications Issue 7.
>
> Not quite what I meant. ;) Would you be okay with the following:
>
> configure: Fix check for fdatasync()
>
> Under Darwin, a symbol exists for the fdatasync() function, but it is
> not supported. Yada yada. _POSIX_SYNCHRONIZED_IO is set to '-1'.
>
> According to POSIX:2008, a value of -1 means the feature is not supported.
> A value of 0 means supported at compilation time, and a value greater 0
> means supported at both compilation and run time.
>
> Enable fdatasync() only if _POSIX_SYNCHRONIZED_IO is '>0'.
>
> Andreas
>
>> Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
>> ---
>> configure |    8 +++++++-
>> 1 files changed, 7 insertions(+), 1 deletions(-)
>>
>> diff --git a/configure b/configure
>> index a318d37..b21ef75 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2477,7 +2477,13 @@ fi
>> fdatasync=no
>> cat > $TMPC << EOF
>> #include <unistd.h>
>> -int main(void) { return fdatasync(0); }
>> +int main(void) {
>> +#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
>> +return fdatasync(0);
>> +#else
>> +#abort Not supported
>> +#endif
>> +}
>> EOF
>> if compile_prog "" "" ; then
>>    fdatasync=yes
>> --
>> 1.7.5
>>
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH V2 1/3] Darwin: Fix incorrect check for fdatasync() in configure
  2011-05-30  0:09     ` Alexandre Raymond
@ 2011-05-30  2:32       ` Alexandre Raymond
  2011-06-01 22:26         ` Andreas Färber
  0 siblings, 1 reply; 15+ messages in thread
From: Alexandre Raymond @ 2011-05-30  2:32 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel

I didn't notice anything broken. I just stumbled upon this bug while
reviewing the code.

Alexandre

On Sun, May 29, 2011 at 8:09 PM, Alexandre Raymond <cerbere@gmail.com> wrote:
> Sure, I'm fine with that. I wasn't sure how much detail you actually
> wanted in this commit message :)
>
> Alexandre
>
> On Sun, May 29, 2011 at 7:36 PM, Andreas Färber <andreas.faerber@web.de> wrote:
>> Am 30.05.2011 um 00:22 schrieb Alexandre Raymond:
>>
>>> Under darwin (OS X 10.6.7), a symbol exists for the fdatasync() method
>>> but it is not supported because _POSIX_SYNCHRONIZED_IO is set to '-1'.
>>
>> Question: How did you notice? Did anything break that we could mention, or
>> did you just review the code?
>>
>>> Enable fdatasync() only if _POSIX_SYNCHRONIZED_IO is '>0', as per
>>> The Open Group Base Specifications Issue 7.
>>
>> Not quite what I meant. ;) Would you be okay with the following:
>>
>> configure: Fix check for fdatasync()
>>
>> Under Darwin, a symbol exists for the fdatasync() function, but it is
>> not supported. Yada yada. _POSIX_SYNCHRONIZED_IO is set to '-1'.
>>
>> According to POSIX:2008, a value of -1 means the feature is not supported.
>> A value of 0 means supported at compilation time, and a value greater 0
>> means supported at both compilation and run time.
>>
>> Enable fdatasync() only if _POSIX_SYNCHRONIZED_IO is '>0'.
>>
>> Andreas
>>
>>> Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
>>> ---
>>> configure |    8 +++++++-
>>> 1 files changed, 7 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/configure b/configure
>>> index a318d37..b21ef75 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -2477,7 +2477,13 @@ fi
>>> fdatasync=no
>>> cat > $TMPC << EOF
>>> #include <unistd.h>
>>> -int main(void) { return fdatasync(0); }
>>> +int main(void) {
>>> +#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
>>> +return fdatasync(0);
>>> +#else
>>> +#abort Not supported
>>> +#endif
>>> +}
>>> EOF
>>> if compile_prog "" "" ; then
>>>    fdatasync=yes
>>> --
>>> 1.7.5
>>>
>>
>>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH V2 3/3] Remove warning in printf due to type mismatch
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 3/3] Remove warning in printf due to type mismatch Alexandre Raymond
@ 2011-06-01 21:13   ` Andreas Färber
  2011-06-02  7:18   ` Stefan Weil
  1 sibling, 0 replies; 15+ messages in thread
From: Andreas Färber @ 2011-06-01 21:13 UTC (permalink / raw)
  To: Markus Armbruster, Stefan Weil; +Cc: Alexandre Raymond, qemu-devel Developers

Markus, Stefan,

Am 30.05.2011 um 00:22 schrieb Alexandre Raymond:

> ----8<----
> qemu/target-lm32/translate.c: In function  
> ‘gen_intermediate_code_internal’:
> qemu/target-lm32/translate.c:1135: warning: format ‘%zd’ expects  
> type ‘signed size_t’, but argument 4 has type ‘int’
> ----8<----
>
> Both gen_opc_ptr and gen_opc_buf are "uint16_t *". The difference  
> between
> pointers is a ptrdiff_t so printf needs '%td'.
>
> Signed-off-by: Alexandre Raymond <cerbere@gmail.com>

You suggested the use of t, are you planning to ack it?

Andreas

> ---
> target-lm32/translate.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/target-lm32/translate.c b/target-lm32/translate.c
> index eb21158..5e19725 100644
> --- a/target-lm32/translate.c
> +++ b/target-lm32/translate.c
> @@ -1132,7 +1132,7 @@ static void  
> gen_intermediate_code_internal(CPUState *env,
>     if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
>         qemu_log("\n");
>         log_target_disas(pc_start, dc->pc - pc_start, 0);
> -        qemu_log("\nisize=%d osize=%zd\n",
> +        qemu_log("\nisize=%d osize=%td\n",
>             dc->pc - pc_start, gen_opc_ptr - gen_opc_buf);
>     }
> #endif
> -- 
> 1.7.5
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help'
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help' Alexandre Raymond
  2011-05-29 22:32   ` Peter Maydell
@ 2011-06-01 22:16   ` Andreas Färber
  1 sibling, 0 replies; 15+ messages in thread
From: Andreas Färber @ 2011-06-01 22:16 UTC (permalink / raw)
  To: Alexandre Raymond; +Cc: qemu-devel

Am 30.05.2011 um 00:22 schrieb Alexandre Raymond:

> There was already a check in place to avoid displaying a window
> in certain modes such as vnc, nographic or curses.
>
> Add a check for '-h' and '-help' to avoid displaying a window for a  
> split-
> second before showing the usage information.
>
> Signed-off-by: Alexandre Raymond <cerbere@gmail.com>

Thanks, applied to the cocoa branch.

> ---
> ui/cocoa.m |    3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 1ff1ac6..e1312d3 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -872,7 +872,8 @@ int main (int argc, const char * argv[]) {
>             if (opt[1] == '-') {
>                 opt++;
>             }
> -            if (!strcmp(opt, "-vnc") ||
> +            if (!strcmp(opt, "-h") || !strcmp(opt, "-help") ||
> +                !strcmp(opt, "-vnc") ||
>                 !strcmp(opt, "-nographic") ||
>                 !strcmp(opt, "-version") ||
>                 !strcmp(opt, "-curses")) {
> -- 
> 1.7.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH V2 1/3] Darwin: Fix incorrect check for fdatasync() in configure
  2011-05-30  2:32       ` Alexandre Raymond
@ 2011-06-01 22:26         ` Andreas Färber
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Färber @ 2011-06-01 22:26 UTC (permalink / raw)
  To: Alexandre Raymond; +Cc: qemu-devel

Thanks, applied to the cocoa branch with a modified description.

Am 30.05.2011 um 04:32 schrieb Alexandre Raymond:

> I didn't notice anything broken. I just stumbled upon this bug while
> reviewing the code.
>
> Alexandre
>
> On Sun, May 29, 2011 at 8:09 PM, Alexandre Raymond  
> <cerbere@gmail.com> wrote:
>> Sure, I'm fine with that. I wasn't sure how much detail you actually
>> wanted in this commit message :)

I like precise explanations, they can be time-saving when bisecting  
code. :)

http://repo.or.cz/w/qemu/afaerber.git/commit/eb5a6b85bb9a409ade5f72cd1b5f827e9bae904c

Andreas

>> On Sun, May 29, 2011 at 7:36 PM, Andreas Färber <andreas.faerber@web.de 
>> > wrote:
>>> Am 30.05.2011 um 00:22 schrieb Alexandre Raymond:
>>>
>>>> Under darwin (OS X 10.6.7), a symbol exists for the fdatasync()  
>>>> method
>>>> but it is not supported because _POSIX_SYNCHRONIZED_IO is set to  
>>>> '-1'.
>>>
>>> Question: How did you notice? Did anything break that we could  
>>> mention, or
>>> did you just review the code?
>>>
>>>> Enable fdatasync() only if _POSIX_SYNCHRONIZED_IO is '>0', as per
>>>> The Open Group Base Specifications Issue 7.
>>>
>>> Not quite what I meant. ;) Would you be okay with the following:
>>>
>>> configure: Fix check for fdatasync()
>>>
>>> Under Darwin, a symbol exists for the fdatasync() function, but it  
>>> is
>>> not supported. Yada yada. _POSIX_SYNCHRONIZED_IO is set to '-1'.
>>>
>>> According to POSIX:2008, a value of -1 means the feature is not  
>>> supported.
>>> A value of 0 means supported at compilation time, and a value  
>>> greater 0
>>> means supported at both compilation and run time.
>>>
>>> Enable fdatasync() only if _POSIX_SYNCHRONIZED_IO is '>0'.
>>>
>>> Andreas
>>>
>>>> Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
>>>> ---
>>>> configure |    8 +++++++-
>>>> 1 files changed, 7 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/configure b/configure
>>>> index a318d37..b21ef75 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -2477,7 +2477,13 @@ fi
>>>> fdatasync=no
>>>> cat > $TMPC << EOF
>>>> #include <unistd.h>
>>>> -int main(void) { return fdatasync(0); }
>>>> +int main(void) {
>>>> +#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
>>>> +return fdatasync(0);
>>>> +#else
>>>> +#abort Not supported
>>>> +#endif
>>>> +}
>>>> EOF
>>>> if compile_prog "" "" ; then
>>>>    fdatasync=yes
>>>> --
>>>> 1.7.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help'
  2011-05-29 22:32   ` Peter Maydell
  2011-05-29 22:40     ` Alexandre Raymond
@ 2011-06-01 23:05     ` Andreas Färber
  2011-06-02  6:10       ` Peter Maydell
  1 sibling, 1 reply; 15+ messages in thread
From: Andreas Färber @ 2011-06-01 23:05 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Alexandre Raymond, Alexander Graf, Anthony Liguori,
	qemu-devel Developers

Am 30.05.2011 um 00:32 schrieb Peter Maydell:

> On 29 May 2011 23:22, Alexandre Raymond <cerbere@gmail.com> wrote:
>> diff --git a/ui/cocoa.m b/ui/cocoa.m
>> index 1ff1ac6..e1312d3 100644
>> --- a/ui/cocoa.m
>> +++ b/ui/cocoa.m
>> @@ -872,7 +872,8 @@ int main (int argc, const char * argv[]) {
>>             if (opt[1] == '-') {
>>                 opt++;
>>             }
>> -            if (!strcmp(opt, "-vnc") ||
>> +            if (!strcmp(opt, "-h") || !strcmp(opt, "-help") ||
>> +                !strcmp(opt, "-vnc") ||
>>                 !strcmp(opt, "-nographic") ||
>>                 !strcmp(opt, "-version") ||
>>                 !strcmp(opt, "-curses")) {
>
> (1) presumably this doesn't work if you disable the display
> with "-display none" ?

I don't see how that would not work. It's just not handled specially  
here, so it will likely display a window - the former behavior of all  
these switches.

> (2) it's pretty ugly and not very maintainable -- is there
> some restructuring possible to avoid having to hardcode
> information about qemu options into the ui code here?
>
> (It also doesn't catch other cases where qemu prints some
> information and exits immediately, like "-cpu ?".)

My saying! It's a general problem though: On my GNOME desktop I have  
some launchers for frequently used QEMU machines; it did occur that  
something changed in QEMU and nothing at all happened when double- 
clicking and I had to repeat the same in a terminal to find out why.  
Similar back when using a bundled Q.app on Mac OS X (i.e., a process  
that does not display a Terminal window).

What I have asked for in the past is an override mechanism for error  
messages, so that at runtime we can detect properly whether we're  
running in console or window mode and choose to display a MessageBox  
on Windows, a modal sheet on Mac OS X, a BAlert or whatever a frontend  
author sees fit. Sequential fprintf(stderr, ...) is not really helpful  
for that use case.

The added difficulty for Cocoa is that it needs to go through  
Objective-C (e.g., ui/cocoa.m).

Since that is a larger task and a long-time open issue, I see no  
reason not to accept this patch as an interim solution.

Andreas


P.S. I haven't found any VNC viewer component either, to resort to a  
specialized virt-manager-like graphical interface process with child  
QEMU processes. So going down the VNC route as once under discussion  
would mean forking and maintaining a VNC client for a particular less- 
common platform, which I am not comfortable with, given the occasional  
protocol extensions contributed to QEMU.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help'
  2011-06-01 23:05     ` Andreas Färber
@ 2011-06-02  6:10       ` Peter Maydell
  0 siblings, 0 replies; 15+ messages in thread
From: Peter Maydell @ 2011-06-02  6:10 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Alexandre Raymond, Alexander Graf, Anthony Liguori,
	qemu-devel Developers

On 2 June 2011 00:05, Andreas Färber <andreas.faerber@web.de> wrote:
> Am 30.05.2011 um 00:32 schrieb Peter Maydell:
>> (1) presumably this doesn't work if you disable the display
>> with "-display none" ?
>
> I don't see how that would not work. It's just not handled specially here,
> so it will likely display a window - the former behavior of all these
> switches.

Yes, that's my point -- this chunk of code is trying to implement
"don't bring up the display window if we won't use it", and it
doesn't work properly [ie does not suppress the window in all the
cases where it should] because inevitably it lags behind the
set of options in vl.c which don't bring up the display window.

I don't particularly object to the patch being committed as a short
term measure.

-- PMM

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH V2 3/3] Remove warning in printf due to type mismatch
  2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 3/3] Remove warning in printf due to type mismatch Alexandre Raymond
  2011-06-01 21:13   ` Andreas Färber
@ 2011-06-02  7:18   ` Stefan Weil
  1 sibling, 0 replies; 15+ messages in thread
From: Stefan Weil @ 2011-06-02  7:18 UTC (permalink / raw)
  To: Alexandre Raymond; +Cc: andreas.faerber, qemu-devel

Am 30.05.2011 00:22, schrieb Alexandre Raymond:
> ----8<----
> qemu/target-lm32/translate.c: In function 
> ‘gen_intermediate_code_internal’:
> qemu/target-lm32/translate.c:1135: warning: format ‘%zd’ expects type 
> ‘signed size_t’, but argument 4 has type ‘int’
> ----8<----
>
> Both gen_opc_ptr and gen_opc_buf are "uint16_t *". The difference between
> pointers is a ptrdiff_t so printf needs '%td'.
>
> Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
> ---
> target-lm32/translate.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/target-lm32/translate.c b/target-lm32/translate.c
> index eb21158..5e19725 100644
> --- a/target-lm32/translate.c
> +++ b/target-lm32/translate.c
> @@ -1132,7 +1132,7 @@ static void 
> gen_intermediate_code_internal(CPUState *env,
> if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
> qemu_log("\n");
> log_target_disas(pc_start, dc->pc - pc_start, 0);
> - qemu_log("\nisize=%d osize=%zd\n",
> + qemu_log("\nisize=%d osize=%td\n",
> dc->pc - pc_start, gen_opc_ptr - gen_opc_buf);
> }
> #endif

Acked-by: Stefan Weil <weil@mail.berlios.de>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-06-02  7:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-29 22:22 [Qemu-devel] [PATCH V2 0/3] Fix compilation issues under darwin Alexandre Raymond
2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 1/3] Darwin: Fix incorrect check for fdatasync() in configure Alexandre Raymond
2011-05-29 23:36   ` Andreas Färber
2011-05-30  0:09     ` Alexandre Raymond
2011-05-30  2:32       ` Alexandre Raymond
2011-06-01 22:26         ` Andreas Färber
2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help' Alexandre Raymond
2011-05-29 22:32   ` Peter Maydell
2011-05-29 22:40     ` Alexandre Raymond
2011-06-01 23:05     ` Andreas Färber
2011-06-02  6:10       ` Peter Maydell
2011-06-01 22:16   ` Andreas Färber
2011-05-29 22:22 ` [Qemu-devel] [PATCH V2 3/3] Remove warning in printf due to type mismatch Alexandre Raymond
2011-06-01 21:13   ` Andreas Färber
2011-06-02  7:18   ` Stefan Weil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.