[igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
Lucas De Marchi
lucas.demarchi at intel.com
Fri Jul 20 19:05:12 UTC 2018
On Fri, Jul 20, 2018 at 08:05:46AM +0100, Chris Wilson wrote:
> Quoting Antonio Argenziano (2018-07-19 23:17:19)
> >
> >
> > On 19/07/18 14:43, De Marchi, Lucas wrote:
> > > On Thu, 2018-07-19 at 14:14 -0700, Antonio Argenziano wrote:
> > >>
> > >> On 19/07/18 13:54, Lucas De Marchi wrote:
> > >>> When libc misses memfd_create(), provide a stub implementation to go
> > >>> through the syscall() route. Syscall numbers are provided for platforms
> > >>> currently supported by i-g-t only.
> > >>>
> > >>> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
> > >>> ---
> > >>> lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
> > >>> meson.build | 3 +++
> > >>> 2 files changed, 40 insertions(+)
> > >>> create mode 100644 lib/stubs/syscall/sys/mman.h
> > >>>
> > >>> diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
> > >>> new file mode 100644
> > >>> index 00000000..36060bda
> > >>> --- /dev/null
> > >>> +++ b/lib/stubs/syscall/sys/mman.h
> > >>> @@ -0,0 +1,37 @@
> > >>> +/* SPDX-License-Identifier: MIT */
> > >>> +
> > >>> +#pragma once
> > >>> +
> > >>> +#include_next <sys/mman.h>
> > >>> +
> > >>> +#if !HAVE_MEMFD_CREATE
> > >>> +#include <errno.h>
> > >>> +#include <sys/syscall.h>
> > >>> +#include <sys/types.h>
> > >>> +#include <unistd.h>
> > >>> +
> > >>> +#ifndef __NR_memfd_create
> > >>> +#if defined __x86_64__
> > >>> +#define __NR_memfd_create 319
> > >>> +#elif defined __i386__
> > >>> +#define __NR_memfd_create 356
> > >>> +#elif defined __arm__
> > >>> +#define __NR_memfd_create 385
> > >>> +#else
> > >>> +#warning "__NR_memfd_create unknown for your architecture"
> > >>> +#endif
> > >>> +#endif
> > >>> +
> > >>> +static inline int missing_memfd_create(const char *name, unsigned int
> > >>> flags)
> > >>> +{
> > >>> +#ifdef __NR_memfd_create
> > >>> + return syscall(__NR_memfd_create, name, flags);
> > >>> +#else
> > >>> + errno = ENOSYS;
> > >>> + return -1;
> > >>> +#endif
> > >>> +}
> > >>> +
> > >>> +#define memfd_create missing_memfd_create
> > >>> +
> > >>> +#endif
> > >>> diff --git a/meson.build b/meson.build
> > >>> index c24a3cf4..188301ca 100644
> > >>> --- a/meson.build
> > >>> +++ b/meson.build
> > >>
> > >> No love for make?
> > >
> > > no, afaik it's dead, isn't it? Worse than supporting an old build system is
> > > having to support it in addition to the new one.
>
> Ffs, I have platforms where meson is no go. meson itself is not yet
> stable, why force a broken build system on us until it has at least had
> the decency to declare itself stable and not require trashing its build
> directory every other week.
I come from projects that tried to support 2 (one of them) and 7
(the other) build systems at the same time. It's a pain and so
much a waste of time IMO. I think there must be a period of transition
and then move on or move back.
The discussion about "forcing" IMO should happen or when a) the new one
enters the tree or b) it becomes the default. Here I'm not forcing
anything, I'm just following what was established in the project.
I can tweak your words to be "I have platforms where meson is not
working and these patches fix them". Sounds better than
your "force a broken build system" rant ;)
Lucas De Marchi
> -Chris
More information about the igt-dev
mailing list