| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: refclock_shm.c,v 1.4 2015/04/07 17:34:19 christos Exp $ */ | | 1 | /* $NetBSD: refclock_shm.c,v 1.5 2015/04/13 17:45:19 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * refclock_shm - clock driver for utc via shared memory | | 4 | * refclock_shm - clock driver for utc via shared memory |
5 | * - under construction - | | 5 | * - under construction - |
6 | * To add new modes: Extend or union the shmTime-struct. Do not | | 6 | * To add new modes: Extend or union the shmTime-struct. Do not |
7 | * extend/shrink size, because otherwise existing implementations | | 7 | * extend/shrink size, because otherwise existing implementations |
8 | * will specify wrong size of shared memory-segment | | 8 | * will specify wrong size of shared memory-segment |
9 | * PB 18.3.97 | | 9 | * PB 18.3.97 |
10 | */ | | 10 | */ |
11 | | | 11 | |
12 | #ifdef HAVE_CONFIG_H | | 12 | #ifdef HAVE_CONFIG_H |
13 | # include <config.h> | | 13 | # include <config.h> |
14 | #endif | | 14 | #endif |
| @@ -187,29 +187,28 @@ getShmTime( | | | @@ -187,29 +187,28 @@ getShmTime( |
187 | msyslog(LOG_ERR, "SHM CreateFileMapping (unit %d): %s", unit, buf); | | 187 | msyslog(LOG_ERR, "SHM CreateFileMapping (unit %d): %s", unit, buf); |
188 | return NULL; | | 188 | return NULL; |
189 | } | | 189 | } |
190 | p = (struct shmTime *)MapViewOfFile(shmid, FILE_MAP_WRITE, 0, 0, | | 190 | p = (struct shmTime *)MapViewOfFile(shmid, FILE_MAP_WRITE, 0, 0, |
191 | sizeof (struct shmTime)); | | 191 | sizeof (struct shmTime)); |
192 | if (p == NULL) { /*error*/ | | 192 | if (p == NULL) { /*error*/ |
193 | char buf[1000]; | | 193 | char buf[1000]; |
194 | FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, | | 194 | FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, |
195 | 0, GetLastError (), 0, buf, sizeof (buf), 0); | | 195 | 0, GetLastError (), 0, buf, sizeof (buf), 0); |
196 | msyslog(LOG_ERR,"SHM MapViewOfFile (unit %d): %s", unit, buf); | | 196 | msyslog(LOG_ERR,"SHM MapViewOfFile (unit %d): %s", unit, buf); |
197 | return NULL; | | 197 | return NULL; |
198 | } | | 198 | } |
199 | | | 199 | |
200 | #endif | | | |
201 | | | | |
202 | return p; | | 200 | return p; |
| | | 201 | #endif |
203 | } | | 202 | } |
204 | /* | | 203 | /* |
205 | * shm_start - attach to shared memory | | 204 | * shm_start - attach to shared memory |
206 | */ | | 205 | */ |
207 | static int | | 206 | static int |
208 | shm_start( | | 207 | shm_start( |
209 | int unit, | | 208 | int unit, |
210 | struct peer *peer | | 209 | struct peer *peer |
211 | ) | | 210 | ) |
212 | { | | 211 | { |
213 | struct refclockproc * const pp = peer->procptr; | | 212 | struct refclockproc * const pp = peer->procptr; |
214 | struct shmunit * const up = emalloc_zero(sizeof(*up)); | | 213 | struct shmunit * const up = emalloc_zero(sizeof(*up)); |
215 | | | 214 | |