[RFC] RTC check in configure
.. I couldn't sleep .. The RTC check we currently have in configure is suboptimal since we only check if RTC-related code can be compiled. On PPC this works because there is a RTC emulation, but it's not enough for MPlayer to use. The attached program performs the ioctl calls instead. Any better ideas or suggestions (the hardcoded /dev/rtc comes to mind)? Oh, does it work on x86? ;) Diego
Diego Biurrun wrote:
.. I couldn't sleep ..
The RTC check we currently have in configure is suboptimal since we only check if RTC-related code can be compiled. On PPC this works because there is a RTC emulation, but it's not enough for MPlayer to use.
The attached program performs the ioctl calls instead. Any better ideas or suggestions (the hardcoded /dev/rtc comes to mind)?
Oh, does it work on x86? ;)
I tried it on amd64; I'm not sure what to look for.
//return ioctl(rtc_fd, RTC_IRQP_SET, 1024);
Did you mean to leave that commented? Anyway, I ran the program with and without the line commented. bugfood@bugfood:/tmp$ gcc rtc.c bugfood@bugfood:/tmp$ ./a.out value: 0 bugfood@bugfood:/tmp$ echo $? 9 bugfood@bugfood:/tmp$ sed -i s://::g rtc.c bugfood@bugfood:/tmp$ gcc rtc.c bugfood@bugfood:/tmp$ ./a.out value: 0 bugfood@bugfood:/tmp$ echo $? 255 So, I guess the ioctl fails, but I don't know if that's what you're looking for. MPlayer runs fine with rtc timing on my machine. -Corey
Diego Biurrun writes the following:
int rtc_fd; rtc_fd = open("/dev/rtc", O_RDONLY); rtc_fd = ioctl(rtc_fd, RTC_IRQP_SET, 1024);
If you mean to test whether the ioctl exists, it'd be better to use a smaller number than 1024 or check for EACCES since big numbers might be rejected just because the max_user_freq tuning hasn't been done yet. Also, I'm not sure how this affects your thinking, but omitting the rtc driver is a common mistake made by people compiling their first custom kernel. They'll get an ENODEV here, but if mplayer does the runtime check for rtc anyway, they'll be likely to see the "No such device" error message later (every time mplayer is invoked) and fix the kernel config. "checking for RTC...no" during configure is less likely to be noticed.
I have this test in my local repo, tested on ppc and x86. -- Emanuele Giaquinta
On Wed, Mar 29, 2006 at 09:58:35AM +0200, Emanuele Giaquinta wrote:
I have this test in my local repo, tested on ppc and x86.
Looks good to me. This will need some testing on x86, though. Does it also work if RTC is not correctly configured? Also, it only checks for /dev/rtc, the device might have a different name. Diego
On Wed, 29 Mar 2006 09:58:35 +0200 "Emanuele Giaquinta" <emanuele.giaquinta@gmail.com> wrote:
I have this test in my local repo, tested on ppc and x86.
That can't work. Imagine that I build mplayer as user foo which don't have read perm on /dev/rtc, and then I run mplayer as user bar which is allowed to read /dev/rtc... There are gazillion of other examples: booting a different kernel w/rtc, using the binary on another machine, cross compiling... Detecting wether rtc is functionnal do not belong to compile time. It belongs to runtime ! Aurel
On Wed, Mar 29, 2006 at 01:43:39PM +0200, Aurelien Jacobs wrote:
On Wed, 29 Mar 2006 09:58:35 +0200 "Emanuele Giaquinta" <emanuele.giaquinta@gmail.com> wrote:
I have this test in my local repo, tested on ppc and x86.
That can't work.
Agreed. I've always configure and compile softwares as an unprivileged separated user. Also think about distribution builders ... -- - Gábor
On Wed, Mar 29, 2006 at 01:43:39PM +0200, Aurelien Jacobs wrote:
On Wed, 29 Mar 2006 09:58:35 +0200 "Emanuele Giaquinta" <emanuele.giaquinta@gmail.com> wrote:
I have this test in my local repo, tested on ppc and x86.
That can't work. Imagine that I build mplayer as user foo which don't have read perm on /dev/rtc, and then I run mplayer as user bar which is allowed to read /dev/rtc... There are gazillion of other examples: booting a different kernel w/rtc, using the binary on another machine, cross compiling...
Detecting wether rtc is functionnal do not belong to compile time. It belongs to runtime !
I'm thinking now that adding something like ppc && _rtc=no just before the RTC check is the best solution. Diego
On Wed, Mar 29, 2006 at 11:45:24PM +0200, Diego Biurrun wrote:
I'm thinking now that adding something like
ppc && _rtc=no
just before the RTC check is the best solution.
Anybody against this? Otherwise I'm going to commit it soon. Diego
On Thu, Apr 20, 2006 at 03:17:25PM +0200, Diego Biurrun wrote:
On Wed, Mar 29, 2006 at 11:45:24PM +0200, Diego Biurrun wrote:
I'm thinking now that adding something like
ppc && _rtc=no
just before the RTC check is the best solution.
Anybody against this? Otherwise I'm going to commit it soon.
Committed. Diego
participants (6)
-
Alan Curry -
Aurelien Jacobs -
Corey Hickey -
Diego Biurrun -
Emanuele Giaquinta -
Gábor Lénárt