]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
*** empty log message *** cvs/libc-960906
authorThomas Bushnell, BSG <thomas@gnu.org>
Fri, 6 Sep 1996 00:08:55 +0000 (00:08 +0000)
committerThomas Bushnell, BSG <thomas@gnu.org>
Fri, 6 Sep 1996 00:08:55 +0000 (00:08 +0000)
Thu Sep  5 13:18:25 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>

* sysdeps/mach/hurd/i386/init-first.c (__libc_argc, __libc_argv):
New variables.
(init1): Initialize them.
* hurd/hurdinit.c (_hurd_setproc): Now that happens to be
available, pass __libc_argv in call to __proc_set_arg_locations.

* gmon/gmon.c (write_hist): Call __profile_frequency instead of
hertz.
(hertz): Delete function.
* gmon/Makefile (routines): Add `prof-freq'.
* sysdeps/generic/prof-freq.c: New file.
* sysdeps/mach/hurd/prof-freq.c: New (stubby) file.
* sysdeps/mach/hurd/profil.c (profile_tick): New variable.
(update_waiter): Store frequency in profile_tick.
(__profile_frequency): New function.

* sysdeps/mach/hurd/sendto.c (sendto): Use prototype definition
syntax.

* Rules (generated): Restore reference to $(generated).

* mach/Machrules (mig.uh, mig.__h): Don't include $(user-MIGFLAGS)
here.

  * malloc/free.c (free): __lib_malloc_lock -> __libc_malloc_lock.

* malloc/free.c: Provide extern decl of __libc_malloc_lock.
* malloc/realloc.c: Likewise.
* malloc/malloc-find.c: Likewise.
* malloc/malloc-size.c: Likewise.
* malloc/malloc-walk.c: Likewise.
* malloc/memalign.c: Likewise.

   * mach/Machrules (mig.uh, mig.__h): Include $(user-MIGFLAGS) and

ChangeLog
Rules
gmon/Makefile
gmon/gmon.c
hurd/hurdinit.c
mach/Machrules
sysdeps/generic/prof-freq.c [new file with mode: 0644]
sysdeps/mach/hurd/i386/init-first.c
sysdeps/mach/hurd/prof-freq.c [new file with mode: 0644]
sysdeps/mach/hurd/profil.c
sysdeps/mach/hurd/sendto.c

index 086524d67007177f95d42abc93859ca4a47cb3d0..5169639b0e05fad79c58d5ef91abf41eb3659a01 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+Thu Sep  5 13:18:25 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
+
+       * sysdeps/mach/hurd/i386/init-first.c (__libc_argc, __libc_argv):
+       New variables.
+       (init1): Initialize them.
+       * hurd/hurdinit.c (_hurd_setproc): Now that happens to be
+       available, pass __libc_argv in call to __proc_set_arg_locations.
+
+       * gmon/gmon.c (write_hist): Call __profile_frequency instead of
+       hertz. 
+       (hertz): Delete function.
+       * gmon/Makefile (routines): Add `prof-freq'.
+       * sysdeps/generic/prof-freq.c: New file.
+       * sysdeps/mach/hurd/prof-freq.c: New (stubby) file.
+       * sysdeps/mach/hurd/profil.c (profile_tick): New variable.
+       (update_waiter): Store frequency in profile_tick.
+       (__profile_frequency): New function.
+
+       * sysdeps/mach/hurd/sendto.c (sendto): Use prototype definition
+       syntax.
+
+       * Rules (generated): Restore reference to $(generated).
+
+       * mach/Machrules (mig.uh, mig.__h): Don't include $(user-MIGFLAGS)
+       here. 
+
+       * malloc/free.c (free): __lib_malloc_lock -> __libc_malloc_lock.
+       
+       * malloc/free.c: Provide extern decl of __libc_malloc_lock.
+       * malloc/realloc.c: Likewise.
+       * malloc/malloc-find.c: Likewise.
+       * malloc/malloc-size.c: Likewise.
+       * malloc/malloc-walk.c: Likewise.
+       * malloc/memalign.c: Likewise.
+
 Thu Sep  5 03:20:42 1996  Ulrich Drepper  <drepper@cygnus.com>
 
        Change configuration and Makefiles to allow add-ons to have a
@@ -276,7 +311,7 @@ Thu Aug 29 12:00:30 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
        spelling error of _hurd_itimerval.
 
        * mach/Makefile (MIGFLAGS-mach/mach4): Define variable.
-       mach/Machrules (mig.uh, mig.__h): Include $(user-MIGFLAGS) and
+       mach/Machrules (mig.uh, mig.__h): Include $(user-MIGFLAGS) and
        $(MIGFLAGS-$*) here too, as well as in the code-generating MiG calls. 
        
        * hurd/hurdinline.c: Include "hurd.h" for function definitions too. 
