Re: [PATCH 1/1] tools/nolibc: Add workarounds for centos-7
From: Zhangjin Wu
Date: Sat Oct 07 2023 - 10:07:48 EST
Hi, Thomas
> On 2023-09-27 15:06:03+0200, Rodrigo Campos wrote:
> ...
> > For now we are work-arounding it by doing basically the same thing I'm doing
> > here:
> > https://github.com/opencontainers/runc/blob/96a61d3bf0dcc26343bfafe5112934d73d280dd3/libcontainer/dmz/xstat.h
> >
> > We then include this file before nolibc.h, and then the type works as fine:
> > https://github.com/opencontainers/runc/blob/96a61d3bf0dcc26343bfafe5112934d73d280dd3/libcontainer/dmz/_dmz.c
> >
> > Would it be acceptable for nolibc if I just define what we use:
> > * struct statx
> > * struct statx_timestamp (used inside struct statx)
> > * STATX_BASIC_STATS (or STATX_* constants too, as you prefer)
>
> Without __NR_statx this would still only result in dead code.
>
> *IF* we want to fix/work around this in nolibc it would be more like
>
> #ifdef __NR_statx
>
> /* whatever was done before */
>
> #else
>
> int stat(const char *path, struct stat *buf)
> {
> return __sysret(-ENOSYS);
> }
>
> #endif
>
> Or we drop the #else completely to make it obvious for applications that
> stat() will just not work.
This may worth a patch, sorry for my fault ;-(
And to avoid breaking the older kernel users or especially for some
older kernel books readers, and since this also has introduced some
inconvenience to Willy, perhaps it is valuable to restore original
'sys_stat' support, I will look into how or simply revert the commit but
need to add a new one for powerpc, I will learn how to avoid defining
the extra structure for the not required architectures, the
__ARCH_WANT_SYS_STAT macro may help. I'm also working on cleaning up the
old_select(), old_mmap() and sys_fork()/sys_clone() selection support,
they may be put in a series.
Willy, what about your suggestion?
Thanks,
Zhangjin Wu