]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update from main line.
authorUlrich Drepper <drepper@redhat.com>
Sun, 1 Aug 1999 22:23:36 +0000 (22:23 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 1 Aug 1999 22:23:36 +0000 (22:23 +0000)
23 files changed:
ChangeLog
Makerules
include/stdlib.h
include/sys/sysinfo.h [new file with mode: 0644]
manual/time.texi
misc/efgcvt.c
misc/efgcvt_r.c
misc/qefgcvt.c
misc/qefgcvt_r.c
nis/nss_compat/compat-initgroups.c
nis/nss_nis/nis-initgroups.c
sysdeps/generic/e_lgammal_r.c
sysdeps/generic/putenv.c
sysdeps/generic/setenv.c
sysdeps/generic/sys/sysinfo.h
sysdeps/i386/bits/string.h
sysdeps/libm-i387/e_pow.S
sysdeps/libm-i387/e_powf.S
sysdeps/libm-i387/e_powl.S
sysdeps/libm-ieee754/e_gammal_r.c
sysdeps/unix/sysv/linux/alpha/getsysstats.c [new file with mode: 0644]
sysdeps/unix/sysv/linux/getsysstats.c
sysdeps/unix/sysv/linux/sys/sysinfo.h

index d1cbdc0add35c0ab0c080a435b63a7db08c2ca56..dd047d72302abe33d39ef27f22ed349eab794f7f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
        * string/bits/string2.h (__strcpy_small): Fix a typo.
 
+1999-07-31  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/i386/fpu/e_pow.S: Use addl %esp instead of pop.
+       * sysdeps/i386/fpu/e_powf.S: Likewise.
+       * sysdeps/i386/fpu/e_powl.S: Likewise.  [PR libc/1213].
+
+       * sysdeps/generic/e_lgammal_r.c: Set *signgam to zero.
+       * sysdeps/generic/e_gammal_r.c: Likewise.  [PR libc/1212].
+
+1999-07-30  Andreas Schwab  <schwab@suse.de>
+
+       * sysdeps/unix/sysv/linux/getsysstats.c (GET_NPROCS_PARSER): New
+       definition.
+       (__get_nprocs): Use it.
+       (__get_nprocs_conf): Define as separate function if
+       GET_NPROCS_CONF_PARSER is defined.
+       * sysdeps/unix/sysv/linux/alpha/getsysstats.c: New file.
+
+       * include/sys/sysinfo.h: New file.
+       * sysdeps/generic/sys/sysinfo.h: Remove declaration of internal
+       interface.
+       * sysdeps/unix/sysv/linux/sys/sysinfo.h: Likewise.
+
+1999-07-30  Andreas Schwab  <schwab@suse.de>
+
+       * Makerules: Put sysd-versions and Versions.all on
+       postclean-generated instead of common-generated.
+
+1999-07-29  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+       * manual/time.texi (Basic CPU Time): Note that clock_t can wrap
+       around and CLOCKS_PER_SEC is 1e6.
+
+1999-07-29  Andreas Schwab  <schwab@suse.de>
+
+       * misc/efgcvt.c (NDIGIT_MAX): Provide precomputed constants for
+       all floating point formats supported by gcc.  Error out for
+       unhandled precisions.
+       * misc/efgcvt_r.c (NDIGIT_MAX): Likewise.
+       * misc/qefgcvt.c (NDIGIT_MAX): Likewise.
+       * misc/qefgcvt_r.c (NDIGIT_MAX): Likewise.
+
+1999-07-29  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/generic/setenv.c: Move setenv code in new function
+       __add_to_environ.  Add new parameter specifying already
+       constructed string for the environment.
+       (setenv): Call __add_to_environ with new parameter set to NULL.
+       (unsetenv): Really test all elements for duplicated name.  Missed those
+       cases where the two are following each other.
+       * sysdeps/generic/putenv.c: Use __add_to_environ instead of setenv.
+       * include/stdlib.h: Add prototype of __add_to_environ.
+       * stdlib/tst-environ.c: New file.
+       * stdlib/Makefile (tests): Add tst-environ.
+
+       * sysdeps/i386/bits/string.h (__memset_cc): Fix typo in last patch.
+
+       * nis/nss_nis/nis-initgroups.c (_nss_nis_initgroups): Correct size
+       argument in realloc call.
+       * nis/nss_compat/compat-initgroups.c (_nss_compat_initgroups):
+       Likewise.
+       Reported by Danny Braniss <danny@cs.huji.ac.il>.
+
 1999-07-28  Ulrich Drepper  <drepper@cygnus.com>
 
        * misc/efgcvt.c: Use IEEE 854 formula to compute the number of digits
index 90b05870aa14b9f7d39ec3218a14a5e8804b7714..4d6a48742c7156a9661e04a074e7c70e223792ed 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -269,7 +269,8 @@ ifdef sysd-dirs-done
 ifeq ($(versioning),yes)
 -include $(common-objpfx)sysd-versions
 $(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions
-common-generated += $(version-maps) sysd-versions Versions.all
+common-generated += $(version-maps)
+postclean-generated += sysd-versions Versions.all
 
 ifndef avoid-generated
 ifneq ($(sysd-versions-subdirs),$(all-subdirs) $(config-sysdirs))
index c15d364c6ef5546e3affd8ab31d913ba119206ea..187c4585d8328305a374f8ea857147b7273551bb 100644 (file)
@@ -46,6 +46,9 @@ extern char *__canonicalize_file_name __P ((__const char *__name));
 extern char *__realpath __P ((__const char *__name, char *__resolved));
 extern int __ptsname_r __P ((int __fd, char *__buf, size_t __buflen));
 extern int __getpt __P ((void));
+
+extern int __add_to_environ (const char *name, const char *value,
+                            const char *combines, int replace);
 #endif
 #undef __Need_M_And_C
 
diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h
new file mode 100644 (file)
index 0000000..9d1549d
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef _SYS_SYSINFO_H
+#include_next <sys/sysinfo.h>
+
+/* Now we define the internal interface.  */
+
+/* Return number of configured processors.  */
+extern int __get_nprocs_conf __P ((void));
+
+/* Return number of available processors.  */
+extern int __get_nprocs __P ((void));
+
+/* Return number of physical pages of memory in the system.  */
+extern int __get_phys_pages __P ((void));
+
+/* Return number of available physical pages of memory in the system.  */
+extern int __get_avphys_pages __P ((void));
+
+#endif /* sys/sysinfo.h */
index 463814dae3ab1c0aa055bf3a0d36cc7a9237cc35..b45a33b5ce5296b89d87b476de7abb4d21b069b7 100644 (file)
@@ -95,11 +95,16 @@ to @code{double}, as in the example above, makes sure that operations
 such as arithmetic and printing work properly and consistently no matter
 what the underlying representation is.
 
+Note that the clock can wrap around.  On a 32bit system with
+@code{CLOCKS_PER_SEC} set to one million a wrap around happens after
+around 36 minutes.
+
 @comment time.h
 @comment ISO
 @deftypevr Macro int CLOCKS_PER_SEC
 The value of this macro is the number of clock ticks per second measured
-by the @code{clock} function.
+by the @code{clock} function.  POSIX requires that this value is one
+million independend of the actual resolution.
 @end deftypevr
 
 @comment time.h
index dc711c63dcd79b49fa4995720624b7453c8100f5..37b4bc0163633a3bf42afadd636fdf42c362173d 100644 (file)
 # define MAXDIG (NDIGIT_MAX + 3)
 # if DBL_MANT_DIG == 53
 #  define NDIGIT_MAX 17
+# elif DBL_MANT_DIG == 24
+#  define NDIGIT_MAX 9
+# elif DBL_MANT_DIG == 56
+#  define NDIGIT_MAX 18
 # else
-/* See IEEE 854 5.6, table 2 for this formula.  */
+/* See IEEE 854 5.6, table 2 for this formula.  Unfortunately we need a
+   compile time constant here, so we cannot use it.  */
+#  error "NDIGIT_MAX must be precomputed"
 #  define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))
 # endif
 #endif
index d73fd22f70f04d5db5655f32005c547df69f1f10..80770e6a82765e4e5f1b4fc1f5586b1cb574e20c 100644 (file)
 # define FLOAT_NAME_EXT
 # if DBL_MANT_DIG == 53
 #  define NDIGIT_MAX 17
+# elif DBL_MANT_DIG == 24
+#  define NDIGIT_MAX 9
+# elif DBL_MANT_DIG == 56
+#  define NDIGIT_MAX 18
 # else
-/* See IEEE 854 5.6, table 2 for this formula.  */
+/* See IEEE 854 5.6, table 2 for this formula.  Unfortunately we need a
+   compile time constant here, so we cannot use it.  */
+#  error "NDIGIT_MAX must be precomputed"
 #  define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))
 # endif
 #endif
index faf788aa5d407e34f1a99cac0ee64bb83edad14f..63fc764121b6c24e65a653b4a6312d557a9002f9 100644 (file)
 #define MAXDIG (NDIGIT_MAX + 12)
 #if LDBL_MANT_DIG == 64
 # define NDIGIT_MAX 21
+#elif LDBL_MANT_DIG == 53
+# define NDIGIT_MAX 17
+#elif LDBL_MANT_DIG == 113
+# define NDIGIT_MAX 36
+#elif LDBL_MANT_DIG == 56
+# define NDIGIT_MAX 18
 #else
-/* See IEEE 854 5.6, table 2 for this formula.  */
+/* See IEEE 854 5.6, table 2 for this formula.  Unfortunately we need a
+   compile time constant here, so we cannot use it.  */
+# error "NDIGIT_MAX must be precomputed"
 # define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
 #endif
 
index 5ff8110e3bbfb701aee0c85ae8a2484d80eee036..040193b612d1de6bfeb4a62dc86987f07ba6ec19 100644 (file)
 #define FLOAT_NAME_EXT l
 #if LDBL_MANT_DIG == 64
 # define NDIGIT_MAX 21
+#elif LDBL_MANT_DIG == 53
+# define NDIGIT_MAX 17
+#elif LDBL_MANT_DIG == 113
+# define NDIGIT_MAX 36
+#elif LDBL_MANT_DIG == 56
+# define NDIGIT_MAX 18
 #else
-/* See IEEE 854 5.6, table 2 for this formula.  */
+/* See IEEE 854 5.6, table 2 for this formula.  Unfortunately we need a
+   compile time constant here, so we cannot use it.  */
+# error "NDIGIT_MAX must be precomputed"
 # define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
 #endif
 
index a0c3455eb61ff6522cb55e0628966adb3c431535..47b395ede6c4b9c133037eb2d71a77d362b5f598 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
 
@@ -620,7 +620,7 @@ _nss_compat_initgroups (const char *user, gid_t group, long int *start,
                 if (*start == *size && limit <= 0)
                   {
                     /* Need a bigger buffer.  */
-                    groups = realloc (groups, *size * sizeof (*groups));
+                    groups = realloc (groups, 2 * *size * sizeof (*groups));
                     if (groups == NULL)
                       goto done;
                     *size *= 2;
index b69fea4e85f41fa46ac2371a9c2aed7e713dbd61..c5577c9cedc4df8e71cfe690d50d0d51f15bdfda 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
 
@@ -174,7 +174,7 @@ _nss_nis_initgroups (const char *user, gid_t group, long int *start,
                 if (*start == *size && limit <= 0)
                   {
                     /* Need a bigger buffer.  */
-                   groups = realloc (groups, *size * sizeof (*groups));
+                   groups = realloc (groups, 2 * *size * sizeof (*groups));
                    if (groups == NULL)
                      goto done;
                     *size *= 2;
index 0c1bc661ad752f90c7b979177938023d9a27139a..eea3d48d2aa55b716b46405cc41bc96123642f81 100644 (file)
@@ -5,6 +5,7 @@
 long double
 __ieee754_lgammal_r (long double x, int *signgamp)
 {
+  *signgamp = 0;
   fputs ("__ieee754_lgammal_r not implemented\n", stderr);
   __set_errno (ENOSYS);
   return 0.0;
index 3fcd5f93a8dc0d169f0f836cc163512c2474cdb4..75fafad06d32a2151fa8c3e3f557b9e986da683e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 94, 95, 96, 97, 98, 99 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
@@ -64,7 +64,7 @@ putenv (string)
       memcpy (name, string, name_end - string);
       name[name_end - string] = '\0';
 #endif
-      return __setenv (name, name_end + 1, 1);
+      return __add_to_environ (name, NULL, string, 1);
     }
 
   __unsetenv (string);
index a5818d03bfa78ae4dc24b735667e6c639d50b7a2..fc58e9b34630fc3e61bf17e1adf920a31409c961 100644 (file)
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* Issues:
-
-   1. putenv must not use setenv since the string provided by the user
-      must be used, not a copy
-
-   2. a common function should determine the place where to insert the
-      new entry and if necessary take care of extending the array
-
-   3. It must be kept track of whether an entry was inserted via putenv
-      or setenv.  In the former case the entry must not be put into
-      the search tree since removing it could mean it will not be
-      available anymore (e.g., when allocated on the stack)
-
-      To handle this an array parallel to the __environ array must specify
-      whether the entry was added via putenv or not
-*/
-
 #if HAVE_CONFIG_H
 # include <config.h>
 #endif
@@ -117,16 +100,23 @@ static void *known_values;
 static char **last_environ;
 
 
+/* This function is used by `setenv' and `putenv'.  The difference between
+   the two functions is that for the former must create a new string which
+   is then placed in the environment, while the argument of `putenv'
+   must be used directly.  This is all complicated by the fact that we try
+   to reuse values once generated for a `setenv' call since we can never
+   free the strings.  */
 int
-setenv (name, value, replace)
+__add_to_environ (name, value, combined, replace)
      const char *name;
      const char *value;
+     const char *combined;
      int replace;
 {
   register char **ep;
   register size_t size;
   const size_t namelen = strlen (name);
-  const size_t vallen = strlen (value) + 1;
+  const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
 
   LOCK;
 
@@ -156,37 +146,49 @@ setenv (name, value, replace)
          return -1;
        }
 
-      /* See whether the value is already known.  */
+      /* If the whole entry is given add it.  */
+      if (combined != NULL)
+       /* We must not add the string to the search tree since it belongs
+          to the user.  */
+       new_environ[size] = (char *) combined;
+      else
+       {
+         /* See whether the value is already known.  */
 #ifdef USE_TSEARCH
-      new_value = alloca (namelen + 1 + vallen);
+         new_value = (char *) alloca (namelen + 1 + vallen);
 # ifdef _LIBC
-      __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
-                value, vallen);
+         __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
+                    value, vallen);
 # else
-      memcpy (new_value, name, namelen);
-      new_value[namelen] = '=';
-      memcpy (&new_value[namelen + 1], value, vallen);
+         memcpy (new_value, name, namelen);
+         new_value[namelen] = '=';
+         memcpy (&new_value[namelen + 1], value, vallen);
 # endif
 
-      new_environ[size] = KNOWN_VALUE (new_value);
-      if (new_environ[size] == NULL)
-#endif
-       {
-         new_environ[size] = malloc (namelen + 1 + vallen);
+         new_environ[size] = KNOWN_VALUE (new_value);
          if (new_environ[size] == NULL)
+#endif
            {
-             __set_errno (ENOMEM);
-             UNLOCK;
-             return -1;
-           }
+             new_environ[size] = (char *) malloc (namelen + 1 + vallen);
+             if (new_environ[size] == NULL)
+               {
+                 __set_errno (ENOMEM);
+                 UNLOCK;
+                 return -1;
+               }
 
 #ifdef USE_TSEARCH
-         memcpy (new_environ[size], new_value, namelen + 1 + vallen);
+             memcpy (new_environ[size], new_value, namelen + 1 + vallen);
 #else
-         memcpy (new_environ[size], name, namelen);
-         new_environ[size][namelen] = '=';
-         memcpy (&new_environ[size][namelen + 1], value, vallen);
+             memcpy (new_environ[size], name, namelen);
+             new_environ[size][namelen] = '=';
+             memcpy (&new_environ[size][namelen + 1], value, vallen);
 #endif
+             /* And save the value now.  We cannot do this when we remove
+                the string since then we cannot decide whether it is a
+                user string or not.  */
+             STORE_VALUE (new_environ[size]);
+           }
        }
 
       if (__environ != last_environ)
@@ -199,43 +201,47 @@ setenv (name, value, replace)
     }
   else if (replace)
     {
-      char *new_value;
       char *np;
 
-      /* The existing string is too short; malloc a new one.  */
+      /* Use the user string if given.  */
+      if (combined != NULL)
+       np = (char *) combined;
+      else
+       {
 #ifdef USE_TSEARCH
-      new_value = alloca (namelen + 1 + vallen);
+         char *new_value = alloca (namelen + 1 + vallen);
 # ifdef _LIBC
-      __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
-                value, vallen);
+         __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
+                    value, vallen);
 # else
-      memcpy (new_value, name, namelen);
-      new_value[namelen] = '=';
-      memcpy (&new_value[namelen + 1], value, vallen);
+         memcpy (new_value, name, namelen);
+         new_value[namelen] = '=';
+         memcpy (&new_value[namelen + 1], value, vallen);
 # endif
 
-      np = KNOWN_VALUE (new_value);
-      if (np == NULL)
-#endif
-       {
-         np = malloc (namelen + 1 + vallen);
+         np = KNOWN_VALUE (new_value);
          if (np == NULL)
+#endif
            {
-             UNLOCK;
-             return -1;
-           }
+             np = malloc (namelen + 1 + vallen);
+             if (np == NULL)
+               {
+                 UNLOCK;
+                 return -1;
+               }
 
 #ifdef USE_TSEARCH
-         memcpy (np, new_value, namelen + 1 + vallen);
+             memcpy (np, new_value, namelen + 1 + vallen);
 #else
-         memcpy (np, name, namelen);
-         np[namelen] = '=';
-         memcpy (&np[namelen + 1], value, vallen);
+             memcpy (np, name, namelen);
+             np[namelen] = '=';
+             memcpy (&np[namelen + 1], value, vallen);
 #endif
+             /* And remember the value.  */
+             STORE_VALUE (np);
+           }
        }
 
-      /* Keep the old value around.  */
-      STORE_VALUE (*ep);
       *ep = np;
     }
 
@@ -244,6 +250,15 @@ setenv (name, value, replace)
   return 0;
 }
 
