I thought of doing something like -
static inline is_fds_shared(void)
{
struct files_struct *files = current->files;
return atomic_read(&files->count) != 1;
}
sys_blah(..)
{
int fds_shared = is_fds_shared();
file = fget_light(fd, fds_shared);
...
...
fput_light(file, fds_shared);
}
It still didn't look very natural. We leave open the possibility of
users doing is_fds_shared() for both fget_light and fput_light.
With fput_needed flag, atleast we force them to use what is returned
by fget_light.
Thanks
Dipankar
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/