2218
|
1 |
--- uptimed-0.3.16/libuptimed/urec.h Fri Jan 2 00:46:00 2009
|
|
2 |
+++ uptimed-0.3.16-patch/libuptimed/urec.h Sat Oct 17 17:47:24 2009
|
|
3 |
@@ -34,8 +34,9 @@
|
|
4 |
|
|
5 |
#ifdef PLATFORM_SOLARIS
|
|
6 |
#include <unistd.h>
|
|
7 |
-#include <sys/time.h>
|
|
8 |
-#include <utmp.h>
|
|
9 |
+#include <sys/types.h>
|
|
10 |
+#include <time.h>
|
|
11 |
+#include <utmpx.h>
|
|
12 |
#include <fcntl.h>
|
|
13 |
#endif
|
|
14 |
|
|
15 |
--- uptimed-0.3.16/libuptimed/urec.c Fri Jan 2 00:46:00 2009
|
|
16 |
+++ uptimed-0.3.16-patch/libuptimed/urec.c Sat Oct 17 19:54:08 2009
|
|
17 |
@@ -148,15 +148,15 @@
|
|
18 |
#ifdef PLATFORM_SOLARIS
|
|
19 |
time_t read_uptime(void) {
|
|
20 |
int fd;
|
|
21 |
- struct utmp ut;
|
|
22 |
+ struct utmpx ut;
|
|
23 |
int found=0;
|
|
24 |
|
|
25 |
- fd = open (UTMP_FILE, O_RDONLY);
|
|
26 |
+ fd = open (UTMPX_FILE, O_RDONLY);
|
|
27 |
if (fd >= 0) {
|
|
28 |
while (!found) {
|
|
29 |
- if (read(fd, &ut, sizeof(ut)) < 0) {
|
|
30 |
+ if (read(fd, &ut, sizeof(ut)) == -1) {
|
|
31 |
found = -1;
|
|
32 |
- } else if (ut.ut_type==BOOT_TIME) {
|
|
33 |
+ } else if (ut.ut_type == BOOT_TIME) {
|
|
34 |
found = 1;
|
|
35 |
}
|
|
36 |
}
|
|
37 |
@@ -163,7 +163,7 @@
|
|
38 |
close(fd);
|
|
39 |
}
|
|
40 |
|
|
41 |
- if (found == 1) return time(0) - ut.ut_time;
|
|
42 |
+ if (found == 1) return time(0) - ut.ut_tv.tv_sec;
|
|
43 |
|
|
44 |
return 0;
|
|
45 |
}
|
|
46 |
@@ -305,16 +305,16 @@
|
|
47 |
int createbootid(void) {
|
|
48 |
FILE *f;
|
|
49 |
int fd;
|
|
50 |
- struct utmp ut;
|
|
51 |
+ struct utmpx ut;
|
|
52 |
int found = 0;
|
|
53 |
time_t bootid = 0;
|
|
54 |
|
|
55 |
- fd = open (UTMP_FILE, O_RDONLY);
|
|
56 |
+ fd = open (UTMPX_FILE, O_RDONLY);
|
|
57 |
if (fd >= 0) {
|
|
58 |
while(!found) {
|
|
59 |
- if (read(fd, &ut, sizeof(ut)) < 0) {
|
|
60 |
+ if (read(fd, &ut, sizeof(ut)) == -1) {
|
|
61 |
found = -1;
|
|
62 |
- } else if (ut.ut_type==BOOT_TIME) {
|
|
63 |
+ } else if (ut.ut_type == BOOT_TIME) {
|
|
64 |
found = 1;
|
|
65 |
}
|
|
66 |
}
|
|
67 |
@@ -321,7 +321,7 @@
|
|
68 |
close(fd);
|
|
69 |
}
|
|
70 |
|
|
71 |
- if (found == 1) bootid = ut.ut_time;
|
|
72 |
+ if (found == 1) bootid = ut.ut_tv.tv_sec;
|
|
73 |
|
|
74 |
f = fopen(FILE_BOOTID, "w");
|
|
75 |
if (!f) {
|