This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH RFC] Add support for linux memfd_create syscall


ping?

On Fri, Oct 17, 2014 at 11:21 AM, David Herrmann <dh.herrmann@gmail.com> wrote:
> The memfd_create() syscall was released with linux-3.17. It's a linux-only
> syscall and returns a shmem file-descriptor backed by anonymous memory
> in a kernel-internal shmem mount.
> ---
>  ChangeLog                             |  7 +++++++
>  NEWS                                  |  2 ++
>  sysdeps/unix/sysv/linux/Makefile      |  2 +-
>  sysdeps/unix/sysv/linux/Versions      |  3 +++
>  sysdeps/unix/sysv/linux/sys/memfd.h   | 32 ++++++++++++++++++++++++++++++++
>  sysdeps/unix/sysv/linux/syscalls.list |  2 ++
>  6 files changed, 47 insertions(+), 1 deletion(-)
>  create mode 100644 sysdeps/unix/sysv/linux/sys/memfd.h
>
> diff --git a/ChangeLog b/ChangeLog
> index 6c6d9d8..e11c875 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,10 @@
> +2014-10-17  David Herrmann  <dh.herrmann@gmail.com>
> +
> +       * sysdeps/unix/sysv/linux/Makefile: add sys/memfd.h
> +       * sysdeps/unix/sysv/linux/Versions: export memfd_create
> +       * sysdeps/unix/sysv/linux/syscalls.list: add entry for memfd_create
> +       * sysdeps/unix/sysv/linux/sys/memfd.h: new file
> +
>  2014-10-16  Roland McGrath  <roland@hack.frob.com>
>
>         * sysdeps/arm/soft-fp/sfp-machine.h: Filed moved ...
> diff --git a/NEWS b/NEWS
> index 987f306..b6af068 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -7,6 +7,8 @@ using `glibc' in the "product" field.
>
>  Version 2.21
>
> +* New Linux interfaces: memfd_create
> +
>  * The following bugs are resolved with this release:
>
>    6652, 12926, 14171, 17266, 17363, 17370, 17371, 17411, 17460.
> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index 9ad6d22..850ef9b 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -43,7 +43,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
>                   sys/timerfd.h sys/fanotify.h bits/eventfd.h bits/inotify.h \
>                   bits/signalfd.h bits/timerfd.h bits/epoll.h \
>                   bits/socket_type.h bits/syscall.h bits/sysctl.h \
> -                 bits/mman-linux.h
> +                 bits/mman-linux.h sys/memfd.h
>
>  tests += tst-clone tst-fanotify
>
> diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
> index 16bb281..15c04b5 100644
> --- a/sysdeps/unix/sysv/linux/Versions
> +++ b/sysdeps/unix/sysv/linux/Versions
> @@ -166,6 +166,9 @@ libc {
>    GLIBC_2.15 {
>      process_vm_readv; process_vm_writev;
>    }
> +  GLIBC_2.21 {
> +    memfd_create;
> +  }
>    GLIBC_PRIVATE {
>      # functions used in other libraries
>      __syscall_rt_sigqueueinfo;
> diff --git a/sysdeps/unix/sysv/linux/sys/memfd.h b/sysdeps/unix/sysv/linux/sys/memfd.h
> new file mode 100644
> index 0000000..3f10df4
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sys/memfd.h
> @@ -0,0 +1,32 @@
> +/* Copyright (C) 2010-2014 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef        _SYS_MEMFD_H
> +#define        _SYS_MEMFD_H    1
> +
> +#include <stdint.h>
> +#include <linux/memfd.h>
> +
> +__BEGIN_DECLS
> +
> +/* Create and initialize an anonymous memory object.  */
> +extern int memfd_create (const char *__name, unsigned int __flags)
> +  __THROW;
> +
> +__END_DECLS
> +
> +#endif /* sys/memfd.h */
> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
> index a0b8de8..f881f37 100644
> --- a/sysdeps/unix/sysv/linux/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/syscalls.list
> @@ -123,3 +123,5 @@ setns               EXTRA   setns           i:ii    setns
>
>  process_vm_readv EXTRA process_vm_readv i:ipipii process_vm_readv
>  process_vm_writev EXTRA        process_vm_writev i:ipipii process_vm_writev
> +
> +memfd_create   EXTRA   memfd_create    i:si    memfd_create
> --
> 2.1.2
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]