* updated kmbox (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / network / clockspeed / t2_fixes.patch
blob6080bc2cfae81808951171290c563804ac720819
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../clockspeed/t2_fixes.patch
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
16 diff -urN clockspeed-0.62.orig/Makefile clockspeed-0.62/Makefile
17 --- clockspeed-0.62.orig/Makefile 1998-10-13 19:37:49.000000000 +0200
18 +++ clockspeed-0.62/Makefile 2005-02-12 16:49:11.000000000 +0100
19 @@ -7,8 +7,8 @@
20 auto-ccld.sh: \
21 conf-cc conf-ld warn-auto.sh
22 ( cat warn-auto.sh; \
23 - echo CC=\'`head -1 conf-cc`\'; \
24 - echo LD=\'`head -1 conf-ld`\' \
25 + echo CC=\'`head -n 1 conf-cc`\'; \
26 + echo LD=\'`head -n 1 conf-ld`\' \
27 ) > auto-ccld.sh
29 auto-str: \
30 @@ -21,7 +21,7 @@
32 auto_home.c: \
33 auto-str conf-home
34 - ./auto-str auto_home `head -1 conf-home` > auto_home.c
35 + ./auto-str auto_home `head -n 1 conf-home` > auto_home.c
37 auto_home.o: \
38 compile auto_home.c
39 diff -urN clockspeed-0.62.orig/clockspeed.c clockspeed-0.62/clockspeed.c
40 --- clockspeed-0.62.orig/clockspeed.c 1998-10-13 19:37:49.000000000 +0200
41 +++ clockspeed-0.62/clockspeed.c 2005-02-12 21:15:24.384731032 +0100
42 @@ -83,7 +83,7 @@
43 if (deriv <= 0) return;
44 if (deriv > 200000000) return; /* 5Hz ticks? be serious */
46 - fd = open_trunc("etc/atto.tmp");
47 + fd = open_trunc("/var/state/clockspeed/atto.tmp");
48 if (fd == -1) return;
50 buf[0] = 0;
51 @@ -119,7 +119,7 @@
52 if (fsync(fd) == -1) { close(fd); return; }
53 if (close(fd) == -1) return; /* NFS stupidity */
55 - rename("etc/atto.tmp","etc/atto"); /* if it fails, bummer */
56 + rename("/var/state/clockspeed/atto.tmp","/var/state/clockspeed/atto"); /* if it fails, bummer */
59 void main()
60 @@ -136,16 +136,16 @@
61 if (chdir(auto_home) == -1) _exit(1);
62 umask(033);
64 - if (open_read("etc/atto") == 0) {
65 + if (open_read("/var/state/clockspeed/atto") == 0) {
66 r = read(0,buf,sizeof buf);
67 if (r == sizeof buf)
68 deriv = nano(buf);
69 close(0);
72 - if (fifo_make("adjust",0600) == -1) if (errno != error_exist) _exit(1);
73 - if (open_read("adjust") != 0) _exit(1);
74 - if (open_write("adjust") == -1) _exit(1);
75 + if (fifo_make("/var/state/clockspeed/adjust",0600) == -1) if (errno != error_exist) _exit(1);
76 + if (open_read("/var/state/clockspeed/adjust") != 0) _exit(1);
77 + if (open_write("/var/state/clockspeed/adjust") == -1) _exit(1);
79 now(&first);
81 diff -urN clockspeed-0.62.orig/clockview.c clockspeed-0.62/clockview.c
82 --- clockspeed-0.62.orig/clockview.c 1998-10-13 19:37:49.000000000 +0200
83 +++ clockspeed-0.62/clockview.c 2005-02-12 16:52:25.000000000 +0100
84 @@ -1,5 +1,5 @@
85 #include <sys/types.h>
86 -#include <sys/time.h>
87 +#include <time.h>
88 #include "substdio.h"
89 #include "readwrite.h"
90 #include "strerr.h"
91 diff -urN clockspeed-0.62.orig/error.h clockspeed-0.62/error.h
92 --- clockspeed-0.62.orig/error.h 1998-10-13 19:37:49.000000000 +0200
93 +++ clockspeed-0.62/error.h 2005-02-12 16:57:50.000000000 +0100
94 @@ -1,7 +1,7 @@
95 #ifndef ERROR_H
96 #define ERROR_H
98 -extern int errno;
99 +#include <errno.h>
101 extern int error_intr;
102 extern int error_nomem;
103 diff -urN clockspeed-0.62.orig/hier.c clockspeed-0.62/hier.c
104 --- clockspeed-0.62.orig/hier.c 1998-10-13 19:37:49.000000000 +0200
105 +++ clockspeed-0.62/hier.c 2005-02-12 21:54:50.393043096 +0100
106 @@ -2,11 +2,12 @@
108 void hier()
110 - c("/","etc","leapsecs.dat",-1,-1,0644);
111 + d("/var/state","clockspeed",-1,-1,0755);
113 + c("/","var/state/clockspeed","leapsecs.dat",-1,-1,0644);
115 h(auto_home,-1,-1,0755);
117 - d(auto_home,"etc",-1,-1,0755);
118 d(auto_home,"bin",-1,-1,0755);
119 d(auto_home,"man",-1,-1,0755);
120 d(auto_home,"man/man1",-1,-1,0755);
121 diff -urN clockspeed-0.62.orig/leapsecs_read.c clockspeed-0.62/leapsecs_read.c
122 --- clockspeed-0.62.orig/leapsecs_read.c 1998-10-13 19:37:49.000000000 +0200
123 +++ clockspeed-0.62/leapsecs_read.c 2005-02-12 21:28:04.674149472 +0100
124 @@ -2,7 +2,6 @@
125 #include <sys/stat.h>
126 #include <fcntl.h>
127 #include <errno.h>
128 -extern int errno;
129 #include "tai.h"
130 #include "leapsecs.h"
132 @@ -18,7 +17,7 @@
133 int i;
134 struct tai u;
136 - fd = open("/etc/leapsecs.dat",O_RDONLY | O_NDELAY);
137 + fd = open("/var/state/clockspeed/leapsecs.dat",O_RDONLY | O_NDELAY);
138 if (fd == -1) {
139 if (errno != ENOENT) return -1;
140 if (leapsecs) free(leapsecs);