Tom Zoerner <tomzo@xxxxxxxxxx> writes: > Hi Gerd & list members, > > Gerd Knorr wrote: > > I agree that priority levels are likely to complex. > > I was just trying to look ahead a little and find a solution that does > not only solve my immediate problem. I do se a very similar problem > one level up: when the user forgets that he has a TV recording running, > he might fire up his TV app and start zapping through the channels, > thereby destroying the recording. Of course that would be the user's > fault, but it would be nice if there would be a way to prevent that > kind of error in the first place. Software trying to be more clever than the user is IMHO a bad idea ... > > Another way would be to have some kind of O_EXCL flag, but at ioctl > > level. So nxtvepg could set that for the S_FREQUENCY ioctl and the > > driver would refuse the switch with -EBUSY if there is more than one > > file handle open at that time. > > This would solve my problem, but not the one described above. > > Also, wouldn't that mean to add a flag to every struct that's passed > to a "set" type ioctl? Yes. > To me (certainly not a driver expert) it'd seem simpler to pass this > value once in a dedicated ioctl and keep it in the driver. That would do the job equally well, yes. > If you agree to that, you could also take the next step and make an > integer out of the boolean flag and do a loop across all device > users to find the maximum value, before doing the EBUSY refusal. That isn't a small step. bttv doesn't even has a list of all device users. I think with open(O_EXCL) it would work if you close the device before attempting to switch the tv station, i.e. like this: open(/dev/vbi,0) [ read vbi data ] close(/dev/vbi) if (open(/dev/vbi,O_EXCL)) { [ switch station ] close(/dev/vbi) } open(/dev/vbi,0) [ read more vbi data ] close(/dev/vbi) Comments? Gerd -- Weil die späten Diskussionen nicht mal mehr den Rotwein lohnen. -- Wacholder in "Melanie"