From: Ammar Faizi <[email protected]>
To: Jens Axboe <[email protected]>, Pavel Begunkov <[email protected]>
Cc: io-uring Mailing List <[email protected]>,
Bedirhan KURT <[email protected]>,
Louvian Lyndal <[email protected]>
Subject: Re: [PATCH v4 RFC liburing 3/3] Wrap all syscalls in a kernel style return value
Date: Sun, 3 Oct 2021 22:13:38 +0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On Sun, Oct 3, 2021 at 8:19 PM Jens Axboe <[email protected]> wrote:
>> diff --git a/src/register.c b/src/register.c
>> index cb09dea..fec144d 100644
>> --- a/src/register.c
>> +++ b/src/register.c
>> @@ -6,7 +6,6 @@
>> #include <sys/mman.h>
>> #include <sys/resource.h>
>> #include <unistd.h>
>> -#include <errno.h>
>> #include <string.h>
>>
>> #include "liburing/compat.h"
>> @@ -104,13 +103,16 @@ int io_uring_register_files_update(struct io_uring *ring, unsigned off,
>>
>> static int increase_rlimit_nofile(unsigned nr)
>> {
>> + int ret;
>> struct rlimit rlim;
>>
>> - if (getrlimit(RLIMIT_NOFILE, &rlim) < 0)
>> - return -errno;
>> + ret = uring_getrlimit(RLIMIT_NOFILE, &rlim);
>> + if (ret < 0)
>> + return ret;
>> +
>> if (rlim.rlim_cur < nr) {
>> rlim.rlim_cur += nr;
>> - setrlimit(RLIMIT_NOFILE, &rlim);
>> + return uring_setrlimit(RLIMIT_NOFILE, &rlim);
>> }
>
>This isn't a functionally equivalent transformation, and it's
>purposefully not returning failure to increase. It may still succeed if
>we fail here, relying on failure later for the actual operation that
>needs an increase in files.
>
>> diff --git a/src/syscall.h b/src/syscall.h
>> index f7f63aa..3e964ed 100644
>> --- a/src/syscall.h
>> +++ b/src/syscall.h
>> @@ -4,11 +4,15 @@
>>
>> #include <errno.h>
>> #include <signal.h>
>> +#include <stdint.h>
>> #include <unistd.h>
>> +#include <stdbool.h>
>> #include <sys/mman.h>
>> #include <sys/syscall.h>
>> #include <sys/resource.h>
>>
>> +#include <liburing.h>
>> +
>> #ifdef __alpha__
>> /*
>> * alpha and mips are exception, other architectures have
>> @@ -60,6 +64,21 @@ int __sys_io_uring_register(int fd, unsigned int opcode, const void *arg,
>> unsigned int nr_args);
>>
>>
>> +static inline void *ERR_PTR(intptr_t n)
>> +{
>> + return (void *) n;
>> +}
>> +
>> +
>
>Extra newline here.
>
>Apart from those two, starting to look pretty reasonable.
>
>--
>Jens Axboe
>
Thanks for the review, I will address those two and send the v5 of
this series.
--
Ammar Faizi
next prev parent reply other threads:[~2021-10-03 15:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-03 10:17 [PATCHSET v4 RFC liburing 0/4] Implement the kernel style return value Ammar Faizi
2021-10-03 10:17 ` [PATCH v4 RFC liburing 1/3] src/syscall: Wrap `errno` for `__sys_io_uring_{register,setup,enter{2,}}` Ammar Faizi
2021-10-03 10:17 ` [PATCH v4 RFC liburing 2/3] src/{queue,register,setup}: Don't use `__sys_io_uring*` Ammar Faizi
2021-10-03 10:17 ` [PATCH v4 RFC liburing 3/3] Wrap all syscalls in a kernel style return value Ammar Faizi
2021-10-03 13:17 ` Jens Axboe
2021-10-03 15:13 ` Ammar Faizi [this message]
2021-10-03 10:43 ` [PATCHSET v4 RFC liburing 0/4] Implement the " Ammar Faizi
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 \
--in-reply-to=20211003151338.348626-1-ammar.faizi@students.amikom.ac.id \
[email protected] \
[email protected] \
[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