diff --git a/Rules b/Rules
index 507ec45528b645521536798b79585dbbb94abc3f..89849679472cb7241f21a2bbbec976c9f9ec4536 100644 (file)
--- a/Rules
+++ b/Rules
@@ -136,7 +136,8 @@ subdir_dist: dist
 
 # Convenient target to update all the generated source files.
 .PHONY: generated
-generated: $(addprefix $(common-objpfx),$(common-generated))
+generated: $(addprefix $(common-objpfx),$(common-generated)) \
+       $(addprefix $(objpfx),$(generated))
 
 ifndef libc.so-version
 # Undefine this because it can't work when we libc.so is unversioned.
index adf6c92c1b459cbd2a9dabcd47866e228b36020b..eff18ee029ccc4e7aad9fc0906febb100ea0e48f 100644 (file)
@@ -23,7 +23,7 @@ subdir        := gmon
 
 headers        := sys/gmon.h sys/gmon_out.h
 distribute := machine-gmon.h profil-counter.h
-routines := gmon mcount profil bb_init_func bb_exit_func
+routines := gmon mcount profil bb_init_func bb_exit_func prof-freq
 
 include ../Rules
 
index a356c4cc47c03eed5083d836a757077e870694c1..a450d11365744f8c97f524d6278447380d6b72da 100644 (file)
@@ -57,27 +57,6 @@ static int   s_scale;
 
 #define ERR(s) write(2, s, sizeof(s) - 1)
 
-/*
- * Discover the tick frequency of the machine if something goes wrong,
- * we return 0, an impossible hertz.
- */
-static int
-DEFUN_VOID(hertz)
-{
-  struct itimerval tim;
-
-  tim.it_interval.tv_sec = 0;
-  tim.it_interval.tv_usec = 1;
-  tim.it_value.tv_sec = 0;
-  tim.it_value.tv_usec = 0;
-  setitimer(ITIMER_REAL, &tim, 0);
-  setitimer(ITIMER_REAL, 0, &tim);
-  if (tim.it_interval.tv_usec < 2)
-    return 0;
-  return (1000000 / tim.it_interval.tv_usec);
-}
-
-
 /*
  * Control profiling
  *     profiling is what mcount checks to see if
@@ -183,7 +162,7 @@ DEFUN(write_hist, (fd), int fd)
   if (_gmonparam.kcountsize > 0)
     {
       size = _gmonparam.kcountsize / sizeof(HISTCOUNTER);
-      rate = hertz();
+      rate = __profile_frequency();
       bcopy(&_gmonparam.lowpc, &thdr.low_pc, sizeof(thdr.low_pc));
       bcopy(&_gmonparam.highpc, &thdr.high_pc, sizeof(thdr.high_pc));
       bcopy(&size, &thdr.hist_size, sizeof(thdr.hist_size));
index 7d946b8bffd09c0811a1c12d794aaeb715e2eb9b..df10b5d955fafa2c9f2d8b499780f2d5690dbef9 100644 (file)
@@ -165,6 +165,7 @@ _hurd_setproc (process_t procserver)
 {
   error_t err;
   mach_port_t oldmsg;
+  extern char **__libc_argv;
 
   /* Give the proc server our message port.  */
   if (err = __proc_setmsgport (procserver, _hurd_msgport, &oldmsg))
@@ -175,8 +176,8 @@ _hurd_setproc (process_t procserver)
 
   /* Tell the proc server where our args and environment are.  */
   if (err = __proc_set_arg_locations (procserver,
-                                     /* We don't know the ARGV location.  */
-                                     (vm_address_t) 0,
+                                     _hide_arguments ? 0 :
+                                     (vm_address_t) __libc_argv,
                                      _hide_environment ? 0 :
                                      (vm_address_t) __environ))
     return err;
index 2cb3158bbd393bff91804ea07673941bf3a72cd9..47b74aa7b5f183c5a5fabccd24b8af978962a024 100644 (file)
@@ -149,14 +149,14 @@ $(objpfx)%.uh:; $(mig.uh)
 define mig.uh
 $(make-target-directory)
 $(include-%.defs) | \
-$(MIG) - /dev/null $(MIGFLAGS) $(user-MIGFLAGS) $(MIGFLAGS-$*) \
+$(MIG) - /dev/null $(MIGFLAGS) $(MIGFLAGS-$*) \
        -header $@ -server /dev/null -user /dev/null
 endef
 $(objpfx)%.__h:; $(mig.__h)
 define mig.__h
 $(make-target-directory)
 $(include-%.defs) | \
-$(MIG) - /dev/null $(MIGFLAGS) $(user-MIGFLAGS) $(MIGFLAGS-$*) -prefix __ \
+$(MIG) - /dev/null $(MIGFLAGS) $(MIGFLAGS-$*) -prefix __ \
        -header $@ -server /dev/null -user /dev/null
 endef
 
diff --git a/sysdeps/generic/prof-freq.c b/sysdeps/generic/prof-freq.c
new file mode 100644 (file)
index 0000000..4e952e7
--- /dev/null
@@ -0,0 +1,59 @@
+/* Return frequency of ticks reported by profil.  Generic version. */
+/*-
+ * Copyright (c) 1983, 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <sys/types.h>
+#include <sys/time.h>
+
+int
+__profile_frequency ()
+{
+  /*
+   * Discover the tick frequency of the machine if something goes wrong,
+   * we return 0, an impossible hertz.
+   */
+  struct itimerval tim;
+
+  tim.it_interval.tv_sec = 0;
+  tim.it_interval.tv_usec = 1;
+  tim.it_value.tv_sec = 0;
+  tim.it_value.tv_usec = 0;
+  setitimer(ITIMER_REAL, &tim, 0);
+  setitimer(ITIMER_REAL, 0, &tim);
+  if (tim.it_interval.tv_usec < 2)
+    return 0;
+  return (1000000 / tim.it_interval.tv_usec);
+}
+
+
index d095580cfd7cb268327abde832728cefb4a7b1a3..5203b4c146739c11817e1512cd7b0c730496fafd 100644 (file)
@@ -31,15 +31,16 @@ extern void __libc_global_ctors (void);
 
 int __libc_multiple_libcs = 1;
 
+int __libc_argc;
+char **__libc_argv;
+
 void *(*_cthread_init_routine) (void); /* Returns new SP to use.  */
 void (*_cthread_exit_routine) (int status) __attribute__ ((__noreturn__));
 
-
 /* Things that want to be run before _hurd_init or much anything else.
    Importantly, these are called before anything tries to use malloc.  */
 DEFINE_HOOK (_hurd_preinit_hook, (void));
 
-
 static void
 init1 (int argc, char *arg0, ...)
 {
@@ -47,6 +48,8 @@ init1 (int argc, char *arg0, ...)
   char **envp = &argv[argc + 1];
   struct hurd_startup_data *d;
 
+  __libc_argc = argc;
+  __libc_argv = argv;
   __environ = envp;
   while (*envp)
     ++envp;
diff --git a/sysdeps/mach/hurd/prof-freq.c b/sysdeps/mach/hurd/prof-freq.c
new file mode 100644 (file)
index 0000000..a370703
--- /dev/null
@@ -0,0 +1,2 @@
+/* __profile_frequency is in sysdeps/mach/hurd/profil.c.  This file
+is here as a place-holder to prevent the use of sysdeps/generic/prof-freq.c. */
index 431982e49897ec529403c1bd3b6a9060bc61ccc8..41c7c4b956c231dc9ce088d85a3584d1ad98ada6 100644 (file)
@@ -36,6 +36,7 @@ static size_t sample_scale;
 static sampled_pc_seqno_t seqno;
 static struct mutex lock = MUTEX_INITIALIZER;
 static mach_msg_timeout_t collector_timeout; /* ms between collections.  */
+static int profile_tick;
 
 /* Enable statistical profiling, writing samples of the PC into at most
    SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling
@@ -62,8 +63,7 @@ update_waiter (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
 
   if (! err)
     {
-      int tick;                        /* Microseconds per sample.  */
-      err = __task_enable_pc_sampling (__mach_task_self (), &tick,
+      err = __task_enable_pc_sampling (__mach_task_self (), &profile_tick,
                                       SAMPLED_PC_PERIODIC);
       if (!err && sample_scale == 0)
        /* Profiling was not turned on, so the collector thread was
@@ -79,13 +79,19 @@ update_waiter (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
             and the kernel buffer size we get the length of time it takes
             to fill the buffer; translate that to milliseconds for
             mach_msg, and chop it in half for general lag factor.  */
-         collector_timeout = MAX_PC_SAMPLES * tick / 1000 / 2;
+         collector_timeout = MAX_PC_SAMPLES * profile_tick / 1000 / 2;
        }
     }
 
   return err;
 }
 
+int
+__profile_frequency ()
+{
+  return profile_tick;
+}
+
 int
 profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
 {
index 88026b8cf54902b845933dc6a4e5f1a6aad5bbdd..1be2cbb6ec31c2c37b58b2d5a32332e8c38a05f5 100644 (file)
@@ -27,13 +27,12 @@ Cambridge, MA 02139, USA.  */
 /* Send N bytes of BUF on socket FD to peer at address ADDR (which is
    ADDR_LEN bytes long).  Returns the number sent, or -1 for errors.  */
 int
-sendto (fd, buf, n, flags, addr, addr_len)
-     int fd;
-     const void *buf;
-     size_t n;
-     int flags;
-     const struct sockaddr_un *addr;
-     size_t addr_len;
+sendto (int fd,
+       const void *buf,
+       size_t n,
+       int flags,
+       const struct sockaddr_un *addr,
+       size_t addr_len)
 {
   addr_port_t aport;
   error_t err;