summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-11-07 15:36:04 +0000
committerJim Meyering <jim@meyering.net>2000-11-07 15:36:04 +0000
commitb1f0cff32aae2ef1e054fe9feadcb851d9ff8489 (patch)
tree8ea1f6460ceb7dcc5c6de173fdd21f776a75ff5c
parent07e154060a216643534688cfe908a55fa8e43906 (diff)
downloadgnulib-b1f0cff32aae2ef1e054fe9feadcb851d9ff8489.tar.gz
.
-rw-r--r--lib/tru-knlist-demo.c70
1 files changed, 0 insertions, 70 deletions
diff --git a/lib/tru-knlist-demo.c b/lib/tru-knlist-demo.c
deleted file mode 100644
index 1fa65aa8db..0000000000
--- a/lib/tru-knlist-demo.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Derived from the example in the OSF1 knlist manpage.
- OSF1 spe154.testdrive.compaq.com V5.0 1094 alpha
- aka (w/my private hostname compaq-tru64-50a) */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <nlist.h>
-
-#ifndef FD_CLOEXEC
-# define FD_CLOEXEC 1
-#endif
-
-#ifndef LDAV_SYMBOL
-# define LDAV_SYMBOL "_avenrun"
-#endif
-
-int
-main ()
-{
- struct nlist nl[2];
- int retval;
- long offset;
-
- nl[0].n_name = LDAV_SYMBOL;
- nl[1].n_name = "";
-
- /*******************************************************/
- /* Call the knlist routine */
- retval = knlist (nl);
-
- /******************************************************/
- /* Display addresses if returned. Otherwise, display */
- /* the appropriate error message. */
- if (retval < 0)
- {
- printf ("No kernel symbol addresses returned.\n");
- exit (1);
- }
-
- if (nl[0].n_type == 0)
- {
- printf ("Unable to return address of symbol %s\n", nl[0].n_name);
- exit (1);
- }
-
- offset = nl[0].n_value;
- printf ("The address of symbol %s is %lx\n", nl[0].n_name, offset);
-
- {
- double load_ave[3];
- int channel = open ("/dev/kmem", 0);
- if (channel < 0)
- {
- printf ("open failed\n");
- exit (1);
- }
-#ifdef FD_SETFD
- (void) fcntl (channel, F_SETFD, FD_CLOEXEC);
-#endif
-
- if (lseek (channel, offset, 0) == -1L
- || read (channel, (char *) load_ave, sizeof (load_ave))
- != sizeof (load_ave))
- {
- close (channel);
- }
- }
-
- exit (0);
-}