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 v2] Consolidate Linux setrlimit and getrlimit implementation


On Okt 27 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> 	Adhemerval Zanella  <adhemerval.zanella@linaro.org>
> 	Yury Norov  <ynorov@caviumnetworks.com>
>
> 	* bits/typesizes.h (__RLIM_T_MATCHES_RLIM64_T): define.
> 	* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
> 	(__RLIM_T_MATCHES_RLIM64_T): Likewise.
> 	* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
> 	(__RLIM_T_MATCHES_RLIM64_T): Likewise.
> 	* sysdeps/unix/sysv/linux/s390/bits/typesizes.h [__s390x__]
> 	(__RLIM_T_MATCHES_RLIM64_T): Likewise.
> 	* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
> 	[__arch64__ || __sparcv9] (__RLIM_T_MATCHES_RLIM64_T): Likewise.
> 	* sysdeps/unix/sysv/linux/x86/bits/typesizes.h [__86_64__]
> 	(__RLIM_T_MATCHES_RLIM64_T): Likewise.
> 	* sysdeps/unix/sysv/linux/arm/Makefile [$(subdir) = resource]
> 	(sysdep_routines): Remove oldgetrlimit64.
> 	* sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = resource]
> 	(sysdep_routines): Likewise.
> 	* sysdeps/unix/sysv/linux/m68k/Makefile [$(subdir) = resource]
> 	(sysdep_routines): Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile
> 	[$(subdir) = resource] (sysdep_routines): Likewise.
> 	* sysdeps/unix/sysv/linux/s390/s390-32/Makefile
> 	[$(subdir) = resource] (sysdep_routines): Likewise.
> 	* sysdeps/unix/sysv/linux/arm/getrlimit64.c: Remove file.
> 	* sysdeps/unix/sysv/linux/arm/oldgetrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/arm/oldgetrlimit.c: Likewise.
> 	* sysdeps/unix/sysv/linux/arm/oldsetrlimit.c: Likewise.
> 	* sysdeps/unix/sysv/linux/hppa/getrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/i386/getrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/i386/oldgetrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/m68k/getrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/getrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/oldgetrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/sh/getrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/wordsize-64/getrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/wordsize-64/setrlimit64.c: Likewise.
> 	* sysdeps/sysv/linux/generic/wordsize-32/syscalls.list: Remove
> 	setrlimit and getrlimit.
> 	* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
> 	* sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise.
> 	* sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list: Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list: Likewise.
> 	* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list: Likewise.
> 	* sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise.
> 	* sysdeps/unix/sysv/linux/syscalls.list: Likewise.
> 	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise.
> 	* sysdeps/unix/sysv/linux/getrlimit.c: New file.
> 	* sysdeps/unix/sysv/linux/sparc/getrlimit64.c: Likewise.
> 	* sysdeps/unix/sysv/linux/setrlimit.c: Likewise.
> 	* sysdeps/unix/sysv/linux/getrlimit64.c (__getrlimit64): Handle
> 	__RLIM_T_MATCHES_RLIM64_T and add alias if defined.
> 	(__old_getrlimit64): Add compatibility symbol.
> 	* sysdeps/unix/sysv/linux/setrlimit64.c (__setrlimit): Likewise.

Ok.

> diff --git a/sysdeps/unix/sysv/linux/getrlimit64.c b/sysdeps/unix/sysv/linux/getrlimit64.c
> index d055a7f..739d054 100644
> --- a/sysdeps/unix/sysv/linux/getrlimit64.c
> +++ b/sysdeps/unix/sysv/linux/getrlimit64.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2010-2016 Free Software Foundation, Inc.
> +/* Linux getrlimit64 implementation (64 bits rlim_t).
> +   Copyright (C) 2010-2016 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
> @@ -16,29 +17,46 @@
>     <http://www.gnu.org/licenses/>.  */
>  
>  #include <errno.h>
> -#include <sys/resource.h>
>  #include <sys/types.h>
> -#include <sysdep.h>
> -#include <kernel-features.h>
> +#include <shlib-compat.h>
> +
> +/* Add this redirection so the strong_alias for __RLIM_T_MATCHES_RLIM64_T
> +   linking getlimit64 to {__}getrlimit does not thrown a type error.  */

                                                   throw

> +/* The fallback code only make sense if the platform supports either

                             makes

> +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_2)
> +/* Back compatible 2Gig limited rlimit.  */

                      2GiB

> diff --git a/sysdeps/unix/sysv/linux/setrlimit64.c b/sysdeps/unix/sysv/linux/setrlimit64.c
> index 5f444d2..0825465 100644
> --- a/sysdeps/unix/sysv/linux/setrlimit64.c
> +++ b/sysdeps/unix/sysv/linux/setrlimit64.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2010-2016 Free Software Foundation, Inc.
> +/* Linux setrlimit64 implementation (64 bits off_t).
> +   Copyright (C) 2010-2016 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
> @@ -16,25 +17,37 @@
>     <http://www.gnu.org/licenses/>.  */
>  
>  #include <errno.h>
> -#include <sys/resource.h>
>  #include <sys/types.h>
> -#include <sysdep.h>
> -#include <kernel-features.h>
> +#include <shlib-compat.h>
> +
> +/* Add this redirection so the strong_alias for __RLIM_T_MATCHES_RLIM64_T
> +   linking setlimit64 to {__}setrlimit does not thrown a type error.  */

                                                   throw

> +/* The fallback code only make sense if the platform supports

                             makes


Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


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