+int
+setenv (name, value, replace)
+     const char *name;
+     const char *value;
+     int replace;
+{
+  return __add_to_environ (name, value, NULL, replace);
+}
+
 void
 unsetenv (name)
      const char *name;
@@ -253,20 +268,20 @@ unsetenv (name)
 
   LOCK;
 
-  for (ep = __environ; *ep != NULL; ++ep)
+  ep = __environ;
+  while (*ep != NULL)
     if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
       {
        /* Found it.  Remove this pointer by moving later ones back.  */
        char **dp = ep;
 
-       /* Store the value so that we can reuse it later.  */
-       STORE_VALUE (*ep);
-
        do
          dp[0] = dp[1];
        while (*dp++);
        /* Continue the loop in case NAME appears again.  */
       }
+    else
+      ++ep;
 
   UNLOCK;
 }
@@ -281,12 +296,7 @@ clearenv ()
 
   if (__environ == last_environ && __environ != NULL)
     {
-      /* We allocated this environment so we can free it.  Store all the
-         strings.  */
-      char **ep = __environ;
-      while (*ep != NULL)
-       STORE_VALUE (*ep++);
-
+      /* We allocated this environment so we can free it.  */
       free (__environ);
       last_environ = NULL;
     }
index 8100b0d056e70d95481d3aeb12517f03ba29d200..d79087b80ac06218fdf80ad656b8303c2edd4138 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 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
 #include <features.h>
 
 /* Return number of configured processors.  */
-extern int __get_nprocs_conf __P ((void));
 extern int get_nprocs_conf __P ((void));
 
 /* Return number of available processors.  */
-extern int __get_nprocs __P ((void));
 extern int get_nprocs __P ((void));
 
 
 /* Return number of physical pages of memory in the system.  */
-extern int __get_phys_pages __P ((void));
 extern int get_phys_pages __P ((void));
 
 /* Return number of available physical pages of memory in the system.  */
-extern int __get_avphys_pages __P ((void));
 extern int get_avphys_pages __P ((void));
 
 #endif /* sys/sysinfo.h */
index 5f4f58a6db5a908da9976124804e4f93ba8907e6..44d6f8ba434a2fa7afe48c62c890eded3d6f8bca 100644 (file)
@@ -207,7 +207,7 @@ __memset_cc (void *__s, unsigned long int __pattern, size_t __n)
       return __s;
     case 3:
       __u->__usi = __pattern;
-      __u = __extension__ ((void *) __u + 1);
+      __u = __extension__ ((void *) __u + 2);
       __u->__uc = __pattern;
       return __s;
     case 4:
index 6b20482319fa0e221aa64e8fff5056d5a34a9eee..75b39e4884d84c201080b7ee7423115fa60a7e04 100644 (file)
@@ -311,8 +311,7 @@ ENTRY(__ieee754_pow)
        ret
 
 22:    fstp    %st(0)
-23:    popl    %eax
-       popl    %edx
+23:    addl    $8, %esp        // Don't use 2 x pop
 24:    fldl    MO(zero)
        ret
 
index 9ea41ba3c976f67196501918fee00632b22671c3..c023c11e65f9a86a8e38d6ee794a8d83fd014b5f 100644 (file)
@@ -303,7 +303,7 @@ ENTRY(__ieee754_powf)
        ret
 
 22:    fstp    %st(0)
-23:    popl    %eax
+23:    addl    $4, %esp        // Don't use pop.
 24:    fldl    MO(zero)
        ret
 
index e733e522c85923b85f6969b10a072cc512c521a4..769be4c1976d8fb7f7e944bc147ce7e43bc33370 100644 (file)
@@ -298,8 +298,7 @@ ENTRY(__ieee754_powl)
        ret
 
 22:    fstp    %st(0)
-23:    popl    %eax
-       popl    %edx
+23:    addl    $8, %esp        // Don't use 2 x pop
 24:    fldl    MO(zero)
        ret
 
index 104992450b79cde730b06e26b843db7eaecb8f84..1c45c8421bb6984dcb967c8554655099da1e300f 100644 (file)
@@ -1,50 +1,15 @@
-/* Implementation of gamma function according to ISO C.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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 <math.h>
-#include <math_private.h>
-
+#include <stdio.h>
+#include <errno.h>
 
 long double
 __ieee754_gammal_r (long double x, int *signgamp)
 {
-  /* We don't have a real gamma implementation now.  We'll use lgamma
-     and the exp function.  But due to the required boundary
-     conditions we must check some values separately.  */
-  u_int32_t es, hx, lx;
-
-  GET_LDOUBLE_WORDS (es, hx, lx, x);
-
-  if (((es & 0x7fff) | hx | lx) == 0)
-    {
-      /* Return value for x == 0 is NaN with invalid exception.  */
-      *signgamp = 0;
-      return x / x;
-    }
-  if ((hx & 0x8000) != 0 && (hx & 0x7fff) != 0x7fff && __rintl (x) == x)
-    {
-      /* Return value for integer x < 0 is NaN with invalid exception.  */
-      *signgamp = 0;
-      return (x - x) / (x - x);
-    }
-
-  /* XXX FIXME.  */
-  return __ieee754_expl (__ieee754_lgammal_r (x, signgamp));
+  *signgamp = 0;
+  fputs ("__ieee754_gammal_r not implemented\n", stderr);
+  __set_errno (ENOSYS);
+  return 0.0;
 }
