2009-12-07 00:24:02     Problem while opening LCD driver.

Document created by Aaronwu Employee on Aug 20, 2013
Version 1Show Document
  • View in full screen mode

2009-12-07 00:24:02     Problem while opening LCD driver.

Ariv S (UNITED STATES)

Message: 83136   

 

Hi,

 

I was trying to close and reopen a LCD driver using open() and close() driver calls.But consistently i was getting "Too many open files" error while reopening the LCD driver, eventhough i set the softlimits to unlimited value(0x7FFFFFFF).

 

Please anyone help me in resolving this issue.

 

Thanks in advance.

 

Regards,

 

Ariv

QuoteReplyEditDelete

 

 

2009-12-07 01:01:56     Re: Problem while opening LCD driver.

Mike Frysinger (UNITED STATES)

Message: 83137   

 

you didnt say what driver you're using.  make sure the driver itself allows more than one person to open it at a time.

QuoteReplyEditDelete

 

 

2009-12-07 01:25:58     Re: Problem while opening LCD driver.

Ariv S (UNITED STATES)

Message: 83143   

 

Hi Mike,

 

It's CHIMEI driver. Please find below the steps i followed for my experiment.

 

{

 

    fd = open("......");

 

    if(fd < 0){

 

       Error opening driver;

 

    }

 

   /* some other operations like thread creation etc. */

 

   close(fd);

 

/* Reopening the same driver  */

 

    fd = open("......"); -------> in this point i'm getting "too many open files" error

 

    if(fd < 0){

 

       Error opening driver;

 

    }

 

}

QuoteReplyEditDelete

 

 

2009-12-07 02:39:54     Re: Problem while opening LCD driver.

Mike Frysinger (UNITED STATES)

Message: 83146   

 

i dont know what a "CHIMEI driver" is.  you'll have to read/debug the driver yourself.

QuoteReplyEditDelete

 

 

2009-12-07 03:55:01     Re: Problem while opening LCD driver.

Ariv S (UNITED STATES)

Message: 83167   

 

Hi Mike,

 

Its a LCD driver.

 

In general, i would like to know what may cause "too many open files" error.

 

Regards,

 

Ariv

QuoteReplyEditDelete

 

 

2009-12-07 07:30:49     Re: Problem while opening LCD driver.

Robin Getz (UNITED STATES)

Message: 83169   

 

Ariv:

 

Like Mike said - it is a problem of the driver, not of userspace.

 

-Robin

QuoteReplyEditDelete

 

 

2009-12-09 05:26:51     Re: Problem while opening LCD driver.

Ariv S (UNITED STATES)

Message: 83298   

 

Hi Mike/Robin,

 

I would like to share few information abt this issue.

 

"Too many open files" error is occuring only after creating a new process from the exsisting process using the system() call. please find below the sample code snippet and logs which will explain the same.

 

main(){---------------->Starting the main process.

 

open("LCD");

 

perror("LCD Open1 ret ");

 

system("/SampleApp &");  -------------->Starting another process inside the main process

 

perror("SampleApp creation ");

 

close();

 

perror("LCD Close ret ");

 

open();

 

perror("LCD Open2 ret "); --------------> too many open files error.

 

}

 

teraterm log:

 

root:/>./LCD -----------> Starting the main process.

LCD Open1 ret : Success

SampleApp creation : Success -------------->Starting another process inside the main process

LCD Close ret : Success

LCD Open2 ret : Too many open files

 

 

 

 

If i kill the SampleApp application after some 1sec delay and do the close and open it works well.

 

main(){---------------->Starting the main process.

 

open("LCD");

 

perror("LCD Open1 ret ");

 

system("/SampleApp &");  -------------->Starting another process inside the main process

 

perror("SampleApp creation ");

 

sleep(1);

 

system("killall SampleApp");

 

perror("Kill SampleApp ");

 

sleep(1);

 

close();

 

perror("LCD Close ret ");

 

open();

 

perror("LCD Open2 ret ");

 

}

 

teraterm log:

 

root:/>./LCD -----------> Starting the main process.

LCD Open1 ret : Success

SampleApp creation : Success -------------->Starting another process inside the main process

 

killall SampleApp : Success------------> Killing the SampleApp process

LCD Close ret : Success

LCD Open2 ret : Success

QuoteReplyEditDelete

 

 

2009-12-09 06:44:02     Re: Problem while opening LCD driver.

Mike Frysinger (UNITED STATES)

Message: 83301   

 

all that shows is that your user space code is crappy (it leaks fd's and doesnt clean up after itself) and your driver is crappy (doesnt allow multiple people to open it)

 

which really doesnt change our responses.  fix your driver.

QuoteReplyEditDelete

Attachments

    Outcomes