From: Bhanu Kalyan Chetlapalli <chbhanukalyan@gmail.com>
To: "P.Manohar" <pmanohar@lantana.cs.iitm.ernet.in>
Cc: linux-kernel@vger.kernel.org
Subject: Re: opening linux char device file in user thread.
Date: Thu, 4 Aug 2005 15:44:24 +0530 [thread overview]
Message-ID: <7d15175e05080403145a151b79@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.60.0508041317360.5451@lantana.cs.iitm.ernet.in>
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.
next prev parent reply other threads:[~2005-08-04 10:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-04 7:50 opening linux char device file in user thread P.Manohar
2005-08-04 10:14 ` Bhanu Kalyan Chetlapalli [this message]
2005-08-13 10:07 ` P.Manohar
2005-08-13 10:12 ` starting a user defined daemon at linux startup P.Manohar
2005-08-13 10:19 ` Jan-Benedict Glaw
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7d15175e05080403145a151b79@mail.gmail.com \
--to=chbhanukalyan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmanohar@lantana.cs.iitm.ernet.in \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox