public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* opening linux char device file in user thread.
@ 2005-08-04  7:50 P.Manohar
  2005-08-04 10:14 ` Bhanu Kalyan Chetlapalli
  0 siblings, 1 reply; 5+ messages in thread
From: P.Manohar @ 2005-08-04  7:50 UTC (permalink / raw)
  To: linux-kernel


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).

The device is opening  when threading is not there.

Can anybody suggest me?

Regards,
P.Manohar.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: opening linux char device file in user thread.
  2005-08-04  7:50 opening linux char device file in user thread P.Manohar
@ 2005-08-04 10:14 ` Bhanu Kalyan Chetlapalli
  2005-08-13 10:07   ` P.Manohar
  2005-08-13 10:12   ` starting a user defined daemon at linux startup P.Manohar
  0 siblings, 2 replies; 5+ messages in thread
From: Bhanu Kalyan Chetlapalli @ 2005-08-04 10:14 UTC (permalink / raw)
  To: P.Manohar; +Cc: linux-kernel

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: opening linux char device file in user thread.
  2005-08-04 10:14 ` Bhanu Kalyan Chetlapalli
@ 2005-08-13 10:07   ` P.Manohar
  2005-08-13 10:12   ` starting a user defined daemon at linux startup P.Manohar
  1 sibling, 0 replies; 5+ messages in thread
From: P.Manohar @ 2005-08-13 10:07 UTC (permalink / raw)
  To: Bhanu Kalyan Chetlapalli; +Cc: linux-kernel


thanks for help, it is working now, I opened the char file before the 
thread starts.

On Thu, 4 Aug 2005, Bhanu Kalyan Chetlapalli wrote:

> 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.
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* starting a user defined daemon at linux startup.
  2005-08-04 10:14 ` Bhanu Kalyan Chetlapalli
  2005-08-13 10:07   ` P.Manohar
@ 2005-08-13 10:12   ` P.Manohar
  2005-08-13 10:19     ` Jan-Benedict Glaw
  1 sibling, 1 reply; 5+ messages in thread
From: P.Manohar @ 2005-08-13 10:12 UTC (permalink / raw)
  To: linux-kernel

Hai
   I want to start a daemon at startup in linux.
I came to know that we need to put a script into /etc/rc.d/init.d/
similar to sshd or atd. Do we need to write a script to run my daemon?

But my daemon is just a single executable, is there any othr way to do 
this.

Thanks In Advance.
P.manohar.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: starting a user defined daemon at linux startup.
  2005-08-13 10:12   ` starting a user defined daemon at linux startup P.Manohar
@ 2005-08-13 10:19     ` Jan-Benedict Glaw
  0 siblings, 0 replies; 5+ messages in thread
From: Jan-Benedict Glaw @ 2005-08-13 10:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: P.Manohar

[-- Attachment #1: Type: text/plain, Size: 738 bytes --]

On Sat, 2005-08-13 15:42:37 +0530, P.Manohar <pmanohar@lantana.cs.iitm.ernet.in> wrote:
> Hai
>   I want to start a daemon at startup in linux.
> I came to know that we need to put a script into /etc/rc.d/init.d/
> similar to sshd or atd. Do we need to write a script to run my daemon?

This isn't exactly a Linux kernel-related question, but to answer it
anyways: that's the way to go.

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-08-13 10:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-04  7:50 opening linux char device file in user thread P.Manohar
2005-08-04 10:14 ` Bhanu Kalyan Chetlapalli
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox