[vdr] Hang on tools.c SpinUpDisk - system("sync")

Chris Warren dvb at ixalon.net
Thu Feb 17 12:00:46 CET 2005

> I've looked into where the hang happens and its in SpinUpDisk on the 
> line that calls system("sync") - if I comment this line out then 
> everything works perfectly!

I worked out what was happening - system(const char *string) uses /bin/sh
which in my case is bash - bash is linked to the NTPL version of glibc. I
wrote a small test which showed that executing something which uses NTPL
threads from an application which uses linuxthreads never returns.

If the caller doesn't use threading the problem doesn't seem to occur.

So I've replaced system("sync") with an fsync(f) before the file descriptor
is closed. The disk spins up fine now.


More information about the vdr mailing list