io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ammar Faizi <ammar.faizi@students.amikom.ac.id>
To: Jens Axboe <axboe@kernel.dk>,
	Pavel Begunkov <asml.silence@gmail.com>,
	io-uring Mailing List <io-uring@vger.kernel.org>
Cc: Bedirhan KURT <windowz414@gnuweeb.org>,
	Louvian Lyndal <louvianlyndal@gmail.com>
Subject: Re: [PATCH v2 RFC liburing 4/5] Add no libc build support
Date: Thu,  7 Oct 2021 20:01:01 +0700	[thread overview]
Message-ID: <20211007130101.1339216-1-ammar.faizi@students.amikom.ac.id> (raw)
In-Reply-To: <3ca99c4b-1aa6-b10e-340c-f2d860c39b57@kernel.dk>

On Thu, Oct 7, 2021 at 7:27 PM Jens Axboe <axboe@kernel.dk> wrote:
>
> On 10/7/21 12:31 AM, Ammar Faizi wrote:
> > Create `src/nolibc.c` to substitute libc functions like `memset()`,
> > `malloc()` and `free()`. Only build this file when we build liburing
> > without libc.
> >
> > Wrap libc functions with `static inline` functions, defined in
> > `src/lib.h`, currently we have:
> >  1) `get_page_size`
> >  2) `uring_memset`
> >  3) `uring_malloc`
> >  4) `uring_free`
> >
> > Add conditional preprocessor in `src/{syscall,lib}.h` to use arch
> > dependent and nolibc functions when we build liburing without libc.
> >
> > Extra notes for tests:
> >  1) Functions in `src/syscall.c` require libc to work.
> >  2) Tests require functions in `src/syscall.c`.
> >
> > So we build `src/syscall.c` manually from test's Makefile.
> >
> > The Makefile in `src/` dir still builds `src/syscall.c` when we
> > compile liburing with libc.
>
> Why are we jumping through hoops on the naming? You add a uring_memset()
> that the lib is supposed to use, then that calls memset() with libc or
> __uring_memset() if we're building without libc. Why not just have the
> nolibc build provide memset() and avoids this churn? Not just in terms
> of the immediate patch, that matters less. But longer term where
> inevitably a memset() or similar will be added to the existing code
> base.
>

Ah, good point. The syscall wrappers gave me this bad suggestion. I know
we have a rationale to wrap syscalls because we need to eliminate `errno`
being used in C files. But we don't actually need extra wrappers for
`memset()`, `malloc()` and `free()`.

I agree that we can just provide `memset()`, `malloc()` and `free()` for
the nolibc build without having extra wrappers like that.

I will address this and send the rest as a PATCHSET.

-- 
Ammar Faizi

  reply	other threads:[~2021-10-07 13:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 14:49 [PATCHSET v1 RFC liburing 0/6] Add no libc support for x86-64 arch Ammar Faizi
2021-10-06 14:49 ` [PATCH v1 RFC liburing 1/6] configure: Add LIBURING_NOLIBC variable Ammar Faizi
2021-10-06 14:49 ` [PATCH v1 RFC liburing 2/6] Add no libc support Ammar Faizi
2021-10-06 14:49 ` [PATCH v1 RFC liburing 3/6] Add x86-64 no libc build support Ammar Faizi
2021-10-06 14:49 ` [PATCH v1 RFC liburing 4/6] test/cq-size: Don't use `errno` to check liburing's functions Ammar Faizi
2021-10-06 14:49 ` [PATCH v1 RFC liburing 5/6] test/{iopoll,read-write}: Use `io_uring_free_probe()` instead of `free()` Ammar Faizi
2021-10-06 14:49 ` [PATCH v1 RFC liburing 6/6] src/{queue,register,setup}: Clean up unused includes Ammar Faizi
2021-10-06 18:47 ` [PATCHSET v1 RFC liburing 0/6] Add no libc support for x86-64 arch Jens Axboe
2021-10-06 22:20   ` Ammar Faizi
2021-10-06 22:23     ` Jens Axboe
2021-10-07  6:31       ` [PATCHSET v2 RFC liburing 0/5] " Ammar Faizi
2021-10-07  6:31         ` [PATCH v2 RFC liburing 1/5] test/{iopoll,read-write}: Use `io_uring_free_probe()` instead of `free()` Ammar Faizi
2021-10-07 12:25           ` Jens Axboe
2021-10-07  6:31         ` [PATCH v2 RFC liburing 2/5] test/cq-size: Don't use `errno` to check liburing's functions Ammar Faizi
2021-10-07 12:25           ` Jens Axboe
2021-10-07  6:31         ` [PATCH v2 RFC liburing 3/5] Add arch dependent directory and files Ammar Faizi
2021-10-07  6:31         ` [PATCH v2 RFC liburing 4/5] Add no libc build support Ammar Faizi
2021-10-07 12:27           ` Jens Axboe
2021-10-07 13:01             ` Ammar Faizi [this message]
2021-10-07  6:31         ` [PATCH v2 RFC liburing 5/5] Add LIBURING_NOLIBC variable and edit src/Makefile Ammar Faizi
2021-10-07 15:02         ` [PATCHSET liburing 0/4] Add no libc support for x86-64 arch Ammar Faizi
2021-10-07 15:02           ` [PATCH liburing 1/4] test/thread-exit: Fix use after free bug Ammar Faizi
2021-10-07 15:02           ` [PATCH liburing 2/4] Add arch dependent directory and files Ammar Faizi
2021-10-07 15:02           ` [PATCH liburing 3/4] Add no libc build support Ammar Faizi
2021-10-07 15:02           ` [PATCH liburing 4/4] Add LIBURING_NOLIBC variable and edit src/Makefile 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=20211007130101.1339216-1-ammar.faizi@students.amikom.ac.id \
    --to=ammar.faizi@students.amikom.ac.id \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=louvianlyndal@gmail.com \
    --cc=windowz414@gnuweeb.org \
    /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;
as well as URLs for NNTP newsgroup(s).