Move some setrlimit definitions to syscalls.list (bug 14138)
diff mbox

Message ID Pine.LNX.4.64.1409192209510.28609@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Sept. 19, 2014, 10:10 p.m. UTC
Bug 14138 is followup cleanup after removal of support for old Linux
kernel versions: moving syscalls to syscalls.list where the only
reason for using C definitions was kernel version conditionals that
are no longer present.

This patch deals with the case of setrlimit
(sysdeps/unix/sysv/linux/i386/setrlimit.c, included by various other
architectures).  Where needed (where there is also a compat symbol for
setrlimit@GLIBC_2.0), new syscalls.list entries are added.  Where not
needed (where there is no such compat symbol and the minimum symbol
version for libc is 2.2 or later), no such entries are added as that
in sysdeps/unix/syscalls.list will suffice.  Thus arm and sh need no
such entries, while m68k and powerpc need entries only in a
subdirectory syscalls.list file rather than for all configurations
that previously used setrlimit.c.

(setrlimit@@GLIBC_2.2 and setrlimit@GLIBC_2.0 are now semantically
identical - the new symbol version was about a change of types from
signed to unsigned and the former compatibility code for dealing with
large unsigned arguments on old kernels is no longer needed or
present, having been removed with support for pre-2.4 kernels.
However, making the two versions into aliases doesn't work at present:
the case of having both default and non-default symbol versions on the
same syscalls.list line results in a compat_symbol call in code built
for static libc, which doesn't compile.  I don't suppose it would be
hard to generate SHARED conditionals from make-syscalls.sh to fix
this, but in any case this patch doesn't make things any worse, as the
functions weren't aliases before the patch either.)

Tested for x86, and ran ABI tests for ARM as an example of an
architecture where the setrlimit.c file was just removed without
adding syscalls.list entries.

2014-09-19  Joseph Myers  <joseph@codesourcery.com>

	[BZ #14138]
	* sysdeps/unix/sysv/linux/arm/setrlimit.c: Remove file.
	* sysdeps/unix/sysv/linux/i386/setrlimit.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/setrlimit.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/setrlimit.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/setrlimit.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/syscalls.list (setrlimit): Add
	syscall entry for GLIBC_2.2 symbol version.
	* sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list (setrlimit):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
	(setrlimit): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list (setrlimit):
	Likewise.

Comments

Adhemerval Zanella Sept. 23, 2014, 12:56 p.m. UTC | #1
This looks ok, thanks. I also checked on powerpc32 with no regressions.

Do you have a summary of the bugzilla number related to moving syscalls
to syscalls.list?

On 19-09-2014 19:10, Joseph S. Myers wrote:

> Bug 14138 is followup cleanup after removal of support for old Linux
> kernel versions: moving syscalls to syscalls.list where the only
> reason for using C definitions was kernel version conditionals that
> are no longer present.
>
> This patch deals with the case of setrlimit
> (sysdeps/unix/sysv/linux/i386/setrlimit.c, included by various other
> architectures).  Where needed (where there is also a compat symbol for
> setrlimit@GLIBC_2.0), new syscalls.list entries are added.  Where not
> needed (where there is no such compat symbol and the minimum symbol
> version for libc is 2.2 or later), no such entries are added as that
> in sysdeps/unix/syscalls.list will suffice.  Thus arm and sh need no
> such entries, while m68k and powerpc need entries only in a
> subdirectory syscalls.list file rather than for all configurations
> that previously used setrlimit.c.
>
> (setrlimit@@GLIBC_2.2 and setrlimit@GLIBC_2.0 are now semantically
> identical - the new symbol version was about a change of types from
> signed to unsigned and the former compatibility code for dealing with
> large unsigned arguments on old kernels is no longer needed or
> present, having been removed with support for pre-2.4 kernels.
> However, making the two versions into aliases doesn't work at present:
> the case of having both default and non-default symbol versions on the
> same syscalls.list line results in a compat_symbol call in code built
> for static libc, which doesn't compile.  I don't suppose it would be
> hard to generate SHARED conditionals from make-syscalls.sh to fix
> this, but in any case this patch doesn't make things any worse, as the
> functions weren't aliases before the patch either.)
>
> Tested for x86, and ran ABI tests for ARM as an example of an
> architecture where the setrlimit.c file was just removed without
> adding syscalls.list entries.
>
> 2014-09-19  Joseph Myers  <joseph@codesourcery.com>
>
> 	[BZ #14138]
> 	* sysdeps/unix/sysv/linux/arm/setrlimit.c: Remove file.
> 	* sysdeps/unix/sysv/linux/i386/setrlimit.c: Likewise.
> 	* sysdeps/unix/sysv/linux/m68k/setrlimit.c: Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/setrlimit.c: Likewise.
> 	* sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c: Likewise.
> 	* sysdeps/unix/sysv/linux/sh/setrlimit.c: Likewise.
> 	* sysdeps/unix/sysv/linux/i386/syscalls.list (setrlimit): Add
> 	syscall entry for GLIBC_2.2 symbol version.
> 	* sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list (setrlimit):
> 	Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
> 	(setrlimit): Likewise.
> 	* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list (setrlimit):
> 	Likewise.
>
> diff --git a/sysdeps/unix/sysv/linux/arm/setrlimit.c b/sysdeps/unix/sysv/linux/arm/setrlimit.c
> deleted file mode 100644
> index bfaef74..0000000
> --- a/sysdeps/unix/sysv/linux/arm/setrlimit.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
> diff --git a/sysdeps/unix/sysv/linux/i386/setrlimit.c b/sysdeps/unix/sysv/linux/i386/setrlimit.c
> deleted file mode 100644
> index 2868d90..0000000
> --- a/sysdeps/unix/sysv/linux/i386/setrlimit.c
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -/* Copyright (C) 1999-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 <sys/param.h>
> -#include <sys/resource.h>
> -
> -#include <sysdep.h>
> -#include <sys/syscall.h>
> -#include <shlib-compat.h>
> -
> -extern int __new_setrlimit (enum __rlimit_resource resource,
> -			    const struct rlimit *rlimits);
> -
> -/* Consider moving to syscalls.list.  */
> -
> -int
> -__new_setrlimit (enum __rlimit_resource resource, const struct rlimit *rlimits)
> -{
> -  return INLINE_SYSCALL (setrlimit, 2, resource, rlimits);
> -}
> -
> -weak_alias (__new_setrlimit, __setrlimit);
> -versioned_symbol (libc, __new_setrlimit, setrlimit, GLIBC_2_2);
> diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
> index 149d432..8d94828 100644
> --- a/sysdeps/unix/sysv/linux/i386/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
> @@ -5,6 +5,7 @@ vm86old		EXTRA	vm86old		i:p	__vm86old	vm86@GLIBC_2.0
>  vm86		-	vm86		i:ip	__vm86		vm86@@GLIBC_2.3.4
>  oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
>  oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
> +setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit@@GLIBC_2.2
>  waitpid		-	waitpid		Ci:ipi	__waitpid	waitpid	__libc_waitpid
>
>  prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list b/sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list
> index 913f051..6f10536 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list
> @@ -2,3 +2,4 @@
>
>  oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
>  oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
> +setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit@@GLIBC_2.2
> diff --git a/sysdeps/unix/sysv/linux/m68k/setrlimit.c b/sysdeps/unix/sysv/linux/m68k/setrlimit.c
> deleted file mode 100644
> index bfaef74..0000000
> --- a/sysdeps/unix/sysv/linux/m68k/setrlimit.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
> index aaa3557..fb6535a 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
> @@ -3,6 +3,7 @@
>  # System calls with wrappers.
>  oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
>  oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
> +setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit@@GLIBC_2.2
>
>  # Due to 64bit alignment there is a dummy second parameter
>  readahead	-	readahead	i:iiiii	__readahead	readahead
> diff --git a/sysdeps/unix/sysv/linux/powerpc/setrlimit.c b/sysdeps/unix/sysv/linux/powerpc/setrlimit.c
> deleted file mode 100644
> index bfaef74..0000000
> --- a/sysdeps/unix/sysv/linux/powerpc/setrlimit.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c b/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c
> deleted file mode 100644
> index bfaef74..0000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
> index ce9f210..523bd2c 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
> @@ -2,6 +2,7 @@
>
>  oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
>  oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
> +setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit@@GLIBC_2.2
>
>  prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
>  fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
> diff --git a/sysdeps/unix/sysv/linux/sh/setrlimit.c b/sysdeps/unix/sysv/linux/sh/setrlimit.c
> deleted file mode 100644
> index bfaef74..0000000
> --- a/sysdeps/unix/sysv/linux/sh/setrlimit.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
>
Joseph Myers Sept. 23, 2014, 1:08 p.m. UTC | #2
On Tue, 23 Sep 2014, Adhemerval Zanella wrote:

> This looks ok, thanks. I also checked on powerpc32 with no regressions.
> 
> Do you have a summary of the bugzilla number related to moving syscalls
> to syscalls.list?

Check for the magic comment.  Work out whether the C function's semantics 
do in fact correspond to those of a syscalls.list entry (and if so, what 
variant - some cases may be 'C' (cancellable), 'E' (no errno - if 
INTERNAL_SYSCALL rather than INLINE_SYSCALL is used) or 'V').  If so, work 
out what syscalls.list entries are needed as a replacement, allowing for 
other architectures that may #include the C file, and for existing 
syscalls.list entries that may suffice in some cases.  If the semantics 
don't correspond to a syscalls.list entry, fix the comment to explain why 
syscalls.list isn't being used.

Patch
diff mbox

diff --git a/sysdeps/unix/sysv/linux/arm/setrlimit.c b/sysdeps/unix/sysv/linux/arm/setrlimit.c
deleted file mode 100644
index bfaef74..0000000
--- a/sysdeps/unix/sysv/linux/arm/setrlimit.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/i386/setrlimit.c b/sysdeps/unix/sysv/linux/i386/setrlimit.c
deleted file mode 100644
index 2868d90..0000000
--- a/sysdeps/unix/sysv/linux/i386/setrlimit.c
+++ /dev/null
@@ -1,38 +0,0 @@ 
-/* Copyright (C) 1999-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 <sys/param.h>
-#include <sys/resource.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <shlib-compat.h>
-
-extern int __new_setrlimit (enum __rlimit_resource resource,
-			    const struct rlimit *rlimits);
-
-/* Consider moving to syscalls.list.  */
-
-int
-__new_setrlimit (enum __rlimit_resource resource, const struct rlimit *rlimits)
-{
-  return INLINE_SYSCALL (setrlimit, 2, resource, rlimits);
-}
-
-weak_alias (__new_setrlimit, __setrlimit);
-versioned_symbol (libc, __new_setrlimit, setrlimit, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index 149d432..8d94828 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -5,6 +5,7 @@  vm86old		EXTRA	vm86old		i:p	__vm86old	vm86@GLIBC_2.0
 vm86		-	vm86		i:ip	__vm86		vm86@@GLIBC_2.3.4
 oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
 oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
+setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit@@GLIBC_2.2
 waitpid		-	waitpid		Ci:ipi	__waitpid	waitpid	__libc_waitpid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list b/sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list
index 913f051..6f10536 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list
@@ -2,3 +2,4 @@ 
 
 oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
 oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
+setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit@@GLIBC_2.2
diff --git a/sysdeps/unix/sysv/linux/m68k/setrlimit.c b/sysdeps/unix/sysv/linux/m68k/setrlimit.c
deleted file mode 100644
index bfaef74..0000000
--- a/sysdeps/unix/sysv/linux/m68k/setrlimit.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
index aaa3557..fb6535a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
@@ -3,6 +3,7 @@ 
 # System calls with wrappers.
 oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
 oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
+setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit@@GLIBC_2.2
 
 # Due to 64bit alignment there is a dummy second parameter
 readahead	-	readahead	i:iiiii	__readahead	readahead
diff --git a/sysdeps/unix/sysv/linux/powerpc/setrlimit.c b/sysdeps/unix/sysv/linux/powerpc/setrlimit.c
deleted file mode 100644
index bfaef74..0000000
--- a/sysdeps/unix/sysv/linux/powerpc/setrlimit.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c b/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c
deleted file mode 100644
index bfaef74..0000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
index ce9f210..523bd2c 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
@@ -2,6 +2,7 @@ 
 
 oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
 oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
+setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit@@GLIBC_2.2
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/sh/setrlimit.c b/sysdeps/unix/sysv/linux/sh/setrlimit.c
deleted file mode 100644
index bfaef74..0000000
--- a/sysdeps/unix/sysv/linux/sh/setrlimit.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>