Hi!

I have a problem reading files in the /proc directory in C.

I made a module for reading SMARTTEMP temperature sensors, and it works great. 
I made it to create one file for each I/O pin under /proc/smarttemp/. Working 
beautifully.

I also made a module for controlling my LCD display, and that to works like a 
charm.

I put together a small test program to read 8 different temperaturs from 
different sensors and then display them on the display updating once every 
second.

Works great, for two minutes...

Then, when one of the /proc files is read for the 1024:th time problems occurs. 
It turns out the file descriptors are out..! They don't seem to get relesaed 
when I do a fclose (I use fopen and fclose on them, is this a problem?).

I get no problems if I change the program to read from a file on the normal FS 
instead.

If I try to read some other file in /proc i get the same error after 1024 
loops... So it seems it's not in my driver code.

I tried to do a system("cp /proc/smarrtemp/PG01 /var/temp"); for each 
measurement and then reading the file in /var instead, trying to fool it a bit, 
just for testing. But after about 1024 copies I still get problems.

I would be very thankful for any ideas about why this is and how to get it 
working.

I use the image on ACMEs homepage, 2.6 something. =)

Best regards, Jonas



Reply via email to