This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi!
I think we should save errno around ugetrlimit calls if we are not sure it
exists.
2000-01-17 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/i386/setrlimit.c (__new_setrlimit): Save
errno if testing whether ugetrlimit exists.
* sysdeps/unix/sysv/linux/i386/getrlimit.c (__new_getrlimit): Likewise.
--- libc/sysdeps/unix/sysv/linux/i386/setrlimit.c.jj Sun Dec 19 00:42:59 1999
+++ libc/sysdeps/unix/sysv/linux/i386/setrlimit.c Mon Jan 17 10:32:54 2000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000 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
@@ -50,13 +50,17 @@ __new_setrlimit (enum __rlimit_resource
/* Check if the new ugetrlimit syscall exists. We must do this
first because older kernels don't reject negative rlimit
values in setrlimit. */
- int result = INLINE_SYSCALL (ugetrlimit, 2, resource, &rlimits_small);
+ int saved_errno = errno, result;
+
+ result = INLINE_SYSCALL (ugetrlimit, 2, resource, &rlimits_small);
if (result != -1 || errno != ENOSYS)
/* The syscall exists. */
__have_no_new_getrlimit = -1;
else
/* The syscall does not exist. */
__have_no_new_getrlimit = 1;
+
+ __set_errno (saved_errno);
}
if (__have_no_new_getrlimit < 0)
return INLINE_SYSCALL (setrlimit, 2, resource, rlimits);
--- libc/sysdeps/unix/sysv/linux/i386/getrlimit.c.jj Sat Dec 18 20:41:48 1999
+++ libc/sysdeps/unix/sysv/linux/i386/getrlimit.c Mon Jan 17 10:35:29 2000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000 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
@@ -45,6 +45,7 @@ __new_getrlimit (enum __rlimit_resource
# ifdef __NR_ugetrlimit
if (__have_no_new_getrlimit <= 0)
{
+ int saved_errno = errno;
result = INLINE_SYSCALL (ugetrlimit, 2, resource, rlimits);
/* If the system call is available remember this fact and return. */
@@ -56,6 +57,7 @@ __new_getrlimit (enum __rlimit_resource
/* Remember that the system call is not available. */
__have_no_new_getrlimit = 1;
+ __set_errno (saved_errno);
}
# endif
Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.39 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |