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: Move some *at definitions to syscalls.list (bug 14138)


On 30 September 2014 00:16, Joseph S. Myers <joseph@codesourcery.com> wrote:
> Continuing the move of syscall definitions to syscalls.list, where the
> removal of support for old kernel versions has made this possible,
> this patch moves definitions of various *at functions in
> sysdeps/unix/sysv/linux/.
>
> These particular moves are straightforward: there are no #includes of
> these source files, no special architecture-specific versions, no
> special symbol version handling and no aliases.  Each source file can
> be replaced by a single line in sysdeps/unix/sysv/linux/syscalls.list.
>
> Tested for x86_64.
>
> (This patch is independent of my other pending patches for such moves,
> <https://sourceware.org/ml/libc-alpha/2014-09/msg00546.html> and
> <https://sourceware.org/ml/libc-alpha/2014-09/msg00559.html>.)
>
> 2014-09-29  Joseph Myers  <joseph@codesourcery.com>
>
>         [BZ #14138]
>         * sysdeps/unix/sysv/linux/syscalls.list (fchownat): New syscall.
>         (linkat): Likewise.
>         (mkdirat): Likewise.
>         (readlinkat): Likewise.
>         (renameat): Likewise.
>         (symlinkat): Likewise.
>         (unlinkat): Likewise.
>         * sysdeps/unix/sysv/linux/fchownat.c: Remove file.
>         * sysdeps/unix/sysv/linux/linkat.c: Likewise.
>         * sysdeps/unix/sysv/linux/mkdirat.c: Likewise.
>         * sysdeps/unix/sysv/linux/readlinkat.c: Likewise.
>         * sysdeps/unix/sysv/linux/renameat.c: Likewise.
>         * sysdeps/unix/sysv/linux/symlinkat.c: Likewise.
>         * sysdeps/unix/sysv/linux/unlinkat.c: Likewise.

This looks ok to me.

> diff --git a/sysdeps/unix/sysv/linux/fchownat.c b/sysdeps/unix/sysv/linux/fchownat.c
> deleted file mode 100644
> index fae1256..0000000
> --- a/sysdeps/unix/sysv/linux/fchownat.c
> +++ /dev/null
> @@ -1,41 +0,0 @@
> -/* Copyright (C) 2005-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/>.  */
> -
> -#include <errno.h>
> -#include <fcntl.h>
> -#include <stddef.h>
> -#include <stdio.h>
> -#include <string.h>
> -#include <unistd.h>
> -#include <sys/types.h>
> -#include <alloca.h>
> -#include <sysdep.h>
> -
> -
> -/* Consider moving to syscalls.list.  */
> -
> -/* Change the owner and group of FILE.  */
> -int
> -fchownat (fd, file, owner, group, flag)
> -     int fd;
> -     const char *file;
> -     uid_t owner;
> -     gid_t group;
> -     int flag;
> -{
> -  return INLINE_SYSCALL (fchownat, 5, fd, file, owner, group, flag);
> -}
> diff --git a/sysdeps/unix/sysv/linux/linkat.c b/sysdeps/unix/sysv/linux/linkat.c
> deleted file mode 100644
> index e150486..0000000
> --- a/sysdeps/unix/sysv/linux/linkat.c
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/* Copyright (C) 2005-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/>.  */
> -
> -#include <errno.h>
> -#include <fcntl.h>
> -#include <string.h>
> -#include <stdio.h>
> -#include <sysdep.h>
> -#include <unistd.h>
> -
> -
> -/* Consider moving to syscalls.list.  */
> -
> -/* Make a link to FROM named TO but relative paths in TO and FROM are
> -   interpreted relative to FROMFD and TOFD respectively.  */
> -int
> -linkat (fromfd, from, tofd, to, flags)
> -     int fromfd;
> -     const char *from;
> -     int tofd;
> -     const char *to;
> -     int flags;
> -{
> -  return INLINE_SYSCALL (linkat, 5, fromfd, from, tofd, to, flags);
> -}
> diff --git a/sysdeps/unix/sysv/linux/mkdirat.c b/sysdeps/unix/sysv/linux/mkdirat.c
> deleted file mode 100644
> index 9de1058..0000000
> --- a/sysdeps/unix/sysv/linux/mkdirat.c
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -/* Copyright (C) 2005-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/>.  */
> -
> -#include <errno.h>
> -#include <fcntl.h>
> -#include <stddef.h>
> -#include <stdio.h>
> -#include <string.h>
> -#include <sys/stat.h>
> -#include <sysdep-cancel.h>
> -
> -
> -/* Consider moving to syscalls.list.  */
> -
> -/* Create a new directory with permission bits MODE.  But interpret
> -   relative PATH names relative to the directory associated with FD.  */
> -int
> -mkdirat (fd, file, mode)
> -     int fd;
> -     const char *file;
> -     mode_t mode;
> -{
> -  return INLINE_SYSCALL (mkdirat, 3, fd, file, mode);
> -}
> diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c
> deleted file mode 100644
> index 8755fc8..0000000
> --- a/sysdeps/unix/sysv/linux/readlinkat.c
> +++ /dev/null
> @@ -1,41 +0,0 @@
> -/* Copyright (C) 2005-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/>.  */
> -
> -#include <errno.h>
> -#include <fcntl.h>
> -#include <stddef.h>
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <sysdep.h>
> -#include <unistd.h>
> -
> -
> -/* Consider moving to syscalls.list.  */
> -
> -/* Read the contents of the symbolic link PATH relative to FD into no
> -   more than LEN bytes of BUF.  */
> -ssize_t
> -readlinkat (fd, path, buf, len)
> -     int fd;
> -     const char *path;
> -     char *buf;
> -     size_t len;
> -{
> -  return INLINE_SYSCALL (readlinkat, 4, fd, path, buf, len);
> -}
> -libc_hidden_def (readlinkat)
> diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c
> deleted file mode 100644
> index 6f2e148..0000000
> --- a/sysdeps/unix/sysv/linux/renameat.c
> +++ /dev/null
> @@ -1,36 +0,0 @@
> -/* Copyright (C) 2005-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/>.  */
> -
> -#include <errno.h>
> -#include <fcntl.h>
> -#include <stdio.h>
> -#include <string.h>
> -#include <sysdep.h>
> -
> -
> -/* Consider moving to syscalls.list.  */
> -
> -/* Rename the file OLD relative to OLDFD to NEW relative to NEWFD.  */
> -int
> -renameat (oldfd, old, newfd, new)
> -     int oldfd;
> -     const char *old;
> -     int newfd;
> -     const char *new;
> -{
> -  return INLINE_SYSCALL (renameat, 4, oldfd, old, newfd, new);
> -}
> diff --git a/sysdeps/unix/sysv/linux/symlinkat.c b/sysdeps/unix/sysv/linux/symlinkat.c
> deleted file mode 100644
> index 1166525..0000000
> --- a/sysdeps/unix/sysv/linux/symlinkat.c
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -/* Copyright (C) 2005-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/>.  */
> -
> -#include <errno.h>
> -#include <fcntl.h>
> -#include <stddef.h>
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <sysdep.h>
> -#include <unistd.h>
> -
> -
> -/* Consider moving to syscalls.list.  */
> -
> -/* Make a symbolic link to FROM named TO relative to TOFD.  */
> -int
> -symlinkat (from, tofd, to)
> -     const char *from;
> -     int tofd;
> -     const char *to;
> -{
> -  return INLINE_SYSCALL (symlinkat, 3, from, tofd, to);
> -}
> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
> index d639d63..5e3968a 100644
> --- a/sysdeps/unix/sysv/linux/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/syscalls.list
> @@ -84,6 +84,14 @@ wait4                -       wait4           i:iWiP  __wait4         wait4
>
>  chown          -       chown           i:sii   __libc_chown    __chown chown
>
> +fchownat       -       fchownat        i:isiii fchownat
> +linkat         -       linkat          i:isisi linkat
> +mkdirat                -       mkdirat         i:isi   mkdirat
> +readlinkat     -       readlinkat      i:issi  readlinkat
> +renameat       -       renameat        i:isis  renameat
> +symlinkat      -       symlinkat       i:sis   symlinkat
> +unlinkat       -       unlinkat        i:isi   unlinkat
> +
>  setxattr       -       setxattr        i:sspii setxattr
>  lsetxattr      -       lsetxattr       i:sspii lsetxattr
>  fsetxattr      -       fsetxattr       i:ispii fsetxattr
> diff --git a/sysdeps/unix/sysv/linux/unlinkat.c b/sysdeps/unix/sysv/linux/unlinkat.c
> deleted file mode 100644
> index 2d5bd74..0000000
> --- a/sysdeps/unix/sysv/linux/unlinkat.c
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/* unlinkat -- Remove a link by relative name.
> -   Copyright (C) 2005-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/>.  */
> -
> -#include <errno.h>
> -#include <fcntl.h>
> -#include <stddef.h>
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <sysdep.h>
> -#include <unistd.h>
> -
> -
> -/* Consider moving to syscalls.list.  */
> -
> -/* Remove the link named NAME.  */
> -int
> -unlinkat (fd, file, flag)
> -     int fd;
> -     const char *file;
> -     int flag;
> -{
> -  return INLINE_SYSCALL (unlinkat, 3, fd, file, flag);
> -}
>
> --
> Joseph S. Myers
> joseph@codesourcery.com



-- 
Will Newton
Toolchain Working Group, Linaro


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