public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@redhat.com>
To: libc-hacker@sourceware.org
Subject: [PATCH] Don't call uname or getrlimit in libpthread init function
Date: Thu, 08 Apr 2010 09:43:00 -0000	[thread overview]
Message-ID: <m339z6nuu6.fsf@hase.home> (raw)

The libpthread init function calls uname and getrlimit, which means they
are called just by being linked against it, even if the program does not
use any of the libpthread functions, thus may use the function names for
its own purpose.

Andreas.

2010-04-08  Andreas Schwab  <schwab@redhat.com>

	* sysdeps/unix/sysv/linux/i386/Versions: Export __uname under
	GLIBC_PRIVATE.
	* nptl/Versions: Export __getrlimit under GLIBC_PRIVATE.
	* sysdeps/unix/sysv/linux/i386/smp.h: Call __uname instead of uname.
	* nptl/nptl-init.c: Call __getrlimit instead of getrlimit.
---
 nptl/Versions                              |    1 +
 nptl/nptl-init.c                           |    2 +-
 nptl/sysdeps/unix/sysv/linux/i386/Versions |    6 ++++++
 nptl/sysdeps/unix/sysv/linux/i386/smp.h    |    2 +-
 4 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100644 nptl/sysdeps/unix/sysv/linux/i386/Versions

diff --git a/nptl/Versions b/nptl/Versions
index 1f2de79..13ca357 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -29,6 +29,7 @@ libc {
   GLIBC_PRIVATE {
     # Internal libc interface to libpthread
     __libc_dl_error_tsd;
+    __getrlimit;
   }
 }
 
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 851bab2..c663f21 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -396,7 +396,7 @@ __pthread_initialize_minimal_internal (void)
   /* Determine the default allowed stack size.  This is the size used
      in case the user does not specify one.  */
   struct rlimit limit;
-  if (getrlimit (RLIMIT_STACK, &limit) != 0
+  if (__getrlimit (RLIMIT_STACK, &limit) != 0
       || limit.rlim_cur == RLIM_INFINITY)
     /* The system limit is not usable.  Use an architecture-specific
        default.  */
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/Versions b/nptl/sysdeps/unix/sysv/linux/i386/Versions
new file mode 100644
index 0000000..9d53804
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/i386/Versions
@@ -0,0 +1,6 @@
+libc {
+  GLIBC_PRIVATE {
+    # Internal libc interface to libpthread
+    __uname;
+  }
+}
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/smp.h b/nptl/sysdeps/unix/sysv/linux/i386/smp.h
index f68a0c0..bdff665 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/smp.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/smp.h
@@ -37,7 +37,7 @@ is_smp_system (void)
   char *cp;
 
   /* Try reading the number using `sysctl' first.  */
-  if (uname (&u.uts) == 0)
+  if (__uname (&u.uts) == 0)
     cp = u.uts.version;
   else
     {
-- 
1.7.0.1


-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

             reply	other threads:[~2010-04-08  9:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08  9:43 Andreas Schwab [this message]
2010-04-08 22:36 ` Ulrich Drepper
     [not found]   ` <m2y6gxy1po.fsf@igel.home>
2010-04-08 23:42     ` Ulrich Drepper
2010-04-09  8:18       ` 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=m339z6nuu6.fsf@hase.home \
    --to=schwab@redhat.com \
    --cc=libc-hacker@sourceware.org \
    /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).