[vdr] [RFC] Shutdown rewrite for 1.5.x

Marko Mäkelä marko.makela at hut.fi
Mon Jan 22 22:09:48 CET 2007

On Sat, Jan 13, 2007 at 09:48:47PM +0100, Udo Richter wrote:
> >A more important suggestion: Could you please add a notification method
> >to status.h for notifying plugins whether VDR is currently in
> >interactive mode?  
> You can poll this state on your own by calling 
> Shutdown.IsUserInactive().

Thanks, this seems to work: the display is powered off after the
"press any button to cancel shutdown" timeout.  However, after a
failed shutdown attempt (renaming the shutdown script so that
it won't be found), vdr does something to the file descriptor that
my plugin opens, and the relay control will fail.

This might have something to do with the fact that it is file descriptor 0.
There is no stdin, because my runvdr script closes it:

exec <&- >> /tmp/vdr.log 2>&1

The problem seems to lie in shutdown.c, in SystemExecSession().
It won't close file descriptor 0, but it will close anything above
STDERR_FILENO (which is normally 2).  This function appears to show
up in strace output as "clone()".  Adding close(0) to the function
fixes the problem.  Do you see any reason why the shutdown script
would need to access stdin?  (I can see reasons why it would want to
access stdout or stderr.)

I made a simple patch to softdevice (attached) that seems to work.
A similar patch would be needed for the subtitles plugin, to prevent
subtitles from appearing on the suspended video screen.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: suspend.patch
Type: text/x-diff
Size: 1389 bytes
Desc: softdevice-suspend.patch
Url : http://www.linuxtv.org/pipermail/vdr/attachments/20070122/49dc1a85/suspend.bin

More information about the vdr mailing list