diff options
author | Johannes Stezenbach <devnull@localhost> | 2003-05-07 15:45:52 +0000 |
---|---|---|
committer | Johannes Stezenbach <devnull@localhost> | 2003-05-07 15:45:52 +0000 |
commit | f1bee9370a57e4297c6f90a10e8ba53e9cbf51c5 (patch) | |
tree | 167a7d2e95cd2df704564916848250920a6ee79a /linux | |
parent | 95637968e0b0384f6c6c1137a8c0522ae631f346 (diff) | |
download | mediapointer-dvb-s2-f1bee9370a57e4297c6f90a10e8ba53e9cbf51c5.tar.gz mediapointer-dvb-s2-f1bee9370a57e4297c6f90a10e8ba53e9cbf51c5.tar.bz2 |
fixed remaining frontend thread issues (I hope ;-)
(workaround needed for kernel 2.4 because kernel_thread() fails when
the process opening the frontend device is ptraced)
(untested with kernel 2.5, but the kernel_thread(9 implementation in
2.5 looks fixed to me)
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index 73184e1c2..5009fc164 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -437,7 +437,6 @@ int dvb_frontend_thread (void *data) dvb_kernel_thread_setup (name); - fe->thread_pid = current->pid; fe->lost_sync_count = -1; dvb_call_frontend_notifiers (fe, 0); @@ -535,6 +534,8 @@ void dvb_frontend_stop (struct dvb_frontend_data *fe) static int dvb_frontend_start (struct dvb_frontend_data *fe) { + int ret, pt; + dprintk ("%s\n", __FUNCTION__); if (fe->thread_pid) { @@ -553,7 +554,28 @@ int dvb_frontend_start (struct dvb_frontend_data *fe) fe->thread_pid = 0; mb(); - kernel_thread (dvb_frontend_thread, fe, 0); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) + /* bug in linux 2.4.x: kernel_thread() fails when the process calling + * open() is run in the debugger (fixed in kernel 2.5). I hope this + * workaround does not have any ugly side effects... + */ + pt = current->ptrace; + current->ptrace = 0; +#endif + + ret = kernel_thread (dvb_frontend_thread, fe, 0); + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) + current->ptrace = pt; +#endif + + if (ret < 0) { + printk("dvb_frontend_start: failed to start kernel_thread (%d)\n", ret); + up(&fe->sem); + return ret; + } + fe->thread_pid = ret; + return 0; } @@ -633,6 +655,8 @@ int dvb_frontend_open (struct inode *inode, struct file *file) if ((file->f_flags & O_ACCMODE) != O_RDONLY) { ret = dvb_frontend_start (fe); + if (ret) + dvb_generic_release (inode, file); /* empty event queue */ fe->events.eventr = fe->events.eventw = 0; |