This source file includes following definitions.
- osf1_sys_gettimeofday
- osf1_sys_setitimer
- osf1_sys_settimeofday
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 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/namei.h>
37 #include <sys/proc.h>
38 #include <sys/file.h>
39 #include <sys/mount.h>
40 #include <sys/syscallargs.h>
41
42 #include <compat/osf1/osf1.h>
43 #include <compat/osf1/osf1_syscallargs.h>
44 #include <compat/osf1/osf1_cvt.h>
45
46 int
47 osf1_sys_gettimeofday(p, v, retval)
48 struct proc *p;
49 void *v;
50 register_t *retval;
51 {
52 struct osf1_sys_gettimeofday_args *uap = v;
53 struct sys_gettimeofday_args a;
54 struct osf1_timeval otv;
55 struct osf1_timezone otz;
56 struct timeval tv;
57 struct timezone tz;
58 int error;
59 caddr_t sg;
60
61 sg = stackgap_init(p->p_emul);
62 if (SCARG(uap, tp) == NULL)
63 SCARG(&a, tp) = NULL;
64 else
65 SCARG(&a, tp) = stackgap_alloc(&sg, sizeof tv);
66 if (SCARG(uap, tzp) == NULL)
67 SCARG(&a, tzp) = NULL;
68 else
69 SCARG(&a, tzp) = stackgap_alloc(&sg, sizeof tz);
70
71 error = sys_gettimeofday(p, &a, retval);
72
73 if (error == 0 && SCARG(uap, tp) != NULL) {
74 error = copyin((caddr_t)SCARG(&a, tp),
75 (caddr_t)&tv, sizeof tv);
76 if (error == 0) {
77 memset(&otv, 0, sizeof otv);
78 otv.tv_sec = tv.tv_sec;
79 otv.tv_usec = tv.tv_usec;
80
81 error = copyout((caddr_t)&otv,
82 (caddr_t)SCARG(uap, tp), sizeof otv);
83 }
84 }
85 if (error == 0 && SCARG(uap, tzp) != NULL) {
86 error = copyin((caddr_t)SCARG(&a, tzp),
87 (caddr_t)&tz, sizeof tz);
88 if (error == 0) {
89 memset(&otz, 0, sizeof otz);
90 otz.tz_minuteswest = tz.tz_minuteswest;
91 otz.tz_dsttime = tz.tz_dsttime;
92
93 error = copyout((caddr_t)&otz,
94 (caddr_t)SCARG(uap, tzp), sizeof otz);
95 }
96 }
97 return (error);
98 }
99
100 int
101 osf1_sys_setitimer(p, v, retval)
102 struct proc *p;
103 void *v;
104 register_t *retval;
105 {
106 struct osf1_sys_setitimer_args *uap = v;
107 struct sys_setitimer_args a;
108 struct osf1_itimerval o_itv, o_oitv;
109 struct itimerval b_itv, b_oitv;
110 caddr_t sg;
111 int error;
112
113 switch (SCARG(uap, which)) {
114 case OSF1_ITIMER_REAL:
115 SCARG(&a, which) = ITIMER_REAL;
116 break;
117
118 case OSF1_ITIMER_VIRTUAL:
119 SCARG(&a, which) = ITIMER_VIRTUAL;
120 break;
121
122 case OSF1_ITIMER_PROF:
123 SCARG(&a, which) = ITIMER_PROF;
124 break;
125
126 default:
127 return (EINVAL);
128 }
129
130 sg = stackgap_init(p->p_emul);
131
132 SCARG(&a, itv) = stackgap_alloc(&sg, sizeof b_itv);
133
134
135 error = copyin((caddr_t)SCARG(uap, itv), (caddr_t)&o_itv,
136 sizeof o_itv);
137 if (error == 0) {
138
139
140 memset(&b_itv, 0, sizeof b_itv);
141 b_itv.it_interval.tv_sec = o_itv.it_interval.tv_sec;
142 b_itv.it_interval.tv_usec = o_itv.it_interval.tv_usec;
143 b_itv.it_value.tv_sec = o_itv.it_value.tv_sec;
144 b_itv.it_value.tv_usec = o_itv.it_value.tv_usec;
145
146 error = copyout((caddr_t)&b_itv,
147 (caddr_t)SCARG(&a, itv), sizeof b_itv);
148 }
149
150 if (SCARG(uap, oitv) == NULL)
151 SCARG(&a, oitv) = NULL;
152 else
153 SCARG(&a, oitv) = stackgap_alloc(&sg, sizeof b_oitv);
154
155 if (error == 0)
156 error = sys_setitimer(p, &a, retval);
157
158 if (error == 0 && SCARG(uap, oitv) != NULL) {
159
160 error = copyin((caddr_t)SCARG(&a, oitv), (caddr_t)&b_oitv,
161 sizeof b_oitv);
162 if (error == 0) {
163
164
165 memset(&o_oitv, 0, sizeof o_oitv);
166 o_oitv.it_interval.tv_sec = b_oitv.it_interval.tv_sec;
167 o_oitv.it_interval.tv_usec = b_oitv.it_interval.tv_usec;
168 o_oitv.it_value.tv_sec = b_oitv.it_value.tv_sec;
169 o_oitv.it_value.tv_usec = b_oitv.it_value.tv_usec;
170
171 error = copyout((caddr_t)&o_oitv,
172 (caddr_t)SCARG(uap, oitv), sizeof o_oitv);
173 }
174 }
175
176 return (error);
177 }
178
179 int
180 osf1_sys_settimeofday(p, v, retval)
181 struct proc *p;
182 void *v;
183 register_t *retval;
184 {
185 struct osf1_sys_settimeofday_args *uap = v;
186 struct sys_settimeofday_args a;
187 struct osf1_timeval otv;
188 struct osf1_timezone otz;
189 struct timeval tv;
190 struct timezone tz;
191 int error;
192 caddr_t sg;
193
194 sg = stackgap_init(p->p_emul);
195 if (SCARG(uap, tv) == NULL)
196 SCARG(&a, tv) = NULL;
197 else {
198 SCARG(&a, tv) = stackgap_alloc(&sg, sizeof tv);
199
200
201 error = copyin((caddr_t)SCARG(uap, tv),
202 (caddr_t)&otv, sizeof otv);
203 if (error == 0) {
204
205
206 memset(&tv, 0, sizeof tv);
207 tv.tv_sec = otv.tv_sec;
208 tv.tv_usec = otv.tv_usec;
209
210 error = copyout((caddr_t)&tv,
211 (caddr_t)SCARG(&a, tv), sizeof tv);
212 }
213 }
214
215 if (SCARG(uap, tzp) == NULL)
216 SCARG(&a, tzp) = NULL;
217 else {
218 SCARG(&a, tzp) = stackgap_alloc(&sg, sizeof tz);
219
220
221 error = copyin((caddr_t)SCARG(uap, tzp),
222 (caddr_t)&otz, sizeof otz);
223 if (error == 0) {
224
225
226 memset(&tz, 0, sizeof tz);
227 tz.tz_minuteswest = otz.tz_minuteswest;
228 tz.tz_dsttime = otz.tz_dsttime;
229
230 error = copyout((caddr_t)&tz,
231 (caddr_t)SCARG(&a, tzp), sizeof tz);
232 }
233 }
234
235 if (error == 0)
236 error = sys_settimeofday(p, &a, retval);
237
238 return (error);
239 }