+
+stub_warning (__ieee754_gammal_r)
+#include <stub-tag.h>
diff --git a/sysdeps/unix/sysv/linux/alpha/getsysstats.c b/sysdeps/unix/sysv/linux/alpha/getsysstats.c
new file mode 100644 (file)
index 0000000..8588903
--- /dev/null
@@ -0,0 +1,54 @@
+/* Determine various system internal values, Linux/Alpha version.
+   Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Schwab <schwab@suse.de>
+
+   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.  */
+
+
+/* We need to define a special parser for /proc/cpuinfo.  */
+#define GET_NPROCS_PARSER(FP, BUFFER, RESULT)                            \
+  do                                                                     \
+    {                                                                    \
+      (RESULT) = 0;                                                      \
+      /* Find the line that contains the information about the number of  \
+        active cpus.  We don't have to fear extremely long lines since   \
+        the kernel will not generate them.  8192 bytes are really        \
+        enough.  */                                                      \
+      while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL)       \
+       if (sscanf (BUFFER, "CPUs probed %*d active %d", &(RESULT)) == 1) \
+         break;                                                          \
+    }                                                                    \
+  while (0)
+
+
+/* On the Alpha we can distinguish between the number of configured and
+   active cpus.  */
+#define GET_NPROCS_CONF_PARSER(FP, BUFFER, RESULT)                      \
+  do                                                                    \
+    {                                                                   \
+      (RESULT) = 0;                                                     \
+      /* Find the line that contains the information about the number of \
+        probed cpus.  We don't have to fear extremely long lines since  \
+        the kernel will not generate them.  8192 bytes are really       \
+        enough.  */                                                     \
+      while (fgets_unlocked ((BUFFER), sizeof (BUFFER), (FP)) != NULL)  \
+       if (sscanf (buffer, "CPUs probed %d", &(RESULT)) == 1)           \
+         break;                                                         \
+    }                                                                   \
+  while (0)
+
+#include <sysdeps/unix/sysv/linux/getsysstats.c>
index 58f55ac99c51f7d6a7a987be100a7428b280effa..be23753d2ff161087689dc680045e3582786007f 100644 (file)
@@ -1,5 +1,5 @@
 /* Determine various system internal values, Linux 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 Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -67,6 +67,25 @@ get_proc_path (char *buffer, size_t bufsize)
 
    But not all systems have support for the /proc filesystem.  If it
    is not available we simply return 1 since there is no way.  */
