about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/uname.c5
-rw-r--r--sysdeps/mach/hurd/uname.c5
-rw-r--r--sysdeps/unix/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h30
4 files changed, 27 insertions, 15 deletions
diff --git a/sysdeps/generic/uname.c b/sysdeps/generic/uname.c
index 68335c21f9..aacb5f3df0 100644
--- a/sysdeps/generic/uname.c
+++ b/sysdeps/generic/uname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1997, 2000 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
@@ -26,7 +26,7 @@
 
 /* Put information about the system in NAME.  */
 int
-uname (name)
+__uname (name)
      struct utsname *name;
 {
   int save;
@@ -61,3 +61,4 @@ uname (name)
 
   return 0;
 }
+weak_alias (__uname, uname)
diff --git a/sysdeps/mach/hurd/uname.c b/sysdeps/mach/hurd/uname.c
index 37e4b4e57d..316ecf3e6b 100644
--- a/sysdeps/mach/hurd/uname.c
+++ b/sysdeps/mach/hurd/uname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1993,1994,1996,1997,2000 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
@@ -22,7 +22,7 @@
 #include <hurd/startup.h>
 
 int
-uname (struct utsname *uname)
+__uname (struct utsname *uname)
 {
   error_t err;
 
@@ -43,3 +43,4 @@ uname (struct utsname *uname)
 
   return 0;
 }
+weak_alias (__uname, uname)
diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index 0ac0ac94c1..3c60597329 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -58,7 +58,7 @@ sys_fstat	fxstat	fstat		i:ip	__syscall_fstat
 sys_mknod	xmknod	mknod		i:sii	__syscall_mknod
 sys_stat	xstat	stat		i:sp	__syscall_stat
 umask		-	umask		i:i	__umask		umask
-uname		-	uname		i:p	uname
+uname		-	uname		i:p	__uname		uname
 unlink		-	unlink		i:s	__unlink	unlink
 utimes		-	utimes		i:sp	__utimes	utimes
 write		-	write		i:ibn	__libc_write	__write write
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';			      \
 									      \