Re: [PATCH v2 RFC liburing 4/5] Add no libc build support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
Jens Axboe




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux