Re: CLONE_FILES problem.

really kuznet@ms2.inr.ac.ru (inr-linux-kernel@ms2.inr.ac.ru)
19 Aug 1996 15:46:07 +0400


Matthias Urlichs (smurf@smurf.NOris.DE) wrote:

: The easiest solution is probably to add a global flag (and a wait list)=
: to
: the fd and mm structures -- close() and munmap() would be considered
: "writers", and all other system calls would be "readers" as far as thes=
: e
: structures are concerned. Something should probably be done with
: blocking accesses to files, i.e. if one thread is read()ing from a file
: descriptor which another wants to close, the first should get a signal =
: or
: something.

Why not increment f_count, when grabbing a file struct?
It is graceful solution (checked), and it will make
kernel only more beautiful.

F.e. when one thread writes to socket and sleeps because
of flow control, and second thread closes it, it is removed
from file descriptor table, but not closed really (f_count goes from 2
to 1), so that the first thread will successfuly finish write and socket will
be closed on the exit from sendmsg. Is it not nice?

Alexey Kuznetsov.