+
+/* Other architectures use different formats for /proc/cpuinfo.  This
+   provides a hook for alternative parsers.  */
+#ifndef GET_NPROCS_PARSER
+# define GET_NPROCS_PARSER(FP, BUFFER, RESULT)                         \
+  do                                                                   \
+    {                                                                  \
+      (RESULT) = 0;                                                    \
+      /* Read all lines and count the lines starting with the string   \
+        "processor".  We don't have to fear extremely long lines since \
+        the kernel will not generate them.  8192 bytes are really      \
+        enough.  */                                                    \
+      while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL)     \
+       if (strncmp (BUFFER, "processor", 9) == 0)                      \
+         ++(RESULT);                                                   \
+    }                                                                  \
+  while (0)
+#endif
+
 int
 __get_nprocs ()
 {
@@ -89,15 +108,7 @@ __get_nprocs ()
       fp = fopen (proc_cpuinfo, "r");
       if (fp != NULL)
        {
-         result = 0;
-         /* Read all lines and count the lines starting with the
-            string "processor".  We don't have to fear extremely long
-            lines since the kernel will not generate them.  8192
-            bytes are really enough.  */
-         while (fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
-           if (strncmp (buffer, "processor", 9) == 0)
-             ++result;
-
+         GET_NPROCS_PARSER (fp, buffer, result);
          fclose (fp);
        }
     }
@@ -106,12 +117,46 @@ __get_nprocs ()
 }
 weak_alias (__get_nprocs, get_nprocs)
 
