about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--elf/dl-open.c2
-rw-r--r--elf/dl-version.c56
-rw-r--r--elf/rtld.c4
-rw-r--r--linuxthreads/ChangeLog3
-rw-r--r--linuxthreads/pthread.c20
-rw-r--r--linuxthreads/spinlock.c4
-rw-r--r--manual/users.texi33
-rw-r--r--posix/sys/wait.h2
-rw-r--r--stdlib/stdlib.h2
-rw-r--r--sysdeps/generic/ldsodefs.h6
11 files changed, 109 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 8590979b12..e1136d77d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2000-04-15  Ulrich Drepper  <drepper@redhat.com>
 
+	* elf/dl-version.c (_dl_check_map_versions): New argument trace_mode.
+	Before testing versions check that we actually loaded the object
+	and whether we are in trace mode.  If not loaded during tracing don't
+	test versions in this object.
+	(_dl_check_all_versions): Take new parameter and pass to
+	_dl_check_map_versions.
+	* sysdeps/generic/ldsodefs.h: Update prototypes for
+	_dl_check_all_versions and _dl_check_map_versions.
+	* elf/rtld.c (struct version_check_args): Add dotrace.
+	(version_check_doit): Pass args->dotrace to _dl_check_all_versions.
+	(dl_main): Pass info about trace mode to version_check_doit.
+	* elf/dl-open.c (dl_open_worker): Pass zero as new argument to
+	_dl_check_all_versions.
+
+	* manual/users.texi (XPG Functions): Document utmpxname, getutmp,
+	and getutmpx.
+	Patch by Bryan Henderson <bryanh@giraffe-data.com>.
+
 	* manual/argp.texi: Document index parameter of argp_parse.
 	Fix typo.
 	Reported by Andrew Schulman <SCHULMAN.ANDREW@epamail.epa.gov>.
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 15ed24fff2..94677590fe 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -147,7 +147,7 @@ dl_open_worker (void *a)
   _dl_map_object_deps (new, NULL, 0, 0);
 
   /* So far, so good.  Now check the versions.  */
-  (void) _dl_check_all_versions (new, 0);
+  (void) _dl_check_all_versions (new, 0, 0);
 
 #ifdef SCOPE_DEBUG
   show_scope (new);
diff --git a/elf/dl-version.c b/elf/dl-version.c
index 59e8dd33c8..94eaed88b2 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -160,7 +160,7 @@ no version information available (required by ",
 
 int
 internal_function
-_dl_check_map_versions (struct link_map *map, int verbose)
+_dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
 {
   int result = 0;
   const char *strtab;
@@ -209,29 +209,34 @@ _dl_check_map_versions (struct link_map *map, int verbose)
 	     and no stub entry was created.  This should never happen.  */
 	  assert (needed != NULL);
 
-	  /* NEEDED is the map for the file we need.  Now look for the
-	     dependency symbols.  */
-	  aux = (ElfW(Vernaux) *) ((char *) ent + ent->vn_aux);
-	  while (1)
+	  /* Make sure this is no stub we created because of a missing
+	     dependency.  */
+	  if (! trace_mode || needed->l_opencount != 0)
 	    {
-	      /* Match the symbol.  */
-	      result |= match_symbol ((*map->l_name
-				       ? map->l_name : _dl_argv[0]),
-				      aux->vna_hash,
-				      strtab + aux->vna_name,
-				      needed, verbose,
-				      aux->vna_flags & VER_FLG_WEAK);
-
-	      /* Compare the version index.  */
-	      if ((unsigned int) (aux->vna_other & 0x7fff) > ndx_high)
-		ndx_high = aux->vna_other & 0x7fff;
-
-	      if (aux->vna_next == 0)
-		/* No more symbols.  */
-		break;
-
-	      /* Next symbol.  */
-	      aux = (ElfW(Vernaux) *) ((char *) aux + aux->vna_next);
+	      /* NEEDED is the map for the file we need.  Now look for the
+		 dependency symbols.  */
+	      aux = (ElfW(Vernaux) *) ((char *) ent + ent->vn_aux);
+	      while (1)
+		{
+		  /* Match the symbol.  */
+		  result |= match_symbol ((*map->l_name
+					   ? map->l_name : _dl_argv[0]),
+					  aux->vna_hash,
+					  strtab + aux->vna_name,
+					  needed, verbose,
+					  aux->vna_flags & VER_FLG_WEAK);
+
+		  /* Compare the version index.  */
+		  if ((unsigned int) (aux->vna_other & 0x7fff) > ndx_high)
+		    ndx_high = aux->vna_other & 0x7fff;
+
+		  if (aux->vna_next == 0)
+		    /* No more symbols.  */
+		    break;
+
+		  /* Next symbol.  */
+		  aux = (ElfW(Vernaux) *) ((char *) aux + aux->vna_next);
+		}
 	    }
 
 	  if (ent->vn_next == 0)
@@ -356,13 +361,14 @@ _dl_check_map_versions (struct link_map *map, int verbose)
 
 int
 internal_function
-_dl_check_all_versions (struct link_map *map, int verbose)
+_dl_check_all_versions (struct link_map *map, int verbose, int trace_mode)
 {
   struct link_map *l;
   int result = 0;
 
   for (l = map; l != NULL; l = l->l_next)
-    result |= l->l_opencount != 0 && _dl_check_map_versions (l, verbose);
+    result |= (l->l_opencount != 0
+	       && _dl_check_map_versions (l, verbose, trace_mode));
 
   return result;
 }
diff --git a/elf/rtld.c b/elf/rtld.c
index 24968f87cd..7e960348f0 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -283,6 +283,7 @@ struct map_args
 struct version_check_args
 {
   int doexit;
+  int dotrace;
 };
 
 static void
@@ -305,7 +306,7 @@ static void
 version_check_doit (void *a)
 {
   struct version_check_args *args = (struct version_check_args *) a;
-  if (_dl_check_all_versions (_dl_loaded, 1) && args->doexit)
+  if (_dl_check_all_versions (_dl_loaded, 1, args->dotrace) && args->doexit)
     /* We cannot start the application.  Abort now.  */
     _exit (1);
 }
@@ -842,6 +843,7 @@ of this helper program; chances are you did not intend to run this program.\n\
   {
     struct version_check_args args;
     args.doexit = mode == normal;
+    args.dotrace = mode == trace;
     _dl_receive_error (print_missing_version, version_check_doit, &args);
   }
 
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 0530c63506..f9a3bf9240 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,5 +1,8 @@
 2000-04-15  Ulrich Drepper  <drepper@redhat.com>
 
+	* pthread.c (pthread_initialize): Avoid a bit more code if
+	realtime signals are known to exist.
+
 	* pthread.c: Is __ASSUME_REALTIME_SIGNALS then avoid generating code
 	to dynamically detect RT signals and avoid generating compatibility
 	functions with old kernel.
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 3ceb33562e..eca90635b0 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -369,10 +369,12 @@ static void pthread_initialize(void)
 #ifndef __i386__
   sa.sa_handler = pthread_handle_sigrestart;
 #else
-  if (__pthread_sig_restart >= SIGRTMIN)
-    sa.sa_handler = (__sighandler_t) pthread_handle_sigrestart_rt;
-  else
+# if !__ASSUME_REALTIME_SIGNALS
+  if (__pthread_sig_restart < SIGRTMIN)
     sa.sa_handler = (__sighandler_t) pthread_handle_sigrestart_nonrt;
+  else
+# endif
+    sa.sa_handler = (__sighandler_t) pthread_handle_sigrestart_rt;
 #endif
   sigemptyset(&sa.sa_mask);
   sa.sa_flags = 0;
@@ -380,10 +382,12 @@ static void pthread_initialize(void)
 #ifndef __i386__
   sa.sa_handler = pthread_handle_sigcancel;
 #else
-  if (__pthread_sig_restart >= SIGRTMIN)
-    sa.sa_handler = (__sighandler_t) pthread_handle_sigcancel_rt;
-  else
+# if !__ASSUME_REALTIME_SIGNALS
+  if (__pthread_sig_restart < SIGRTMIN)
     sa.sa_handler = (__sighandler_t) pthread_handle_sigcancel_nonrt;
+  else
+# endif
+    sa.sa_handler = (__sighandler_t) pthread_handle_sigcancel_rt;
 #endif
   sa.sa_flags = 0;
   __sigaction(__pthread_sig_cancel, &sa, NULL);
@@ -664,11 +668,13 @@ static void pthread_handle_sigrestart(int sig)
 }
 
 #ifdef __i386__
+# if !__ASSUME_REALTIME_SIGNALS
 static void pthread_handle_sigrestart_nonrt(int sig, struct sigcontext ctx)
 {
   asm volatile ("movw %w0,%%gs" : : "r" (ctx.gs));
   pthread_handle_sigrestart(sig);
 }
+# endif
 
 static void pthread_handle_sigrestart_rt(int sig, struct siginfo *si,
 					 struct ucontext *uc)
@@ -713,11 +719,13 @@ static void pthread_handle_sigcancel(int sig)
 }
 
 #ifdef __i386__
+# if !__ASSUME_REALTIME_SIGNALS
 static void pthread_handle_sigcancel_nonrt(int sig, struct sigcontext ctx)
 {
   asm volatile ("movw %w0,%%gs" : : "r" (ctx.gs));
   pthread_handle_sigcancel(sig);
 }
