Module usecount probs with 2.4.0-test5

Module usecount probs with 2.4.0-test5

Post by Alexander Schul » Mon, 31 Jul 2000 04:00:00


I tried to port two of my older modules from 2.0 to 2.4. After changing some
prototypes and stuff, the first one seems to work ok, except every time I
run a program on it, the usecount is incremented by one. I have one
MOD_INC_USE_COUNT in the open- and one MOD_DEC_USE_COUNT in the
release-function. That always worked. I used GET_USE_COUNT to print the
usecount and it is always 2 when open is called, and thus 3 when release is
called. My MOD_DEC_USE_COUNT decrements it to 2, something after that
decrements it to one. But that is still too much, of course.

When the module is opened and another program tries to open it, open returns
-EBUSY without incrementing the usecount. But what happens is this: open is
called with usecount=5 (again incremented by 2) and leaves it at 4 after it
returned the error.

Can anybody tell me what is changing my usecount here? Other modules
(smc-ultra, sensors, lm75 etc.) seem to work correctly, so probably it's
something with my module but I really can't find it.

I am usig modutils 2.3.11, kernel 2.4.0-test5, glibc 2.1.3, gcc 2.95.2,
binutils 2.9.5, the module is compiled with:
gcc -O2 -Wall -DMODULE -D__KERNEL__ -D__SMP__ -I/usr/src/linux/include
-fomit-frame-pointer -c devicenet.c

Any ideas?

Thanks in advance


1. Prob spawning a process in my module ..


I am trying to start a process(daemon if ya like) from a module I built ....
the problem I have is that after I execute (start) the process it dies as
soon as the parent (my module) is not active anymore ....

My first try was to fork and exec it from the 'module initialisation
handler' I added .. but as soon as the handler is left by apache the daemon
is dead again (if I put something like while(1) at the end of this handler
I can see it is up and running) ...

My second try was to use ap_bspawn_child/ap_call_exec (like descriped in the
O'Reilly book on apache modules pg 628) ... because this method requires the
request_rec to be available I put it in my actual content handler (whith a
testbit around it to only start it once .... ) so it should start when my
hanler is invoked ... problem is the same as before .. when the handler is
invoked for the first time .. my process is started but as soon as the
apache control thread leaves the handler it dies again ... a while(1) at the
end of the handler to test showed that the daemon is running .....

Now I could of course start the daemon by hand instead of starting it from
my module .. but I would still like to know how u can exec a program which
will actually remain alive .....



p.s. if I start the process from a shell it works fine ... I have
apache_1.3.14/mm-1.1.3/mod_ssl-2.7.1-1.3.14/openssl-0.9.6 running on RH7
with a 2.2.16 kernel (yeh I removed the crap development stuff and put
egcs-1.1.2-30 back on there ..)

2. Q: Netscape slows up drastically after attempting to close

3. cdrom / module probs...

4. Netscape 4.5 & Acroread 3.02. . .

5. XFree 4 crashes kernel 2.4.0-test5

6. 802.11g

7. probs loading ppa as module

8. Help

9. G400, DRI, 2.4.0-test5

10. cdrom / module probs...

11. kernel 2.4.0-test5 - Where does one file 'undocumented feature' reports?

12. Apache, PHP, and MySQL module probs

13. Probs with PPP loadable module