+
+#ifdef GET_NPROCS_CONF_PARSER
+/* On some architectures it is possible to distinguish between configured
+   and active cpus.  */
+int
+__get_nprocs_conf ()
+{
+  FILE *fp;
+  char buffer[8192];
+  char *proc_path;
+  int result = 1;
+
+  /* XXX Here will come a test for the new system call.  */
+
+  /* Get mount point of proc filesystem.  */
+  proc_path = get_proc_path (buffer, sizeof buffer);
+
+  /* If we haven't found an appropriate entry return 1.  */
+  if (proc_path != NULL)
+    {
+      char *proc_cpuinfo = alloca (strlen (proc_path) + sizeof ("/cpuinfo"));
+      __stpcpy (__stpcpy (proc_cpuinfo, proc_path), "/cpuinfo");
+
+      fp = fopen (proc_cpuinfo, "r");
+      if (fp != NULL)
+       {
+         GET_NPROCS_CONF_PARSER (fp, buffer, result);
+         fclose (fp);
+       }
+    }
+
+  return result;
+}
+#else
 /* As far as I know Linux has no separate numbers for configured and
    available processors.  So make the `get_nprocs_conf' function an
    alias.  */
 strong_alias (__get_nprocs, __get_nprocs_conf)
-weak_alias (__get_nprocs, get_nprocs_conf)
-
+#endif
+weak_alias (__get_nprocs_conf, get_nprocs_conf)
 
 /* General function to get information about memory status from proc
    filesystem.  */
index dc435d66512c3b59c5bd2b2a7ec63e5d3b4c4858..2c17cf2a69a8ac1d2b383a19834fb7b95a52c95d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 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
@@ -31,20 +31,16 @@ extern int sysinfo __P ((struct sysinfo *__info));
 
 
 /* Return number of configured processors.  */
-extern int __get_nprocs_conf __P ((void));
 extern int get_nprocs_conf __P ((void));
 
 /* Return number of available processors.  */
-extern int __get_nprocs __P ((void));
 extern int get_nprocs __P ((void));
 
 
 /* Return number of physical pages of memory in the system.  */
-extern int __get_phys_pages __P ((void));
 extern int get_phys_pages __P ((void));
 
 /* Return number of available physical pages of memory in the system.  */
-extern int __get_avphys_pages __P ((void));
 extern int get_avphys_pages __P ((void));
 
 __END_DECLS