From: Thadeu Lima de Souza Cascardo Date: Wed, 23 Oct 2019 11:56:41 -0300 Subject: [LTP] [PATCH] timer_create01: accept kernel ENOTSUPP In-Reply-To: <20191023143510.GA10116@rei> References: <1714198769.8739783.1571839133168.JavaMail.zimbra@redhat.com> <20191023140408.GC4055@calabresa> <6089b924-8dbe-c43d-72d9-a4086a13b0d5@suse.cz> <20191023143510.GA10116@rei> Message-ID: <20191023145640.GD4055@calabresa> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it On Wed, Oct 23, 2019 at 04:35:11PM +0200, Cyril Hrubis wrote: > Hi! > > > You are right. We want this to succeed with EOPNOTSUPP, as it's a valid error > > > from kernel space. > > > > Actually, man says that EOPNOTSUPP is only valid for socket operations. > > So no, we should not go out of our way to explicitly check timer errors > > against EOPNOTSUPP either. (It's also a waste of time because on Linux, > > ENOTSUP == EOPNOTSUPP). > > Beware that kernel defines ENOTSUP that is not equal to EOPNOTSUPP and > in this case this value leaked to userspace leading to invalid userspace > errno value. That was ENOTSUPP (the internal kernel error, defined as 524). ENOTSUP, defined as EOPNOTSUPP, is the userspace error I guess Martin is saying should not be used either. In that case, we need to fix the kernel to return EINVAL instead. Looking at older changes here, I see commit 98d6f4dd84a134d942827584a3c5f67ffd8ec35f ("alarmtimer: return EINVAL instead of ENOTSUPP if rtcdev doesn't exist") claiming exactly this. Though it was about clock_getres and clock_gettime, quoting from that commit: " Second, Posix and Linux man pages agree that clock_gettime and clock_getres should return EINVAL if clk_id argument is invalid. While the arugment that the clockid is valid, but just not supported on this hardware could be made, this is just a technicality that doesn't help userspace applicaitons, and only complicates error handling. " > > -- > Cyril Hrubis > chrubis@suse.cz > > -- > Mailing list info: https://lists.linux.it/listinfo/ltp