[MPlayer-dev-eng] [PATCH] -- FreeBSD RTC Support

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Jan 3 12:02:36 CET 2005


Hi,

On Mon, Jan 03, 2005 at 01:43:16AM +0100, Diego Biurrun wrote:
> Reimar Döffinger writes:
> > On Mon, Jan 03, 2005 at 12:51:38AM +0100, Diego Biurrun wrote:
> > > Reimar Döffinger writes:
> > > > > > > Hi, This patch enables RTC support for FreeBSD.
> > > > > > > I've personally been using rtc with mplayer for almost a year and
> > > > > > > it works really well and this has been an option in FreeBSD ports for 
> > > > > > > over 9 months now.
> > > > > > 
> > > > > >    --disable-rtc          disable RTC (/dev/rtc) on Linux [autodetect]
> > > > > > +  --disable-bsdrtc       disable BSD style RTC (/dev/rtc) [autodetect]
> > > > > 
> > > > > I don't like this solution.  Adding another check/option to configure is
> > > > > superfluous IMHO.  We should just extend the normal RTC check.  I'll give
> > > > > this a shot myself.
> > > > 
> > > > Better start with the attached patch... The problem is that those two
> > > > are quite different, I see no way you could do this with just one check
> > > > and one define...
> > > 
> > > Here is how I propose to solve this.  Looks way simpler to me ;-)
> > 
> > Well, it will only work with freebsd and nothing else, but it is a
> > possibility...
> 
> Yes, for the moment it just extends the test to FreeBSD, as no other
> platform besides Linux seems to implement RTC anyway..
> 
> I think having two tests is unnecessary (and slows down configure,
> which is not a speed demon anyway).  It should not be hard to add
> support for more platforms later on.

I have a different suggestion: linux/rtc.h probably will always be
linux-specific. How about using
#ifdef __linux__
#include <linux/rtc.h>
#else
<freebsd code here>
#endif

> > > +#include <rtc.h>
> > > +#define RTC_IRQP_READ RTCIO_IRQP_SET
> > 
> > That is ugly...
> 
> Why?

Because RTC_IRQP_READ is something different than RTC_IRQP_SET.

> > > +#else
> > >  #include <linux/rtc.h>
> > > +#endif
> > >  int main(void) { return RTC_IRQP_READ; }
> > 
> > better change it here... it looks like nonesense to me to test for a
> > function that we don't use... Or is there a specific reason for this?
> 
> Huh?  The function is #defined to the one used on FreeBSD.  The idea
> is taken from what you implemented for mplayer.c, so ...

No it is not.
I have
#define RTC_IRQP_SET RTCIO_IRQP_SET
not
#define RTC_IRQP_READ RTCIO_IRQP_SET
If we were actually trying to do the ioctl, using SET probably wouldn't
be a good idea but here it doesn't matter I'd say...

Greetings,
Reimar Döffinger




More information about the MPlayer-dev-eng mailing list