integ/base/linuxptp/centos/patches/0008-sysoff-Change-log-level-of-ioctl-error-messages.patch
Douglas Henrique Koerich 0a9b0570e9 Don't exit when reading of PHC fails with EBUSY
Pull in the following upstream commits for both CentOS and Debian:
7824b13db9/
270709323a/
dadd2593c7/
e8dc364f9f/
See the patches themselves for more details.

Closes-Bug: 1983022
Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com>
Change-Id: I20f18b17752588b5b031eed88b5e52fb15c830fa
2022-08-02 13:19:14 -03:00

67 lines
2.2 KiB
Diff

From 38a530d94fc5aa73bde424d05e2e38348e64d7e5 Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed, 18 May 2022 11:33:36 +0200
Subject: [PATCH 8/10] sysoff: Change log level of ioctl error messages.
Change the log level of ioctl error messages to the error level to make
them visible in default configuration, with the exception of EOPNOTSUPP
which is expected in probing and should stay at the debug level to avoid
confusing users.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
[commit 270709323a161ff1cb83af511ce50691152c75cf upstream]
Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com>
---
sysoff.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/sysoff.c b/sysoff.c
index 5d3b907..a425275 100644
--- a/sysoff.c
+++ b/sysoff.c
@@ -28,6 +28,14 @@
#define NS_PER_SEC 1000000000LL
+static void print_ioctl_error(const char *name)
+{
+ if (errno == EOPNOTSUPP)
+ pr_debug("ioctl %s: %s", name, strerror(errno));
+ else
+ pr_err("ioctl %s: %s", name, strerror(errno));
+}
+
static int64_t pctns(struct ptp_clock_time *t)
{
return t->sec * NS_PER_SEC + t->nsec;
@@ -38,7 +46,7 @@ static int sysoff_precise(int fd, int64_t *result, uint64_t *ts)
struct ptp_sys_offset_precise pso;
memset(&pso, 0, sizeof(pso));
if (ioctl(fd, PTP_SYS_OFFSET_PRECISE, &pso)) {
- pr_debug("ioctl PTP_SYS_OFFSET_PRECISE: %m");
+ print_ioctl_error("PTP_SYS_OFFSET_PRECISE");
return -errno;
}
*result = pctns(&pso.sys_realtime) - pctns(&pso.device);
@@ -98,7 +106,7 @@ static int sysoff_extended(int fd, int n_samples,
memset(&pso, 0, sizeof(pso));
pso.n_samples = n_samples;
if (ioctl(fd, PTP_SYS_OFFSET_EXTENDED, &pso)) {
- pr_debug("ioctl PTP_SYS_OFFSET_EXTENDED: %m");
+ print_ioctl_error("PTP_SYS_OFFSET_EXTENDED");
return -errno;
}
*result = sysoff_estimate(&pso.ts[0][0], 1, n_samples, ts, delay);
@@ -112,7 +120,7 @@ static int sysoff_basic(int fd, int n_samples,
memset(&pso, 0, sizeof(pso));
pso.n_samples = n_samples;
if (ioctl(fd, PTP_SYS_OFFSET, &pso)) {
- perror("ioctl PTP_SYS_OFFSET");
+ print_ioctl_error("PTP_SYS_OFFSET");
return -errno;
}
*result = sysoff_estimate(pso.ts, 0, n_samples, ts, delay);
--
2.29.2