about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/ftime.c13
-rw-r--r--sysdeps/generic/setfpucw.c5
-rw-r--r--sysdeps/i386/fpu_control.h4
-rw-r--r--sysdeps/m68k/dl-machine.h2
-rw-r--r--sysdeps/posix/gettimeofday.c21
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c31
6 files changed, 48 insertions, 28 deletions
diff --git a/sysdeps/generic/ftime.c b/sysdeps/generic/ftime.c
index 76e9276483..600e959245 100644
--- a/sysdeps/generic/ftime.c
+++ b/sysdeps/generic/ftime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1996 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
@@ -25,19 +25,18 @@ ftime (timebuf)
      struct timeb *timebuf;
 {
   int save = errno;
-  struct tm *tp;
+  struct tm tp;
 
   errno = 0;
   if (time (&timebuf->time) == (time_t) -1 && errno != 0)
     return -1;
   timebuf->millitm = 0;
-  
-  tp = localtime (&timebuf->time);
-  if (tp == NULL)
+
+  if (__localtime_r (&timebuf->time, &tp) == NULL)
     return -1;
 
-  timebuf->timezone = tp->tm_gmtoff / 60;
-  timebuf->dstflag = tp->tm_isdst;
+  timebuf->timezone = tp.tm_gmtoff / 60;
+  timebuf->dstflag = tp.tm_isdst;
 
   errno = save;
   return 0;
diff --git a/sysdeps/generic/setfpucw.c b/sysdeps/generic/setfpucw.c
index 7b09a68b55..5654c942b0 100644
--- a/sysdeps/generic/setfpucw.c
+++ b/sysdeps/generic/setfpucw.c
@@ -29,5 +29,8 @@ __setfpucw (fpu_control_t set)
 
   /* Preserve the reserved bits, and set the rest as the user
      specified (or the default, if the user gave zero).  */
-  _FPU_SETCW ((cw & _FPU_RESERVED) | (set & ~_FPU_RESERVED));
+  cw &= _FPU_RESERVED;
+  cw |= set & ~_FPU_RESERVED;
+
+  _FPU_SETCW (cw);
 }
diff --git a/sysdeps/i386/fpu_control.h b/sysdeps/i386/fpu_control.h
index 706dea3d6d..7944b1a5ee 100644
--- a/sysdeps/i386/fpu_control.h
+++ b/sysdeps/i386/fpu_control.h
@@ -89,8 +89,8 @@ Boston, MA 02111-1307, USA.  */
 typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
 
 /* Macros for accessing the hardware control word.  */
-#define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (cw))
-#define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (cw))
+#define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw))
+#define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw))
 
 /* Default control word set at startup.  */
 extern fpu_control_t __fpu_control;
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index f36b9ce2f4..8b9872c15a 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -175,7 +175,7 @@ _dl_start_user:
 	| Loop to call _dl_init_next for the next initializer.
 	jra 0b
 1:	| Clear the startup flag.
-	move.l #0, _dl_starting_up@GOT(%a5)
+	clr.l _dl_starting_up@GOT(%a5)
 	| Pass our finalizer function to the user in %a1.
 	move.l _dl_fini@GOT(%a5), %a1
 	| Initialize %fp with the stack pointer.
diff --git a/sysdeps/posix/gettimeofday.c b/sysdeps/posix/gettimeofday.c
index a4bb38a41c..c3b8108258 100644
--- a/sysdeps/posix/gettimeofday.c
+++ b/sysdeps/posix/gettimeofday.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96 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
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <time.h>
 #include <sys/time.h>
@@ -32,8 +31,9 @@ Cambridge, MA 02139, USA.  */
    putting it into *TV and *TZ.  If TZ is NULL, *TZ is not filled.
    Returns 0 on success, -1 on errors.  */
 int
-DEFUN(__gettimeofday, (tv, tz),
-      struct timeval *tv AND struct timezone *tz)
+__gettimeofday (tv, tz)
+     struct timeval *tv;
+     struct timezone *tz;
 {
   if (tv == NULL)
     {
@@ -46,16 +46,17 @@ DEFUN(__gettimeofday, (tv, tz),
 
   if (tz != NULL)
     {
-      CONST time_t timer = tv->tv_sec;
-      CONST struct tm *tm;
+      const time_t timer = tv->tv_sec;
+      struct tm tm;
+      const struct tm *tmp;
 
-      CONST long int save_timezone = __timezone;
-      CONST long int save_daylight = __daylight;
+      const long int save_timezone = __timezone;
+      const long int save_daylight = __daylight;
       char *save_tzname[2];
       save_tzname[0] = __tzname[0];
       save_tzname[1] = __tzname[1];
 
-      tm = localtime (&timer);
+      tmp = localtime (&timer, &tm);
 
       tz->tz_minuteswest = __timezone / 60;
       tz->tz_dsttime = __daylight;
@@ -65,7 +66,7 @@ DEFUN(__gettimeofday, (tv, tz),
       __tzname[0] = save_tzname[0];
       __tzname[1] = save_tzname[1];
 
-      if (tm == NULL)
+      if (tmp == NULL)
 	return -1;
     }
 
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index feff028a28..ae163bcd49 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -36,21 +36,30 @@ weak_extern (_dl_starting_up)
    used in the process.  Safe assumption if initializer never runs.  */
 int __libc_multiple_libcs = 1;
 
+/* Remember the command line argument and enviroment contents for
+   later calls of initializers for dynamic libraries.  */
+int __libc_argc;
+char **__libc_argv;
+char **__libc_envp;
+
+
 static void
 init (void *data)
 {
   extern int __personality (int);
 
-  int argc = *(long *)data;
-  char **argv = (char **)data + 1;
-  char **envp = &argv[argc + 1];
-
-
   __libc_multiple_libcs = &_dl_starting_up && ! _dl_starting_up;
 
+
   /* We must not call `personality' twice.  */
   if (!__libc_multiple_libcs)
     {
+      /* The argument we got points to the values describing the
+	 command line argument etc.  */
+      __libc_argc = *(int *)data;
+      __libc_argv = (char **)data + 1;
+      __libc_envp = &__libc_argv[__libc_argc + 1];
+
       /* The `personality' system call takes one argument that chooses
 	 the "personality", i.e. the set of system calls and such.  We
 	 must make this call first thing to disable emulation of some
@@ -61,9 +70,17 @@ init (void *data)
       /* Set the FPU control word to the proper default value.  */
       __setfpucw (__fpu_control);
     }
+  else
+    {
+      /* The argument we got points to the values describing the
+	 command line argument etc.  */
+      __libc_argc = *((int *)data)++;
+      __libc_argv = *((char ***)data)++;
+      __libc_envp = *(char ***)data;
+    }
 
-  __environ = envp;
-  __libc_init (argc, argv, envp);
+  __environ = __libc_envp;
+  __libc_init (__libc_argc, __libc_argv, __libc_envp);
 
 #ifdef PIC
   __libc_global_ctors ();