OSDN Git Service

Reduce dependancies -- don't use sysconf() internal to libc.
authorEric Andersen <andersen@codepoet.org>
Mon, 15 Jan 2001 13:23:33 +0000 (13:23 -0000)
committerEric Andersen <andersen@codepoet.org>
Mon, 15 Jan 2001 13:23:33 +0000 (13:23 -0000)
libc/misc/time/clock.c
libc/stdlib/malloc/malloc.c

index 4d1a178..139d358 100644 (file)
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/times.h>
 #include <time.h>
 #include <unistd.h>
+#include <sys/times.h>
 
 /* Return the time used by the program so far (user time + system time).  */
 clock_t
 clock (void)
 {
   struct tms buf;
-  long clk_tck = sysconf (_SC_CLK_TCK);
+  long clk_tck = CLK_TCK;
 
   /* We don't check for errors here.  The only error the kernel
      returns is EFAULT if the value cannot be written to the struct we
@@ -37,9 +37,7 @@ clock (void)
   times (&buf);
 
   return
-    (clk_tck <= CLOCKS_PER_SEC)
-    ? ((unsigned long) buf.tms_utime + buf.tms_stime) * (CLOCKS_PER_SEC
-                                                        / clk_tck)
-    : ((unsigned long) buf.tms_utime + buf.tms_stime) / (clk_tck
-                                                        / CLOCKS_PER_SEC);
+      (clk_tck <= CLOCKS_PER_SEC) ? 
+      ((unsigned long) buf.tms_utime + buf.tms_stime) * (CLOCKS_PER_SEC / clk_tck) : 
+      ((unsigned long) buf.tms_utime + buf.tms_stime) / (clk_tck / CLOCKS_PER_SEC);
 }
index b959d93..5131fb7 100644 (file)
@@ -134,45 +134,7 @@ int __malloc_initialized = -1;
 #endif
 
 /* guess pagesize */
-#ifndef M_PAGESIZE
-#ifdef _SC_PAGESIZE
-#ifndef _SC_PAGE_SIZE
-#define _SC_PAGE_SIZE _SC_PAGESIZE
-#endif
-#endif
-#ifdef _SC_PAGE_SIZE
-#define M_PAGESIZE sysconf(_SC_PAGE_SIZE)
-#else                                                  /* !_SC_PAGESIZE */
-#if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
-extern size_t getpagesize();
-
 #define M_PAGESIZE getpagesize()
-#else                                                  /* !HAVE_GETPAGESIZE */
-#include <sys/param.h>
-#ifdef EXEC_PAGESIZE
-#define M_PAGESIZE EXEC_PAGESIZE
-#else                                                  /* !EXEC_PAGESIZE */
-#ifdef NBPG
-#ifndef CLSIZE
-#define M_PAGESIZE NBPG
-#else                                                  /* !CLSIZE */
-#define M_PAGESIZE (NBPG*CLSIZE)
-#endif                                                 /* CLSIZE */
-#else
-#ifdef NBPC
-#define M_PAGESIZE NBPC
-#else                                                  /* !NBPC */
-#ifdef PAGESIZE
-#define M_PAGESIZE PAGESIZE
-#else                                                  /* !PAGESIZE */
-#define M_PAGESIZE 4096
-#endif                                                 /* PAGESIZE */
-#endif                                                 /* NBPC */
-#endif                                                 /* NBPG */
-#endif                                                 /* EXEC_PAGESIZE */
-#endif                                                 /* HAVE_GETPAGESIZE */
-#endif                                                 /* _SC_PAGE_SIZE */
-#endif                                                 /* defined(M_PAGESIZE) */
 
 /* HUNK MANAGER */