+# endif
 
 static void pthread_handle_sigcancel_rt(int sig, struct siginfo *si,
 					 struct ucontext *uc)
diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c
index ac94001bda..d13cea18c7 100644
--- a/linuxthreads/spinlock.c
+++ b/linuxthreads/spinlock.c
@@ -56,7 +56,7 @@ void internal_function __pthread_lock(pthread_spinlock_t * lock,
       THREAD_SETMEM(self, p_nextlock, (pthread_descr) oldstatus);
       /* Make sure the store in p_nextlock completes before performing
          the compare-and-swap */
-      WRITE_MEMORY_BARRIER();
+      MEMORY_BARRIER();
     }
   } while(! compare_and_swap(&lock->__status, oldstatus, newstatus,
                              &lock->__spinlock));
@@ -144,7 +144,7 @@ again:
   }
   /* Prevent reordering of store to *maxptr above and store to thr->p_nextlock
      below */
-  MEMORY_BARRIER();
+  WRITE_MEMORY_BARRIER();
   /* Wake up the selected waiting thread */
   thr->p_nextlock = NULL;
   restart(thr);
diff --git a/manual/users.texi b/manual/users.texi
index efe0b530ad..64bf153f83 100644
--- a/manual/users.texi
+++ b/manual/users.texi
@@ -1322,12 +1322,41 @@ for @code{getutline}.
 @comment utmpx.h
 @comment XPG4.2
 @deftypefun {struct utmpx *} pututxline (const struct utmpx *@var{utmp})
-The @code{pututxline} function provides functionality identical to
+The @code{pututxline} function is functionally identical to
 @code{pututline}, but uses @code{struct utmpx} instead of @code{struct
-utmp}.  On the GNU system @code{pututxline} is simply an alias for
+utmp}.  On the GNU system, @code{pututxline} is simply an alias for
 @code{pututline}.
 @end deftypefun
 
+@comment utmpx.h
+@comment XPG4.2
+@deftypefun int utmpxname (const char *@var{file})
+The @code{utmpxname} function is functionally identical to
+@code{utmpname}.  On the GNU system, @code{utmpxname} is simply an
+alias for @code{utmpname}.
+@end deftypefun
+
+You can translate between a traditional @code{struct utmp} and an XPG
+@code{struct utmpx} with the following functions.  On the GNU system,
+these functions are merely copies, since the two structures are
+identical.
+
+@comment utmpx.h
+@comment utmp.h
+@comment GNU
+@deftypefun int getutmp (const struct utmpx *utmpx, struct utmp *utmp)
+@code{getutmp} copies the information, insofar as the structures are
+compatible, from @var{utmpx} to @var{utmp}.
+@end deftypefun
+
+@comment utmpx.h
+@comment utmp.h
+@comment GNU
+@deftypefun int getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
+@code{getutmpx} copies the information, insofar as the structures are
+compatible, from @var{utmp} to @var{utmpx}.
+@end deftypefun
+
 
 @node Logging In and Out
 @subsection Logging In and Out
diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index 81b0eb429d..44f47ad24e 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -59,7 +59,7 @@ typedef __pid_t pid_t;
    the actual function definitions.  */
 
 #  if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus
-#   define __WAIT_STATUS		void *
+#   define __WAIT_STATUS	void *
 #   define __WAIT_STATUS_DEFN	void *
 #  else
 /* This works in GCC 2.6.1 and later.  */
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 59b5a69877..bdf618f152 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -76,7 +76,7 @@ typedef union
 # else /* Don't use BSD.  */
 
 #  define __WAIT_INT(status)	(status)
-#  define __WAIT_STATUS	int *
+#  define __WAIT_STATUS		int *
 #  define __WAIT_STATUS_DEFN	int *
 
 # endif /* Use BSD.  */
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 757a5bc0d9..3c6fbcbfd5 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -346,12 +346,14 @@ extern void _dl_reloc_bad_type (struct link_map *map,
 
 /* Check the version dependencies of all objects available through
    MAP.  If VERBOSE print some more diagnostics.  */
-extern int _dl_check_all_versions (struct link_map *map, int verbose)
+extern int _dl_check_all_versions (struct link_map *map, int verbose,
+				   int trace_mode)
      internal_function;
 
 /* Check the version dependencies for MAP.  If VERBOSE print some more
    diagnostics.  */
-extern int _dl_check_map_versions (struct link_map *map, int verbose)
+extern int _dl_check_map_versions (struct link_map *map, int verbose,
+				   int trace_mode)
      internal_function;
 
 /* Initialize the object in SCOPE by calling the constructors with