1 |
douglas |
41 |
--- ./clients/lcdproc/machine_FreeBSD.c.orig Sat Apr 14 16:38:15 2007 |
2 |
|
|
+++ ./clients/lcdproc/machine_FreeBSD.c Sun Aug 26 23:21:56 2007 |
3 |
|
|
@@ -45,16 +45,22 @@ |
4 |
|
|
#include <sys/mount.h> |
5 |
|
|
#include <sys/time.h> |
6 |
|
|
#include <sys/user.h> |
7 |
|
|
-#include <machine/apm_bios.h> |
8 |
|
|
#include <kvm.h> |
9 |
|
|
#include <errno.h> |
10 |
|
|
#include <sys/socket.h> |
11 |
|
|
#include <net/if.h> |
12 |
|
|
#include <net/if_mib.h> |
13 |
|
|
|
14 |
|
|
+#ifdef HAVE_CONFIG_H |
15 |
|
|
+# include "config.h" |
16 |
|
|
+#endif |
17 |
|
|
+ |
18 |
|
|
+#ifdef HAVE_MACHINE_APM_BIOS_H |
19 |
|
|
+# include <machine/apm_bios.h> |
20 |
|
|
+#endif |
21 |
|
|
+ |
22 |
|
|
#include "main.h" |
23 |
|
|
#include "machine.h" |
24 |
|
|
-#include "config.h" |
25 |
|
|
#include "shared/LL.h" |
26 |
|
|
|
27 |
|
|
static int pageshift; |
28 |
|
|
@@ -86,13 +92,14 @@ |
29 |
|
|
|
30 |
|
|
int machine_get_battstat(int *acstat, int *battflag, int *percent) |
31 |
|
|
{ |
32 |
|
|
- int apmd; |
33 |
|
|
- struct apm_info aip; |
34 |
|
|
- |
35 |
|
|
*acstat = LCDP_AC_ON; |
36 |
|
|
*battflag = LCDP_BATT_ABSENT; |
37 |
|
|
*percent = 100; |
38 |
|
|
|
39 |
|
|
+#ifdef HAVE_MACHINE_APM_BIOS_H |
40 |
|
|
+ int apmd; |
41 |
|
|
+ struct apm_info aip; |
42 |
|
|
+ |
43 |
|
|
if ((apmd = open("/dev/apm", O_RDONLY)) == -1) |
44 |
|
|
{ |
45 |
|
|
perror("get_battstat_open"); |
46 |
|
|
@@ -142,6 +149,7 @@ |
47 |
|
|
*percent = -1; |
48 |
|
|
|
49 |
|
|
close(apmd); |
50 |
|
|
+#endif |
51 |
|
|
|
52 |
|
|
return(TRUE); |
53 |
|
|
} |
54 |
|
|
@@ -197,7 +205,7 @@ |
55 |
|
|
static load_type last_load = { 0, 0, 0, 0, 0 }; |
56 |
|
|
static load_type last_ret_load; |
57 |
|
|
load_type load; |
58 |
|
|
- u_int32_t cp_time[CPUSTATES]; |
59 |
|
|
+ long cp_time[CPUSTATES]; |
60 |
|
|
size_t size; |
61 |
|
|
|
62 |
|
|
size = sizeof(cp_time); |