Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: Drivers cannot be unloaded
Robert.Schneider@de.ibm.com wrote:
>
> I found the cause for that driver cannot be unloaded problem. I'm using
> the feature of VDR to start a script before and after recordings to call
> my rcnoflushd script to stop and start harddisk spin-downs. If that has
> happened once (a recording), the start of noflushd seems to occupy file
> handles that it inherited from the program that started noflushd (in that
> case VDR) and therefore blocks the unloading of the dvb modules.
>
> Can someone verify whether that's the same at your end (whoever else uses
> noflushd for silence in the living-room)
>
> regards
Apparently this happens because the system() call hands over all open
file descriptors to the external program, and the rcnoflushd script may
contain parts that stay "resident" when the script returns.
Please try the following to see if it helps:
Add the line
int SystemExec(const char *Command);
to the file thread.h.
Add the code
int SystemExec(const char *Command)
{
pid_t pid;
if ((pid = fork()) < 0) { // fork failed
LOG_ERROR;
return -1;
}
if (pid > 0) { // parent process
int status;
if (waitpid(pid, &status, 0) < 0) {
LOG_ERROR;
return -1;
}
return status;
}
else { // child process
int MaxPossibleFileDescriptors = getdtablesize();
for (int i = STDERR_FILENO + 1; i < MaxPossibleFileDescriptors; i++)
close(i); //close all dup'ed filedescriptors
if (execl("/bin/sh", "sh", "-c", Command, NULL) == -1) {
LOG_ERROR_STR(Command);
_exit(-1);
}
_exit(0);
}
}
to the file thread.c, and finally change the line
system(cmd);
in recording.c to
SystemExec(cmd);
Hope this helps (please let me know anyway).
Klaus
> ...
> Robert Schneider wrote:
> >
> > Hi,
> >
> > does anybody else experience the problem that after VDR exits
> (regardless
> > of gracefully, watchdogged or ungracefully) often, some of the modules
> > (especially dvb) have a usage count of 38 and therefore cannot be
> > unloaded/reloaded anymore.
> >
> > I'm experiencing this since I moved to VDR 0.96 and the drivers that are
> > needed for that (from the first version that Klaus recommends till the
> > ones from 02.10.2001).
> ...
--
_______________________________________________________________
Klaus Schmidinger Phone: +49-8635-6989-10
CadSoft Computer GmbH Fax: +49-8635-6989-40
Hofmark 2 Email: kls@cadsoft.de
D-84568 Pleiskirchen, Germany URL: www.cadsoft.de
_______________________________________________________________
Home |
Main Index |
Thread Index