refclock: improve error messages
This commit is contained in:
parent
afff06c88c
commit
eea343b93f
3 changed files with 9 additions and 9 deletions
|
@ -59,24 +59,24 @@ static int pps_initialise(RCL_Instance instance) {
|
||||||
|
|
||||||
fd = open(path, O_RDWR);
|
fd = open(path, O_RDWR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
LOG_FATAL("open() failed on %s", path);
|
LOG_FATAL("Could not open %s : %s", path, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UTI_FdSetCloexec(fd);
|
UTI_FdSetCloexec(fd);
|
||||||
|
|
||||||
if (time_pps_create(fd, &handle) < 0) {
|
if (time_pps_create(fd, &handle) < 0) {
|
||||||
LOG_FATAL("time_pps_create() failed on %s", path);
|
LOG_FATAL("time_pps_create() failed on %s : %s", path, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time_pps_getcap(handle, &mode) < 0) {
|
if (time_pps_getcap(handle, &mode) < 0) {
|
||||||
LOG_FATAL("time_pps_getcap() failed on %s", path);
|
LOG_FATAL("time_pps_getcap() failed on %s : %s", path, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time_pps_getparams(handle, ¶ms) < 0) {
|
if (time_pps_getparams(handle, ¶ms) < 0) {
|
||||||
LOG_FATAL("time_pps_getparams() failed on %s", path);
|
LOG_FATAL("time_pps_getparams() failed on %s : %s", path, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ static int pps_initialise(RCL_Instance instance) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time_pps_setparams(handle, ¶ms) < 0) {
|
if (time_pps_setparams(handle, ¶ms) < 0) {
|
||||||
LOG_FATAL("time_pps_setparams() failed on %s", path);
|
LOG_FATAL("time_pps_setparams() failed on %s : %s", path, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,13 +69,13 @@ static int shm_initialise(RCL_Instance instance) {
|
||||||
|
|
||||||
id = shmget(SHMKEY + param, sizeof (struct shmTime), IPC_CREAT | perm);
|
id = shmget(SHMKEY + param, sizeof (struct shmTime), IPC_CREAT | perm);
|
||||||
if (id == -1) {
|
if (id == -1) {
|
||||||
LOG_FATAL("shmget() failed");
|
LOG_FATAL("shmget() failed : %s", strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
shm = (struct shmTime *)shmat(id, 0, 0);
|
shm = (struct shmTime *)shmat(id, 0, 0);
|
||||||
if ((long)shm == -1) {
|
if ((long)shm == -1) {
|
||||||
LOG_FATAL("shmat() failed");
|
LOG_FATAL("shmat() failed : %s", strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ static int sock_initialise(RCL_Instance instance)
|
||||||
|
|
||||||
s.sun_family = AF_UNIX;
|
s.sun_family = AF_UNIX;
|
||||||
if (snprintf(s.sun_path, sizeof (s.sun_path), "%s", path) >= sizeof (s.sun_path)) {
|
if (snprintf(s.sun_path, sizeof (s.sun_path), "%s", path) >= sizeof (s.sun_path)) {
|
||||||
LOG_FATAL("path %s is too long", path);
|
LOG_FATAL("Path %s too long", path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ static int sock_initialise(RCL_Instance instance)
|
||||||
|
|
||||||
unlink(path);
|
unlink(path);
|
||||||
if (bind(sockfd, (struct sockaddr *)&s, sizeof (s)) < 0) {
|
if (bind(sockfd, (struct sockaddr *)&s, sizeof (s)) < 0) {
|
||||||
LOG_FATAL("bind() failed");
|
LOG_FATAL("bind(%s) failed : %s", path, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue