On Thu, Aug 18, 2022 at 04:36:13PM +0100, Richard W.M. Jones wrote:
> This is what I pushed - how does it look? I ignored the cases we
> cannot deal with, except O_WRONLY where I emit a debug message but
> continue:
>
> https://gitlab.com/nbdkit/nbdkit/-/blob/master/plugins/file/file.c#L572
>
>
On Thu, Aug 18, 2022 at 10:28:17AM -0500, Eric Blake wrote:
> On Wed, Aug 17, 2022 at 10:56:58PM +0100, Richard W.M. Jones wrote:
> > On Wed, Aug 17, 2022 at 10:37:00PM +0100, Richard W.M. Jones wrote:
> > > Is that actually possible? “fcntl (fd, F_GETFL) & O_WRONLY”
> > > should do it?
> >
> >
On Wed, Aug 17, 2022 at 10:56:58PM +0100, Richard W.M. Jones wrote:
> On Wed, Aug 17, 2022 at 10:37:00PM +0100, Richard W.M. Jones wrote:
> > Is that actually possible? “fcntl (fd, F_GETFL) & O_WRONLY”
> > should do it?
>
> So the answer is no as it's a kind of tri-state.
More like 5-state (by
On 08/17/22 23:56, Richard W.M. Jones wrote:
> On Wed, Aug 17, 2022 at 10:37:00PM +0100, Richard W.M. Jones wrote:
>> Is that actually possible? “fcntl (fd, F_GETFL) & O_WRONLY”
>> should do it?
>
> So the answer is no as it's a kind of tri-state.
>
> I think this should work (untested)?
>
>
On Wed, Aug 17, 2022 at 10:37:00PM +0100, Richard W.M. Jones wrote:
> Is that actually possible? “fcntl (fd, F_GETFL) & O_WRONLY”
> should do it?
So the answer is no as it's a kind of tri-state.
I think this should work (untested)?
r = fcntl (fd, F_GETFL);
if (r == -1) ...
r &=
On Wed, Aug 17, 2022 at 03:57:24PM -0500, Eric Blake wrote:
> On Wed, Aug 17, 2022 at 04:38:11PM +0100, Richard W.M. Jones wrote:
> > This allows you to pass in a file descriptor to the plugin, eg:
> >
> > $ exec 6<>/var/tmp/fedora-36.img
> > $ ./nbdkit file fd=6 --run 'nbdinfo $uri'
> >
> >
On Wed, Aug 17, 2022 at 04:38:11PM +0100, Richard W.M. Jones wrote:
> This allows you to pass in a file descriptor to the plugin, eg:
>
> $ exec 6<>/var/tmp/fedora-36.img
> $ ./nbdkit file fd=6 --run 'nbdinfo $uri'
>
> Note this was previously possible on most platforms using /dev/fd/,
> but
This allows you to pass in a file descriptor to the plugin, eg:
$ exec 6<>/var/tmp/fedora-36.img
$ ./nbdkit file fd=6 --run 'nbdinfo $uri'
Note this was previously possible on most platforms using /dev/fd/,
but not all platforms that have file descriptors support this
(although it is POSIX)