diff options
30 files changed, 396 insertions, 116 deletions
@@ -1,3 +1,50 @@ +1999-12-01 Andreas Jaeger <aj@suse.de> + + * sysdeps/generic/if_index.c (__protocol_available): Add missing + int for parameter. + + * stdio/stdio.h: Fix typo. + Patches by Marcus G. Daniels <mgd@santafe.edu>. + +1999-12-01 Andreas Jaeger <aj@suse.de> + + * scripts/test-installation.pl (installation_problem): Filter out + libpthread_db. + +1999-12-01 Andreas Schwab <schwab@suse.de> + + * sysdeps/unix/sysv/linux/alpha/bits/types.h: Fix signedness of + __rlim_t and __rlim64_t. + * sysdeps/unix/sysv/linux/mips/bits/types.h: Likewise. + * sysdeps/unix/sysv/linux/sparc/bits/types.h: Likewise. + +1999-12-01 Andreas Schwab <schwab@suse.de> + + * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add + oldgetrlimit64 and oldsetrlimit64 for subdir = resource. + * sysdeps/unix/sysv/linux/Versions: Add getrlimit, setrlimit, + getrlimit64 and setrlimit64 to version GLIBC_2.1.3. + * sysdeps/unix/sysv/linux/setrlimit.c: Correct handling of old and + new kernel version. Add symbol versions. + * sysdeps/unix/sysv/linux/syscalls.list: Add oldsetrlimit and + oldgetrlimit. + * sysdeps/unix/sysv/linux/alpha/syscalls.list: Likewise. + * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. + * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Add s_getrlimit + and s_ugetrlimit. + * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise. + * sysdeps/unix/sysv/linux/getrlimit.c: New file. + * sysdeps/unix/sysv/linux/getrlimit64.c: New file. + * sysdeps/unix/sysv/linux/oldgetrlimit64.c: New file. + * sysdeps/unix/sysv/linux/oldsetrlimit64.c: New file. + * sysdeps/unix/sysv/linux/setrlimit64.c: New file. + * sysdeps/unix/sysv/linux/alpha/oldgetrlimit64.c: New file. + * sysdeps/unix/sysv/linux/alpha/oldsetrlimit64.c: New file. + * sysdeps/unix/sysv/linux/sparc/sparc64/oldgetrlimit64.c: New + file. + * sysdeps/unix/sysv/linux/sparc/sparc64/oldsetrlimit64.c: New + file. + 1999-12-01 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/usleep.c: Fix typo. diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 22ed03d..522bea2 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,10 @@ +1999-12-01 Ulrich Drepper <drepper@cygnus.com> + + * sysdeps/i386/pt-machine.h: Move stack_pointer definition to the + beginning. + * sysdeps/i386/i686/pt-machine.h: Likewise. + Patches by Alan Modra <alan@SPRI.Levels.UniSA.Edu.Au>. + 1999-11-23 Ulrich Drepper <drepper@cygnus.com> * manager.c (pthread_start_thread_event): Initialize p_pid already diff --git a/linuxthreads/sysdeps/i386/i686/pt-machine.h b/linuxthreads/sysdeps/i386/i686/pt-machine.h index 91dfb46..8d9ea70 100644 --- a/linuxthreads/sysdeps/i386/i686/pt-machine.h +++ b/linuxthreads/sysdeps/i386/i686/pt-machine.h @@ -24,6 +24,12 @@ #endif +/* Get some notion of the current stack. Need not be exactly the top + of the stack, just something somewhere in the current frame. */ +#define CURRENT_STACK_FRAME stack_pointer +register char * stack_pointer __asm__ ("%esp"); + + /* Spinlock implementation; required. */ PT_EI int testandset (int *spinlock) @@ -40,12 +46,6 @@ testandset (int *spinlock) } -/* Get some notion of the current stack. Need not be exactly the top - of the stack, just something somewhere in the current frame. */ -#define CURRENT_STACK_FRAME stack_pointer -register char * stack_pointer __asm__ ("%esp"); - - /* Compare-and-swap for semaphores. It's always available on i686. */ #define HAS_COMPARE_AND_SWAP diff --git a/linuxthreads/sysdeps/i386/pt-machine.h b/linuxthreads/sysdeps/i386/pt-machine.h index 97d75d4..a1fe71b 100644 --- a/linuxthreads/sysdeps/i386/pt-machine.h +++ b/linuxthreads/sysdeps/i386/pt-machine.h @@ -1,6 +1,6 @@ /* Machine-dependent pthreads configuration and inline functions. i386 version. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <rth@tamu.edu>. @@ -23,6 +23,12 @@ # define PT_EI extern inline #endif +/* Get some notion of the current stack. Need not be exactly the top + of the stack, just something somewhere in the current frame. */ +#define CURRENT_STACK_FRAME stack_pointer +register char * stack_pointer __asm__ ("%esp"); + + /* Spinlock implementation; required. */ PT_EI int testandset (int *spinlock) @@ -39,12 +45,6 @@ testandset (int *spinlock) } -/* Get some notion of the current stack. Need not be exactly the top - of the stack, just something somewhere in the current frame. */ -#define CURRENT_STACK_FRAME stack_pointer -register char * stack_pointer __asm__ ("%esp"); - - /* Compare-and-swap for semaphores. Available on the 486 and above, but not on the 386. We test dynamically whether it's available or not. */ diff --git a/linuxthreads_db/ChangeLog b/linuxthreads_db/ChangeLog index e621627..feb8b82 100644 --- a/linuxthreads_db/ChangeLog +++ b/linuxthreads_db/ChangeLog @@ -1,3 +1,7 @@ +1999-12-02 Ulrich Drepper <drepper@cygnus.com> + + * proc_service.h: Fix typos in last added declaractions. + 1999-12-01 Ulrich Drepper <drepper@cygnus.com> * proc_service.h: Add ps_pstop, ps_pcontinue, ps_lstop, and diff --git a/linuxthreads_db/proc_service.h b/linuxthreads_db/proc_service.h index fbc01ea..8f9a7d9 100644 --- a/linuxthreads_db/proc_service.h +++ b/linuxthreads_db/proc_service.h @@ -63,8 +63,8 @@ extern ps_err_e ps_lsetfpregs(struct ps_prochandle *, extern pid_t ps_getpid (struct ps_prochandle *); -extern ps_err ps_pstop (const struct ps_prochandle *); -extern ps_err ps_pcontinue (const struct ps_prochandle *); +extern ps_err_e ps_pstop (const struct ps_prochandle *); +extern ps_err_e ps_pcontinue (const struct ps_prochandle *); -extern ps_err ps_lstop (const struct ps_prochandle *, lwpid_t); -extern ps_err ps_lcontinue (const struct ps_prochandle *, lwpid_t); +extern ps_err_e ps_lstop (const struct ps_prochandle *, lwpid_t); +extern ps_err_e ps_lcontinue (const struct ps_prochandle *, lwpid_t); diff --git a/scripts/test-installation.pl b/scripts/test-installation.pl index 6e640cd..b54a23e 100755 --- a/scripts/test-installation.pl +++ b/scripts/test-installation.pl @@ -105,8 +105,9 @@ while (<SOVERSIONS>) { # - nss_ldap since it's not yet available # - libdb1 since it conflicts with libdb # - libnss1_* from glibc-compat add-on + # - libthread_db since it contains unresolved references if ($name ne "nss_ldap" && $name ne "db1" - && !($name =~/^nss1_/)) { + && !($name =~/^nss1_/) && $name ne "thread_db") { $link_libs .= " -l$name"; $versions{$name} = $version; } diff --git a/stdio/stdio.h b/stdio/stdio.h index 3c6674d..7be0c24 100644 --- a/stdio/stdio.h +++ b/stdio/stdio.h @@ -406,7 +406,7 @@ extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format, __gnuc_va_list __arg) __THROW; /* Write formatted output to stdout from argument list ARG. */ extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg) - ___THROW; + __THROW; /* Write formatted output to S from argument list ARG. */ extern int vsprintf (char *__restrict __s, __const char *__restrict __format, __gnuc_va_list __arg) __THROW; diff --git a/sysdeps/generic/if_index.c b/sysdeps/generic/if_index.c index c9fedac..e8af824 100644 --- a/sysdeps/generic/if_index.c +++ b/sysdeps/generic/if_index.c @@ -55,7 +55,7 @@ stub_warning (if_nameindex) void internal_function -__protocol_available (int *have_inet, have_inet6) +__protocol_available (int *have_inet, int *have_inet6) { /* By default we assume that IPv4 is avaialble, IPv6 not. */ *have_inet = 1; diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 4d7594d..4c5b7ea 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -106,3 +106,7 @@ endif ifeq ($(subdir),nis) CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1 endif + +ifeq ($(subdir),resource) +sysdep_routines += oldgetrlimit64 oldsetrlimit64 +endif diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions index 6210830..4088643 100644 --- a/sysdeps/unix/sysv/linux/Versions +++ b/sysdeps/unix/sysv/linux/Versions @@ -82,4 +82,8 @@ libc { # u* umount2; } + GLIBC_2.1.3 { + # New rlimit interface + getrlimit; setrlimit; getrlimit64; setrlimit64; + } } diff --git a/sysdeps/unix/sysv/linux/alpha/bits/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h index d98ed8a..d55fee3 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/types.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h @@ -57,8 +57,8 @@ typedef __int64_t __off64_t; /* "" (LFS) */ typedef __int64_t __loff_t; /* Type of file sizes and offsets. */ typedef __int32_t __pid_t; /* Type of process identifications. */ typedef __int64_t __ssize_t; /* Type of a byte count, or error. */ -typedef __int64_t __rlim_t; /* Type of resource counts. */ -typedef __int64_t __rlim64_t; /* "" (LFS) */ +typedef __uint64_t __rlim_t; /* Type of resource counts. */ +typedef __uint64_t __rlim64_t; /* "" (LFS) */ typedef __uint32_t __blksize_t; /* Type to represnet block size. */ typedef __uint32_t __blkcnt_t; /* Type to count nr disk blocks. */ typedef __uint64_t __blkcnt64_t; /* "" (LFS) */ diff --git a/sysdeps/unix/sysv/linux/alpha/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/alpha/oldgetrlimit64.c new file mode 100644 index 0000000..9feab0e --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/oldgetrlimit64.c @@ -0,0 +1 @@ +/* getrlimit64 is the same as getrlimit. */ diff --git a/sysdeps/unix/sysv/linux/alpha/oldsetrlimit64.c b/sysdeps/unix/sysv/linux/alpha/oldsetrlimit64.c new file mode 100644 index 0000000..8edcff0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/oldsetrlimit64.c @@ -0,0 +1 @@ +/* setrlimit64 is the same as setrlimit. */ diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index ba20cd0..49f2b11 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -29,6 +29,8 @@ fstatfs - fstatfs 2 __fstatfs fstatfs fstatfs64 statfs - statfs 2 __statfs statfs statfs64 getrlimit - getrlimit 2 __getrlimit getrlimit getrlimit64 setrlimit - setrlimit 2 setrlimit setrlimit64 +oldgetrlimit EXTRA getrlimit 2 __old_getrlimit getrlimit@GLIBC_2.0 getrlimit64@GLIBC_2.1 +oldsetrlimit EXTRA setrlimit 2 __old_setrlimit setrlimit@GLIBC_2.0 setrlimit64@GLIBC_2.1 ftruncate - ftruncate 2 __ftruncate ftruncate ftruncate64 truncate - truncate 2 truncate truncate64 diff --git a/sysdeps/unix/sysv/linux/getrlimit.c b/sysdeps/unix/sysv/linux/getrlimit.c new file mode 100644 index 0000000..3eee05c --- /dev/null +++ b/sysdeps/unix/sysv/linux/getrlimit.c @@ -0,0 +1,87 @@ +/* Copyright (C) 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include <sys/resource.h> + +#include <sysdep.h> +#include <sys/syscall.h> + +#include "kernel-features.h" + +extern int __syscall_ugetrlimit __P ((unsigned int resource, + struct rlimit *rlimits)); +extern int __syscall_getrlimit __P ((unsigned int resource, + struct rlimit *rlimits)); + +/* Linux 2.3.25 introduced a new system call since the types used for + the limits are now unsigned. */ +#if defined __NR_ugetrlimit && !defined __ASSUME_NEW_GETRLIMIT_SYSCALL +int __have_no_new_getrlimit; +#endif + +int +__new_getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits) +{ +#ifdef __ASSUME_NEW_GETRLIMIT_SYSCALL + return INLINE_SYSCALL (ugetrlimit, 2, resource, rlimits); +#else + int result; + +# ifdef __NR_ugetrlimit + if (__have_no_new_getrlimit <= 0) + { + result = INLINE_SYSCALL (ugetrlimit, 2, resource, rlimits); + + /* If the system call is available remember this fact and return. */ + if (result != -1 || errno != ENOSYS) + { + __have_no_new_getrlimit = -1; + return result; + } + + /* Remember that the system call is not available. */ + __have_no_new_getrlimit = 1; + } +# endif + + /* Fall back to the old system call. */ + result = INLINE_SYSCALL (getrlimit, 2, resource, rlimits); + + if (result == -1) + return result; + + /* We might have to correct the limits values. Since the old values + were signed the infinity value is too small. */ + if (rlimits->rlim_cur == RLIM_INFINITY >> 1) + rlimits->rlim_cur = RLIM_INFINITY; + if (rlimits->rlim_max == RLIM_INFINITY >> 1) + rlimits->rlim_max = RLIM_INFINITY; + + return result; +#endif +} + +#if defined PIC && DO_VERSIONING +default_symbol_version (__new_getrlimit, __getrlimit, GLIBC_2.1.3); +strong_alias (__new_getrlimit, _new_getrlimit); +default_symbol_version (_new_getrlimit, getrlimit, GLIBC_2.1.3); +#else +weak_alias (__new_getrlimit, __getrlimit); +weak_alias (__new_getrlimit, getrlimit); +#endif diff --git a/sysdeps/unix/sysv/linux/getrlimit64.c b/sysdeps/unix/sysv/linux/getrlimit64.c new file mode 100644 index 0000000..602dd28 --- /dev/null +++ b/sysdeps/unix/sysv/linux/getrlimit64.c @@ -0,0 +1,28 @@ +/* Copyright (C) 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define getrlimit64 __new_getrlimit64 + +#include <sysdeps/generic/getrlimit64.c> + +#undef getrlimit64 +#if defined PIC && defined DO_VERSIONING +default_symbol_version (__new_getrlimit64, getrlimit64, GLIBC_2.1.3); +#else +weak_alias (__new_getrlimit64, getrlimit64); +#endif diff --git a/sysdeps/unix/sysv/linux/i386/getrlimit.c b/sysdeps/unix/sysv/linux/i386/getrlimit.c deleted file mode 100644 index 25d0d3b..0000000 --- a/sysdeps/unix/sysv/linux/i386/getrlimit.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 1999 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include <errno.h> -#include <sys/resource.h> - -#include <sysdep.h> -#include <sys/syscall.h> - -#include "../kernel-features.h" - - -/* Linux 2.3.25 introduced a new system call since the types used for - the limits are now unsigned. */ -#if !defined __ASSUME_NEW_GETRLIMIT_SYSCALL && defined __NR_ugetrlimit -static int no_new_getrlimit; -#else -# define no_new_getrlimit 0 -#endif - -int -__getrlimit (resource, rlimits) - enum __rlimit_resource resource; - struct rlimit *rlimits; -{ -#ifdef __NR_ugetrlimit - if (! no_new_getrlimit) - { - int result = INLINE_SYSCALL (ugetrlimit, 2, resource, rlimits); - -# ifndef __ASSUME_NEW_GETRLIMIT_SYSCALL - /* If the system call is available return. */ - if (result != -1 || errno != ENOSYS) -# endif - return result; - -# ifndef __ASSUME_NEW_GETRLIMIT_SYSCALL - /* Remember that the system call is not available. */ - no_new_getrlimit = 1; -# endif - } -#endif - -#ifndef __ASSUME_NEW_GETRLIMIT_SYSCALL - /* Fall back on the old system call. */ - return INLINE_SYSCALL (getrlimit, 2, resource, rlimits); -#endif -} -weak_alias (__getrlimit, getrlimit) diff --git a/sysdeps/unix/sysv/linux/mips/bits/types.h b/sysdeps/unix/sysv/linux/mips/bits/types.h index 37c3f21..a52bb80 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/types.h +++ b/sysdeps/unix/sysv/linux/mips/bits/types.h @@ -68,8 +68,8 @@ typedef long int __off_t; /* Type of file sizes and offsets. */ typedef __quad_t __loff_t; /* Type of file sizes and offsets. */ typedef int __pid_t; /* Type of process identifications. */ typedef int __ssize_t; /* Type of a byte count, or error. */ -typedef long int __rlim_t; /* Type of resource counts. */ -typedef __quad_t __rlim64_t; /* Type of resource counts (LFS). */ +typedef __u_long __rlim_t; /* Type of resource counts. */ +typedef __u_quad_t __rlim64_t; /* Type of resource counts (LFS). */ typedef __u_int __id_t; /* General type for ID. */ typedef struct diff --git a/sysdeps/unix/sysv/linux/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/oldgetrlimit64.c new file mode 100644 index 0000000..5fb0bec --- /dev/null +++ b/sysdeps/unix/sysv/linux/oldgetrlimit64.c @@ -0,0 +1,53 @@ +/* Copyright (C) 1991, 1995, 1996, 1997, 1998, 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This is a compatibility file. If we don't build the libc with + versioning don't compile this file. */ +#if defined PIC && DO_VERSIONING + +#include <errno.h> +#include <sys/resource.h> +#include <sys/types.h> + +extern int __old_getrlimit (enum __rlimit_resource, struct rlimit *); + +/* Put the soft and hard limits for RESOURCE in *RLIMITS. + Returns 0 if successful, -1 if not (and sets errno). */ +int +__old_getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits) +{ + struct rlimit rlimits32; + + if (__old_getrlimit (resource, &rlimits32) < 0) + return -1; + + if (rlimits32.rlim_cur == RLIM_INFINITY >> 1) + rlimits->rlim_cur = RLIM64_INFINITY >> 1; + else + rlimits->rlim_cur = rlimits32.rlim_cur; + if (rlimits32.rlim_max == RLIM_INFINITY >> 1) + rlimits->rlim_max = RLIM64_INFINITY >> 1; + else + rlimits->rlim_max = rlimits32.rlim_max; + + return 0; +} + +symbol_version (__old_getrlimit64, getrlimit64, GLIBC_2.1); + +#endif /* PIC && DO_VERSIONING */ diff --git a/sysdeps/unix/sysv/linux/oldsetrlimit64.c b/sysdeps/unix/sysv/linux/oldsetrlimit64.c new file mode 100644 index 0000000..c5448dc --- /dev/null +++ b/sysdeps/unix/sysv/linux/oldsetrlimit64.c @@ -0,0 +1,52 @@ +/* Copyright (C) 1991, 95, 96, 97, 98, 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This is a compatibility file. If we don't build the libc with + versioning don't compile this file. */ +#if defined PIC && DO_VERSIONING + +#include <errno.h> +#include <sys/resource.h> +#include <sys/types.h> + +extern int __old_setrlimit (enum __rlimit_resource, const struct rlimit *); + +/* Set the soft and hard limits for RESOURCE to *RLIMITS. + Only the super-user can increase hard limits. + Return 0 if successful, -1 if not (and sets errno). */ +int +__old_setrlimit64 (enum __rlimit_resource resource, + const struct rlimit64 *rlimits) +{ + struct rlimit rlimits32; + + if (rlimits->rlim_cur >= RLIM_INFINITY >> 1) + rlimits32.rlim_cur = RLIM_INFINITY >> 1; + else + rlimits32.rlim_cur = rlimits->rlim_cur; + if (rlimits->rlim_max >= RLIM_INFINITY >> 1) + rlimits32.rlim_max = RLIM_INFINITY >> 1; + else + rlimits32.rlim_max = rlimits->rlim_max; + + return __old_setrlimit (resource, &rlimits32); +} + +symbol_version (__old_setrlimit64, setrlimit64, GLIBC_2.1); + +#endif /* PIC && DO_VERSIONING */ diff --git a/sysdeps/unix/sysv/linux/powerpc/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/syscalls.list index 1d8df00..c207270 100644 --- a/sysdeps/unix/sysv/linux/powerpc/syscalls.list +++ b/sysdeps/unix/sysv/linux/powerpc/syscalls.list @@ -17,6 +17,7 @@ s_getdents getdents getdents 3 __syscall_getdents s_getpriority getpriority getpriority 2 __syscall_getpriority s_getresgid getresgid getresgid 3 __syscall_getresgid s_getresuid getresuid getresuid 3 __syscall_getresuid +s_getrlimit getrlimit getrlimit 2 __syscall_getrlimit s_poll poll poll 3 __syscall_poll s_pread64 pread64 pread 5 __syscall_pread s_ptrace ptrace ptrace 4 __syscall_ptrace @@ -28,6 +29,7 @@ s_sigpending sigpending sigpending 1 __syscall_sigpending s_sigprocmask sigprocmask sigprocmask 3 __syscall_sigprocmask s_sigsuspend sigsuspend sigsuspend 3 __syscall_sigsuspend s_sysctl sysctl _sysctl 1 __syscall__sysctl +s_ugetrlimit getrlimit ugetrlimit 2 __syscall_ugetrlimit s_ustat ustat ustat 2 __syscall_ustat s_vfork vfork vfork 0 __syscall_vfork sys_fstat fxstat fstat 2 __syscall_fstat diff --git a/sysdeps/unix/sysv/linux/setrlimit.c b/sysdeps/unix/sysv/linux/setrlimit.c index 43bfdbb..882f0c5 100644 --- a/sysdeps/unix/sysv/linux/setrlimit.c +++ b/sysdeps/unix/sysv/linux/setrlimit.c @@ -27,52 +27,67 @@ extern int __syscall_setrlimit (unsigned int resource, const struct rlimit *rlimits); +extern int __syscall_ugetrlimit (unsigned int resource, + const struct rlimit *rlimits); /* Linux 2.3.25 introduced a new system call since the types used for the limits are now unsigned. */ -#if !defined __ASSUME_NEW_GETRLIMIT_SYSCALL && defined __NR_ugetrlimit -static int no_new_getrlimit; -#else -# define no_new_getrlimit 0 +#if defined __NR_ugetrlimit && !defined __ASSUME_NEW_GETRLIMIT_SYSCALL +extern int __have_no_new_getrlimit; /* from getrlimit.c */ #endif int -__setrlimit (resource, rlimits) - enum __rlimit_resource resource; - const struct rlimit *rlimits; +__new_setrlimit (enum __rlimit_resource resource, const struct rlimit *rlimits) { -#ifndef __ASSUME_NEW_GETRLIMIT_SYSCALL +#ifdef __ASSUME_NEW_GETRLIMIT_SYSCALL + return INLINE_SYSCALL (setrlimit, 2, resource, rlimits); +#else struct rlimit rlimits_small; -#endif -#ifdef __NR_ugetrlimit - if (! no_new_getrlimit) +# ifdef __NR_ugetrlimit + if (__have_no_new_getrlimit <= 0) { int result = INLINE_SYSCALL (setrlimit, 2, resource, rlimits); -# ifndef __ASSUME_NEW_GETRLIMIT_SYSCALL - /* If the system call is available return. */ - if (result != -1 || errno != ENOSYS) -# endif + /* Return if the values are not out of range or if we positively + know that the ugetrlimit system call exists. */ + if (result != -1 || errno != EINVAL || __have_no_new_getrlimit < 0) return result; -# ifndef __ASSUME_NEW_GETRLIMIT_SYSCALL - /* Remember that the system call is not available. */ - no_new_getrlimit = 1; -# endif + /* Check if the new ugetrlimit syscall exists. */ + if (INLINE_SYSCALL (ugetrlimit, 2, resource, &rlimits_small) != -1 + || errno != ENOSYS) + { + /* There was some other error, probably RESOURCE out of range. + Remember that the ugetrlimit system call really exists. */ + __have_no_new_getrlimit = -1; + /* Restore previous errno value. */ + __set_errno (EINVAL); + return result; + } + + /* Remember that the kernel uses the old interface. */ + __have_no_new_getrlimit = 1; } -#endif +# endif -#ifndef __ASSUME_NEW_GETRLIMIT_SYSCALL /* We might have to correct the limits values. Since the old values - were signed the new values are too large. */ + were signed the new values might be too large. */ rlimits_small.rlim_cur = MIN ((unsigned long int) rlimits->rlim_cur, - RLIM_INFINITY >> 2); + RLIM_INFINITY >> 1); rlimits_small.rlim_max = MIN ((unsigned long int) rlimits->rlim_max, - RLIM_INFINITY >> 2); + RLIM_INFINITY >> 1); - /* Fall back on the old system call. */ + /* Try again with the adjusted values. */ return INLINE_SYSCALL (setrlimit, 2, resource, &rlimits_small); #endif } -weak_alias (__setrlimit, setrlimit) + +#if defined PIC && DO_VERSIONING +default_symbol_version (__new_setrlimit, __setrlimit, GLIBC_2.1.3); +strong_alias (__new_setrlimit, _new_setrlimit); +default_symbol_version (_new_setrlimit, setrlimit, GLIBC_2.1.3); +#else +weak_alias (__new_setrlimit, __setrlimit); +weak_alias (__new_setrlimit, setrlimit); +#endif diff --git a/sysdeps/unix/sysv/linux/setrlimit64.c b/sysdeps/unix/sysv/linux/setrlimit64.c new file mode 100644 index 0000000..3e7e5cc --- /dev/null +++ b/sysdeps/unix/sysv/linux/setrlimit64.c @@ -0,0 +1,28 @@ +/* Copyright (C) 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define setrlimit64 __new_setrlimit64 + +#include <sysdeps/generic/setrlimit64.c> + +#undef setrlimit64 +#if defined PIC && defined DO_VERSIONING +default_symbol_version (__new_setrlimit64, setrlimit64, GLIBC_2.1.3); +#else +weak_alias (__new_setrlimit64, setrlimit64); +#endif diff --git a/sysdeps/unix/sysv/linux/sparc/bits/types.h b/sysdeps/unix/sysv/linux/sparc/bits/types.h index 89b3ad9..ad217bf 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/types.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/types.h @@ -85,8 +85,8 @@ typedef long long int __ssize_t; /* Type of a byte count, or error. */ #else typedef int __ssize_t; /* Type of a byte count, or error. */ #endif -typedef long int __rlim_t; /* Type of resource counts. */ -typedef __quad_t __rlim64_t; /* Type of resource counts (LFS). */ +typedef __u_long __rlim_t; /* Type of resource counts. */ +typedef __u_quad_t __rlim64_t; /* Type of resource counts (LFS). */ typedef __u_int __id_t; /* General type for IDs. */ typedef struct diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list index 3ce7d31..c80056f 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list @@ -28,6 +28,7 @@ s_getdents getdents getdents 3 __syscall_getdents s_getpriority getpriority getpriority 2 __syscall_getpriority s_getresgid getresgid getresgid 3 __syscall_getresgid s_getresuid getresuid getresuid 3 __syscall_getresuid +s_getrlimit getrlimit getrlimit 2 __syscall_getrlimit s_poll poll poll 3 __syscall_poll s_pread64 pread64 pread 5 __syscall_pread s_ptrace ptrace ptrace 4 __syscall_ptrace @@ -38,6 +39,7 @@ s_sigpending sigpending sigpending 1 __syscall_sigpending s_sigprocmask sigprocmask sigprocmask 3 __syscall_sigprocmask s_sigsuspend sigsuspend sigsuspend 3 __syscall_sigsuspend s_sysctl sysctl _sysctl 1 __syscall__sysctl +s_ugetrlimit getrlimit ugetrlimit 2 __syscall_ugetrlimit s_ustat ustat ustat 2 __syscall_ustat sys_fstat fxstat fstat 2 __syscall_fstat sys_lstat lxstat lstat 2 __syscall_lstat diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/oldgetrlimit64.c new file mode 100644 index 0000000..9feab0e --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/oldgetrlimit64.c @@ -0,0 +1 @@ +/* getrlimit64 is the same as getrlimit. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/oldsetrlimit64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/oldsetrlimit64.c new file mode 100644 index 0000000..8edcff0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/oldsetrlimit64.c @@ -0,0 +1 @@ +/* setrlimit64 is the same as setrlimit. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list index 679722f..c857cf8 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list @@ -8,6 +8,8 @@ fstatfs - fstatfs 2 __fstatfs fstatfs fstatfs64 statfs - statfs 2 __statfs statfs statfs64 getrlimit - getrlimit 2 __getrlimit getrlimit getrlimit64 setrlimit - setrlimit 2 setrlimit setrlimit64 +oldgetrlimit EXTRA getrlimit 2 __old_getrlimit getrlimit@GLIBC_2.0 getrlimit64@GLIBC_2.1 +oldsetrlimit EXTRA setrlimit 2 __old_setrlimit setrlimit@GLIBC_2.0 setrlimit64@GLIBC_2.1 ftruncate - ftruncate 2 __ftruncate ftruncate ftruncate64 truncate - truncate 2 truncate truncate64 mmap - mmap 6 __mmap mmap __mmap64 mmap64 diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 6215973..50f1cc9 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -33,6 +33,8 @@ munlock EXTRA munlock 2 __munlock munlock munlockall EXTRA munlockall 0 __munlockall munlockall nanosleep - nanosleep 2 __libc_nanosleep __nanosleep nanosleep nfsservctl EXTRA nfsservctl 3 nfsservctl +oldgetrlimit EXTRA getrlimit 2 __old_getrlimit getrlimit@GLIBC_2.0 +oldsetrlimit EXTRA setrlimit 2 __old_setrlimit setrlimit@GLIBC_2.0 pause - pause 0 __libc_pause pause personality init-first personality 1 __personality personality pipe - pipe 1 __pipe pipe |