From: Jakub Jelinek <jakub@redhat.com>
To: libc-hacker@sourceware.cygnus.com
Subject: [PATCH] save errno around ugetrlimit
Date: Mon, 17 Jan 2000 01:45:00 -0000 [thread overview]
Message-ID: <20000117104728.Y2708@mff.cuni.cz> (raw)
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)
___________________________________________________________________
next reply other threads:[~2000-01-17 1:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-17 1:45 Jakub Jelinek [this message]
2000-01-17 4:04 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20000117104728.Y2708@mff.cuni.cz \
--to=jakub@redhat.com \
--cc=libc-hacker@sourceware.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).