RTC broken under 2.6.15-rc7-rt1 (was: Re: MPlayer broken under2.6.15-rc7-rt1?)

From: Steven Rostedt
Date: Sat Dec 31 2005 - 17:46:30 EST


On Sat, 2005-12-31 at 21:58 +0100, Jan Engelhardt wrote:
> >Subject: Re: MPlayer broken under 2.6.15-rc7-rt1?
>
> I seriously demand that this be changed into "RTC broekn under..."! :)

Done ;)

[...]

> >
> >Index: linux-2.6.15-rc7-rt1/drivers/char/rtc.c
>
> This patch fixes the rtc BUG for me.

Yeah, attached is a program that does what mplayer does. I run it from
the command line like this:

# for i in `seq 10000`; do ./rtc_ioctl ; done

And with the patch it runs perfectly fine. Without it, it segfaults
several times.

-- Steve

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>

#include <linux/rtc.h>

#define RTC "/dev/rtc"

int main(int argc, char **argv)
{
int fd;
unsigned long data;

if ((fd = open(RTC, O_RDONLY)) < 0) {
perror(RTC);
exit(0);
}

ioctl(fd, RTC_IRQP_SET, 1024);
ioctl(fd, RTC_PIE_ON, 0);

read(fd, &data, sizeof(data));
printf("%08lx\n",data);

close (fd);
exit(0);
}