Re: close() problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



An HTML based email.  Please, not here.

Answer below which is standard protocol on this list.

2009/4/16 snoppy1314 <snoppy1314@xxxxxxx>:
>
>
> Hi:
>
> I have three progree: HIT, new-sim300 and pppd, also have a driver
> cdc-acm.ko(it generates a device file /dev/ttyACM0).
> I call open(/dev/ttyACM0) in HIT, and then call system("./pppd") and
> system("./new-sim300") in HIT. I think, when  I kill HIT, the
> close(dev/ttyACM0) will be called automatically.But in fact, the
> close(dev/ttyACM0) isn't called until the pppd, new-sim300 and HIT are all
> killed.who can tell me why?
> Thanks in advance!

Below is guesswork:

I suspect that in HIT you close one of stdin / stdout / stderr.  Then
when you open /dev/ttyACM0, it gets assigned one of those file
descriptors.

The system() call then launches the children with the inherited stdin
/ stdout / stderr files already open.  The number of times the file is
open is tracked and your kernel close() code is not called until the
open count is decremented to zero based on all three programs dieing.

Greg
-- 
Greg Freemyer
Head of EDD Tape Extraction and Processing team
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
First 99 Days Litigation White Paper -
http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux