git: ee3efd634115 - stable/13 - linux(4): Return ENOTSUP for unsupported clockid
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Jun 2022 19:41:36 UTC
The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=ee3efd634115cb25a9433f92e0397be5789b2ca4 commit ee3efd634115cb25a9433f92e0397be5789b2ca4 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-05-31 08:43:00 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-06-17 19:35:41 +0000 linux(4): Return ENOTSUP for unsupported clockid It's much better from the user perspective to get a sane error code. MFC after: 2 weeks (cherry picked from commit 452f4636c3ba1f51f2f549ccc31fd4177254fb6d) --- sys/compat/linux/linux_time.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 0be7025abe05..5d2269190931 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -278,8 +278,11 @@ linux_to_native_clockid(clockid_t *n, clockid_t l) if (l < 0) { /* cpu-clock */ - if ((l & LINUX_CLOCKFD_MASK) == LINUX_CLOCKFD) - return (EINVAL); + if (LINUX_CPUCLOCK_WHICH(l) == LINUX_CLOCKFD) { + LIN_SDT_PROBE1(time, linux_to_native_clockid, + unsupported_clockid, l); + return (ENOTSUP); + } if (LINUX_CPUCLOCK_WHICH(l) >= LINUX_CPUCLOCK_MAX) return (EINVAL); @@ -319,11 +322,11 @@ linux_to_native_clockid(clockid_t *n, clockid_t l) case LINUX_CLOCK_TAI: LIN_SDT_PROBE1(time, linux_to_native_clockid, unsupported_clockid, l); - return (EINVAL); + return (ENOTSUP); default: LIN_SDT_PROBE1(time, linux_to_native_clockid, unknown_clockid, l); - return (EINVAL); + return (ENOTSUP); } return (0);