* [PATCH] ioemu: use asprintf instead of PATH_MAX
@ 2008-01-23 17:20 Samuel Thibault
2008-01-23 20:53 ` Mike D. Day
0 siblings, 1 reply; 5+ messages in thread
From: Samuel Thibault @ 2008-01-23 17:20 UTC (permalink / raw)
To: xen-devel
Use asprintf instead of PATH_MAX, which POSIX says to be facultative.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
diff -r c364f80eb4b5 tools/ioemu/target-i386-dm/helper2.c
--- a/tools/ioemu/target-i386-dm/helper2.c Wed Jan 23 13:27:21 2008 +0000
+++ b/tools/ioemu/target-i386-dm/helper2.c Wed Jan 23 17:18:56 2008 +0000
@@ -635,7 +635,7 @@
extern int suspend_requested;
CPUState *env = cpu_single_env;
int evtchn_fd = xce_handle == -1 ? -1 : xc_evtchn_fd(xce_handle);
- char qemu_file[PATH_MAX];
+ char *qemu_file;
fd_set fds;
int ret = 0;
@@ -665,9 +665,9 @@
main_loop_wait(1); /* For the select() on events */
/* Save the device state */
- snprintf(qemu_file, sizeof(qemu_file),
- "/var/lib/xen/qemu-save.%d", domid);
+ asprintf(&qemu_file, "/var/lib/xen/qemu-save.%d", domid);
do_savevm(qemu_file);
+ free(qemu_file);
xenstore_record_dm_state("paused");
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: ioemu: use asprintf instead of PATH_MAX
2008-01-23 17:20 [PATCH] ioemu: use asprintf instead of PATH_MAX Samuel Thibault
@ 2008-01-23 20:53 ` Mike D. Day
2008-01-24 1:38 ` Samuel Thibault
0 siblings, 1 reply; 5+ messages in thread
From: Mike D. Day @ 2008-01-23 20:53 UTC (permalink / raw)
To: Samuel Thibault, xen-devel
erOn 23/01/08 17:20 +0000, Samuel Thibault wrote:
> Use asprintf instead of PATH_MAX, which POSIX says to be facultative.
>
> Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
> - snprintf(qemu_file, sizeof(qemu_file),
> - "/var/lib/xen/qemu-save.%d", domid);
> + asprintf(&qemu_file, "/var/lib/xen/qemu-save.%d", domid);
Just a question - afaik asprintf is a unix-ism that isn't supported on
windows. Will this cause problems if also pushed to upstream qemu?
Mike
--
Mike D. Day
IBM LTC
Cell: 919 412-3900
Sametime: ncmike@us.ibm.com AIM: ncmikeday Yahoo: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ioemu: use asprintf instead of PATH_MAX
2008-01-23 20:53 ` Mike D. Day
@ 2008-01-24 1:38 ` Samuel Thibault
2008-01-24 14:45 ` Mike D. Day
0 siblings, 1 reply; 5+ messages in thread
From: Samuel Thibault @ 2008-01-24 1:38 UTC (permalink / raw)
To: Mike D. Day; +Cc: xen-devel
Mike D. Day, le Wed 23 Jan 2008 15:53:47 -0500, a écrit :
> erOn 23/01/08 17:20 +0000, Samuel Thibault wrote:
> > Use asprintf instead of PATH_MAX, which POSIX says to be facultative.
> >
> > Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
>
> > - snprintf(qemu_file, sizeof(qemu_file),
> > - "/var/lib/xen/qemu-save.%d", domid);
> > + asprintf(&qemu_file, "/var/lib/xen/qemu-save.%d", domid);
>
> Just a question - afaik asprintf is a unix-ism that isn't supported on
> windows. Will this cause problems if also pushed to upstream qemu?
qemu is quite often used in windows too so that would pose problem
indeed. But I guess the /var/lib patch would too anyway :) And this
part of the code is actually xen-specific.
Samuel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ioemu: use asprintf instead of PATH_MAX
2008-01-24 1:38 ` Samuel Thibault
@ 2008-01-24 14:45 ` Mike D. Day
2008-01-24 14:56 ` Keir Fraser
0 siblings, 1 reply; 5+ messages in thread
From: Mike D. Day @ 2008-01-24 14:45 UTC (permalink / raw)
To: Samuel Thibault, xen-devel
On 24/01/08 01:38 +0000, Samuel Thibault wrote:
> Mike D. Day, le Wed 23 Jan 2008 15:53:47 -0500, a écrit :
> > erOn 23/01/08 17:20 +0000, Samuel Thibault wrote:
> > > Use asprintf instead of PATH_MAX, which POSIX says to be facultative.
> > >
> > > Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
> >
> > > - snprintf(qemu_file, sizeof(qemu_file),
> > > - "/var/lib/xen/qemu-save.%d", domid);
> > > + asprintf(&qemu_file, "/var/lib/xen/qemu-save.%d", domid);
> >
> > Just a question - afaik asprintf is a unix-ism that isn't supported on
> > windows. Will this cause problems if also pushed to upstream qemu?
>
> qemu is quite often used in windows too so that would pose problem
> indeed. But I guess the /var/lib patch would too anyway :) And this
> part of the code is actually xen-specific.
Yes, true. At a higher scope, what are current plans for a merge with
upstream Qemu? Is the process to merge upstream or to continue
maintaining the Xen differences out-of-tree?
thanks,
Mike
--
Mike D. Day
IBM LTC
Cell: 919 412-3900
Sametime: ncmike@us.ibm.com AIM: ncmikeday Yahoo: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: ioemu: use asprintf instead of PATH_MAX
2008-01-24 14:45 ` Mike D. Day
@ 2008-01-24 14:56 ` Keir Fraser
0 siblings, 0 replies; 5+ messages in thread
From: Keir Fraser @ 2008-01-24 14:56 UTC (permalink / raw)
To: ncmike, Samuel Thibault, xen-devel
On 24/1/08 14:45, "Mike D. Day" <ncmike@us.ibm.com> wrote:
>>> Just a question - afaik asprintf is a unix-ism that isn't supported on
>>> windows. Will this cause problems if also pushed to upstream qemu?
>>
>> qemu is quite often used in windows too so that would pose problem
>> indeed. But I guess the /var/lib patch would too anyway :) And this
>> part of the code is actually xen-specific.
>
> Yes, true. At a higher scope, what are current plans for a merge with
> upstream Qemu? Is the process to merge upstream or to continue
> maintaining the Xen differences out-of-tree?
We'd like the diff to be reduced of course, but it depends if anyone is
enthusiastic enough to do the work.
-- Keir
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-24 14:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-23 17:20 [PATCH] ioemu: use asprintf instead of PATH_MAX Samuel Thibault
2008-01-23 20:53 ` Mike D. Day
2008-01-24 1:38 ` Samuel Thibault
2008-01-24 14:45 ` Mike D. Day
2008-01-24 14:56 ` Keir Fraser
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.