lkml.org 
[lkml]   [2005]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: opening linux char device file in user thread.
On 8/4/05, P.Manohar <pmanohar@lantana.cs.iitm.ernet.in> wrote:
>
> hai,
>
> I have written a daemon which is running in user space, will send some
> data periodically to kernel space. This I have done with the help of a
> device file.
>
> It is working, but I want to apply threads mechanism in that daemon. But
> when I split that daemon functionality into a thread and a original
> process. I am unable to
> open the device file. This is happening in both places(either in thread or
> original process).

Try opening the device, get the FD and THEN spawn the thread. this
will help, as the device is opened only once as far as the driver is
concerned. The presence of usage from the thread is felt only in the
reference count of the fd (which should be transparent to user space
and the device driver). Race conditions are assumed to be taken care
of in the kernel module though.

The other way is to open device, write data, close device every time u
write something. This is beneficial if the time between the writes is
seperated by more than a minute. There will be no races etc to take
care of.

> The device is opening when threading is not there.
>
> Can anybody suggest me?
>
> Regards,
> P.Manohar.
>

Bhanu.

> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>


--
The difference between Theory and Practice is more so in Practice than
in Theory.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-04 12:17    [W:0.058 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site