summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/dl-osinfo.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-09 07:59:23 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-09 07:59:23 +0000
commitfc5f4a97487fffc7f5451d216f278d83a8259efe (patch)
tree0eb3a6efb5f6edc33aa21687390e3547d179f1b5 /sysdeps/unix/sysv/linux/dl-osinfo.h
parentd0e1a1221dff0e8e77cd5d39b980267a0ec92bfd (diff)
downloadglibc-fc5f4a97487fffc7f5451d216f278d83a8259efe.tar.gz
glibc-fc5f4a97487fffc7f5451d216f278d83a8259efe.tar.xz
glibc-fc5f4a97487fffc7f5451d216f278d83a8259efe.zip
Update.
2000-09-09  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/dl-osinfo.h (DL_SYSDEP_OSCHECK): Use uname
	before trying to read /proc.
	Patch by Matt Wilson <msw@redhat.com>.
	* include/sys/utsname.h: Declare __uname.
	* sysdeps/generic/uname.c: Make uname a weak alias of __uname.
	* sysdeps/mach/hurd/uname.c: Likewise.
	* sysdeps/unix/syscalls.list: Likewise.

	* iconv/gconv_dl.c (do_release_shlib): Rewrite condition for
	unloading a bit.

2000-09-08  Ulrich Drepper  <drepper@redhat.com>

	* posix/getopt.c (_getopt_internal): When long_only is set always
	recognize conflicts just like before.

2000-09-08  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>

	* sysdeps/ia64/Makefile (sysdep-rtld-routines): New variable.
Diffstat (limited to 'sysdeps/unix/sysv/linux/dl-osinfo.h')
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h30
1 files changed, 20 insertions, 10 deletions
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index 7fc0259ae4..a29d255f50 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -18,6 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <sys/sysctl.h>
+#include <sys/utsname.h>
 #include "kernel-features.h"
 
 #ifndef MIN
@@ -61,16 +62,25 @@ dl_fatal (const char *str)
 		      sizeof (sysctl_args) / sizeof (sysctl_args[0]),	      \
 		      buf, &reslen, NULL, 0) < 0)			      \
 	  {								      \
-	    /* This was not successful.  Now try reading the /proc	      \
-	       filesystem.  */						      \
-	    int fd = __open ("/proc/sys/kernel/osrelease", O_RDONLY);	      \
-	    if (fd == -1						      \
-		|| (reslen = __read (fd, buf, sizeof (buf))) <= 0)	      \
-	      /* This also didn't work.  We give up since we cannot	      \
-		 make sure the library can actually work.  */		      \
-	      FATAL ("FATAL: cannot determine library version\n");	      \
-									      \
-	    __close (fd);						      \
+	    /* This didn't work.  Next try the uname syscall */		      \
+	    struct utsname uts;						      \
+	    if (__uname (&uts))					      	      \
+	      {							      	      \
+	        /* This was not successful.  Now try reading the /proc	      \
+	           filesystem.  */					      \
+	        int fd = __open ("/proc/sys/kernel/osrelease", O_RDONLY);     \
+	        if (fd == -1						      \
+		    || (reslen = __read (fd, buf, sizeof (buf))) <= 0)	      \
+  	      	  /* This also didn't work.  We give up since we cannot       \
+		     make sure the library can actually work.  */	      \
+	          FATAL ("FATAL: cannot determine library version\n");        \
+	        __close (fd);						      \
+	      }								      \
+	    else							      \
+	      {							      	      \
+                strncpy (buf, uts.release, sizeof (buf));		      \
+                reslen = strlen (uts.release);				      \
+	      }								      \
 	  }								      \
 	buf[MIN (reslen, sizeof (buf) - 1)] = '\0';			      \
 									      \