From: Pavel Begunkov <[email protected]>
To: Victor Stewart <[email protected]>
Cc: io-uring <[email protected]>
Subject: Re: [Bug] io_uring_register_files_update broken
Date: Fri, 2 Jul 2021 01:20:58 +0100 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAM1kxwgEZ1bPMGgJixqQPVm4AP84xwYU8zrPOohvGp9nCQPpZg@mail.gmail.com>
On 7/1/21 4:46 PM, Victor Stewart wrote:
> On Thu, Jul 1, 2021 at 3:51 PM Pavel Begunkov <[email protected]> wrote:
[...]
>>> sockfd, fds, 1);
>>
>> s/fds/&fds[sockfd]/
>>
>> Does it help? io_uring_register_files_update() doesn't
>> apply offset parameter to the array, it's used only as
>> an internal index.
>
> i see yes, it works it like this!
>
> io_uring_register_files_update(&ring, fd, &(socketfds[fd]), 1);
> io_uring_register_files_update(&ring, fd, &(socketfds[fd] = -1), 1);
>
> and this behavior is clear upon a closer reading of...
> https://github.com/axboe/liburing/blob/11f6d56302c177a96d7eb1df86995939a4feb736/test/file-register.c#L80
>
> i guess it's sometimes ambiguous whether int* is requesting an array
> or an actual pointer to a single int.
It's an array, just element 0 is registered as a registered
file with index @off, element 1 as a reg-file with index
@(off+1) and so on.
> all good now.
>
>>
>>> +
>>> + if (result != 1)
>>> + {
>>> + fprintf(stderr, "file update failed\n");
>>> + goto err;
>>> + }
>>> }
>>>
>>> + use_fd = sockfd;
>>> +
>>> sqe = io_uring_get_sqe(ring);
>>> io_uring_prep_recv(sqe, use_fd, iov->iov_base, iov->iov_len, 0);
>>> if (registerfiles)
>>>
>>
>> --
>> Pavel Begunkov
--
Pavel Begunkov
prev parent reply other threads:[~2021-07-02 0:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-30 21:14 [Bug] io_uring_register_files_update broken Victor Stewart
2021-06-30 21:27 ` Pavel Begunkov
2021-07-01 14:01 ` Daniele Salvatore Albano
2021-07-01 14:31 ` Pavel Begunkov
2021-07-01 14:50 ` Pavel Begunkov
2021-07-01 15:46 ` Victor Stewart
2021-07-02 0:20 ` Pavel Begunkov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox