Re: [libvirt] [Qemu-devel] [PATCH v4 7/7] osdep: Enable qemu_open to dup pre-opened fd

2012-06-25 Thread Corey Bryant
On 06/25/2012 10:34 AM, Eric Blake wrote: On 06/25/2012 08:24 AM, Corey Bryant wrote: +if (fcntl_setfl(ret, O_CLOEXEC, (flags & O_CLOEXEC) ? 1 : 0) < 0) { Broken. O_CLOEXEC _only_ affects open(); to change it on an existing fd, you have to use fcntl(F_GETFD/F_SETFD) (not F_GETF

Re: [libvirt] [Qemu-devel] [PATCH v4 7/7] osdep: Enable qemu_open to dup pre-opened fd

2012-06-25 Thread Corey Bryant
On 06/25/2012 11:26 AM, Kevin Wolf wrote: Am 25.06.2012 16:34, schrieb Eric Blake: Also, I noticed in the fnctl man page that F_SETFL: "On Linux this command can change only the O_APPEND, O_ASYNC, O_DIRECT, O_NOATIME, and O_NONBLOCK flags." So I'll only set/unset these flags. O_NDELAY is t

Re: [libvirt] [Qemu-devel] [PATCH v4 7/7] osdep: Enable qemu_open to dup pre-opened fd

2012-06-25 Thread Corey Bryant
On 06/25/2012 10:34 AM, Eric Blake wrote: On 06/25/2012 08:24 AM, Corey Bryant wrote: +if (fcntl_setfl(ret, O_CLOEXEC, (flags & O_CLOEXEC) ? 1 : 0) < 0) { Broken. O_CLOEXEC _only_ affects open(); to change it on an existing fd, you have to use fcntl(F_GETFD/F_SETFD) (not F_GETF

Re: [libvirt] [Qemu-devel] [PATCH v4 7/7] osdep: Enable qemu_open to dup pre-opened fd

2012-06-25 Thread Kevin Wolf
Am 25.06.2012 16:34, schrieb Eric Blake: >> Also, I noticed in the fnctl man page that F_SETFL: "On Linux this >> command can change only the O_APPEND, O_ASYNC, O_DIRECT, O_NOATIME, and >> O_NONBLOCK flags." So I'll only set/unset these flags. > > O_NDELAY is the obsolete spelling of O_NONBLOCK;

Re: [libvirt] [Qemu-devel] [PATCH v4 7/7] osdep: Enable qemu_open to dup pre-opened fd

2012-06-25 Thread Eric Blake
On 06/25/2012 08:24 AM, Corey Bryant wrote: >>> +if (fcntl_setfl(ret, O_CLOEXEC, (flags & O_CLOEXEC) ? 1 >>> : 0) < 0) { >> >> Broken. O_CLOEXEC _only_ affects open(); to change it on an existing >> fd, you have to use fcntl(F_GETFD/F_SETFD) (not F_GETFL/F_SETFL). >> >> > > I'll fix

Re: [libvirt] [Qemu-devel] [PATCH v4 7/7] osdep: Enable qemu_open to dup pre-opened fd

2012-06-25 Thread Corey Bryant
On 06/22/2012 03:58 PM, Eric Blake wrote: On 06/22/2012 12:36 PM, Corey Bryant wrote: This patch adds support to qemu_open to dup(fd) a pre-opened file descriptor if the filename is of the format /dev/fd/X. This can be used when QEMU is restricted from opening files, and the management applic

Re: [libvirt] [Qemu-devel] [PATCH v4 7/7] osdep: Enable qemu_open to dup pre-opened fd

2012-06-22 Thread Eric Blake
On 06/22/2012 12:36 PM, Corey Bryant wrote: > This patch adds support to qemu_open to dup(fd) a pre-opened file > descriptor if the filename is of the format /dev/fd/X. > > This can be used when QEMU is restricted from opening files, and > the management application opens files on QEMU's behalf. >