summaryrefslogtreecommitdiff
path: root/parallel/glunix/patches/patch-al
blob: 448afdb19a630559c75048ef0d2afcdf68b7b840 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$NetBSD: patch-al,v 1.2 2005/05/29 14:38:33 wiz Exp $

--- glunix/src/nmgt/dnmgt.cc.orig	1997-09-18 21:05:03.000000000 +0200
+++ glunix/src/nmgt/dnmgt.cc
@@ -138,10 +138,14 @@
 #define __THIS_MODULE MODULE_NMGT
 
 #include <signal.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
+
+#ifndef __NetBSD__
 #include <sys/processor.h>
+#endif
 
 #include "glib/types.h"
 #include "cdebug.h"
@@ -200,6 +204,27 @@ Nmgt_IncomingWelcome(int callbackValue, 
 Bool
 Nmgt_GetMachineInfo(MsgNmgt_Hello *hello)
 {
+#ifdef __NetBSD__
+
+  FILE *file;
+  int *psize, *phys;
+  int one,two;
+
+  psize = &one;
+  phys = &two;
+
+  hello->machDesc.numProcessors = 1; /* hardcoded cuz I know better */
+  file = fopen("/kern/pagesize","r");
+  fscanf(file,"%d",psize);
+  fclose(file);
+  file = fopen("/kern/physmem","r");
+  fscanf(file,"%d",phys);
+  fclose(file);
+  hello->machDesc.totalMegs = one * two;
+  hello->machDesc.mhz = 100; /* this is a hack XXX */
+
+#else
+
     processor_info_t  info;
 
     ASSERT(hello != NULL);
@@ -216,7 +241,7 @@ Nmgt_GetMachineInfo(MsgNmgt_Hello *hello
     }
 
     // Could use uname() to get the os type and version.
-
+#endif
     return True;
 }